>... >When ccache invokes my compiler, it runs like this: > > cd /path/to/ONE/obj/subdir/foo > my-special-gcc -c -E ../../../src/subdir/foo/foo.c > >This works, as you can see above. But, it's a serious drag from a >debugging standpoint, because now the pathname for that file in my debug >information is _based on the obj/subdir/foo directory_. > >That means that basically in gdb I have to add EVERY DIRECTORY (or at >least, one directory at every level) to my source file search path, so >that when the "../../../" is added the right thing is found. > >In other words I can't just add "/path/to/ONE" to the GDB search path, >because "/path/to/ONE/../../../src/subdir/foo/foo.c" obviously doesn't >exist. I have to add a directory at each level so that when GDB adds >the relative path to it, the right value is found. > >Ouch. >... >What I'd really like is for ccache to do this: > > cd /path/to/ONE > my-special-gcc -c -E src/subdir/foo/foo.c > >then write the .o out into /path/to/ONE/obj/subdir/foo as it would have >normally. > >I do realize it is very dangerous in general for ccache to use a >different working directory than the one it started in, because there >could be -I options etc. on the command line which are relative to the >working directory and not fully-qualified. In my particular case, >though, that's not an issue since all my paths ARE fully-qualified. > >But, I'm not sure I know how else to get this working; it seems like a >pretty serious problem. Has anyone else on the list gotten sharing >between workspaces to work properly, and if so how did you deal with >these issues?
I solved this problem with a different build process and caching tool once. What we did was intercept the preprocessed code and edit the "#" directives that indicate the file name and line number to the compiler (and eventually the debugger). Specifically we specified in an environment variable the common prefix (/user_a_source_path/) then replaced it with a standard relative prefix (project/). When running the code we always had a symlink from /user_b_source_path/... to project. Files futher down just worked out, as the prefix was always the top of the build tree. This all worked wonderfully. Our current build doesn't need it, but it would still be something we'd use if it was added to ccache (maybe as a list of strings to search/replace?). -Wilson _______________________________________________ ccache mailing list firstname.lastname@example.org https://lists.samba.org/mailman/listinfo/ccache