>For usage of ccache at our company, here is one of our biggest hassles today: 
>even with the CCACHE_BASEDIR feature, users complain when gdb points to files 
>that no longer exist.
>
>Independently, a couple of our engineers have proposed the following fix :
>
>1. On a cache miss, generate preprocessor output.
>2. Modify it to extend debug symbol path names to some arbitrary path e.g. :
>  # 1 "/any/path/you/want/ca44a4def837bde348a738112/a.c"
>  # 1 "<built-in>"
>  # 1 "<command line>"
>  # 1 "/any/path/you/want/ca44a4def837bde348a738112/a.c"
>  int main() {
>      return 0;
>  }
>3. Compile the modified text into an object binary and store in the cache.
>4. On a cache hit, retrieve the binary, search-and-replace the binary 
>representation of ca44a4def837bde348a738112 to the desired path name padded 
>with zeroes.
>
>All in all, it's not too different from the distcc patch to fix a similar 
>problem (http://testbit.eu/~timj/patches/), but adapted for ccache.

In a previous life we used the Perl Make::Cache module which
is similar to ccache, and it did a similar kind of
filtering.  We always passed in the root of our tree to
replace

# 1 "/the/compile/path/sub/foo.c"

with

# 1 "project/sub/foo.c"

where project was a symlink we always established to the
original source code.

This was more desirable than caching the source code because
when using GDB (etc) inside Emacs (etc) you could see the
source code inside your personal tree, using the file you
want to edit.  Otherwise, you need to poke around again to
find the "correct" version for edits.  Another advantage is
we had some huge #define headers, dozens of megabytes, and
having to save them on the first miss might have been a
bottleneck (note the sources can't be compressed in the
cache).

There is the downside with the symlink approach that if the
source changed since edit you can't see the original code.

Adding support for either scheme would be useful.
_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to