[distcc] Re: Distcc & GDB (fix)

Martin Pool mbp at samba.org
Tue May 13 02:08:39 GMT 2003


On 12 May 2003, Enno Rehling <ennor at funcom.com> wrote:
> Alexandre Oliva wrote:
> 
> >everything ``just works'' (well, except that object files would have
> >incorrect pwd information if ccache happens to reuse them from a
> >compilation in a different directory, but is this so much of a
> >problem?)
> 
> Yes. We here plan to use ccache as a kind of 'wink-in' repository for 
> object files (haven't got it to work yet, due to time constraints, but will 
> go for it soon). I would like all our developers to share the same ccache 
> directory, no matter where they keep their code checked out, so that when 
> someone makes a commit and you update, the object file for the new version 
> is already in ccache.
> 
> If I understand the discussion, when the full pwd is in the object file, 
> this wouldn't work.

The problem is when -g debug support is turned on, object files
include the name of the directory from which they were compiled.
There's no getting around this -- as Alexandre says this is a part of
several debug standards and a useful feature.

So if the cache was shared between developers, when Alan used gdb on a
file that had been inserted into the cache by Betty, gdb would want to
look at Betty's source directory.  This would cause trouble if
e.g. Alan didn't have permission to look at that tree.  It might be
confusing if Alan tried to edit the source file that was opened by the
debugger.  Alan can fix this by using the "dir" command in gdb to
force it to look in his tree.  If Alan changes the file (to a
previously uncached text) and rebuilds, then everything will be fine,
since the new file will be taken from his directory.

Alternatively we can set it up so that ccache *does* consider the
source directory one of the determinants of the object file, e.g. by
embedding it in the preprocessor output as Alexandre's patch does.
This means that if Betty builds a file in one directory there will not
be a hit unless Alan builds from the same directory.  So there would
be relatively little gain from using a shared cache.

Both situations have problems.  As a general principle I think ccache
and distcc ought to be as close to a regular build as possible and
therefore it is correct not to get hits in builds from different
directories.

For non-debug builds, none of this is a problem; everything will
match.

Alternatively we might try to patch gcc so as to optionally leave out
the directory entirely.  This would allow matches from shared caches
and allow distcc to work with no change to the preprocessor, at the
expense of making the debug user explicitly specify a directory in
cases where it can presently sometimes be found automatically.

I wonder how Clearcase handles this?  I can't see how it would do any
better than the above alternatives.

-- 
Martin 


More information about the distcc mailing list