[ccache] improving ccache to work with debug symbols?

Justin Lebar justin.lebar at gmail.com
Mon Feb 28 01:42:23 MST 2011

I like this idea.

I imagine the overhead of even a naive search-and-replace will be
pretty small compared to the hashing ccache does in direct mode, since
ccache currently hashes all of a file's #includes.

But if you want to make the search-and-replace really fast, you could
choose your nonce in such a way as to make a Boyer-Moore(-Horspool)
search particularly efficient.  Just pick characters which don't
usually appear in object files.

(This might become more important if ccache adds an option to look at
files' mtimes instead of always hashing, as has been discussed here.)


On Mon, Feb 28, 2011 at 12:18 AM, James Donald <jdonald at nvidia.com> wrote:
> 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.
> -----------------------------------------------------------------------------------
> _______________________________________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache

More information about the ccache mailing list