[ccache] improving ccache to work with debug symbols?

James Donald jdonald at nvidia.com
Mon Feb 28 01:18:16 MST 2011

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.

I have run this by Joel so far. We have yet to hear of any existing patch to fix the debug symbol path problem, but the idea seems feasible at first glance.
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

More information about the ccache mailing list