[distcc] Re: Distcc & GDB (fix)

Martin Pool mbp at sourcefrog.net
Wed May 14 01:56:06 GMT 2003


On 13 May 2003, Thomas Walker <Thomas.Walker at morganstanley.com> wrote:
> Martin,
> 
> I'm actually considering rescinding my request regarding changing the
> behavior of gcc.  Although the way it works seems rather broken, every other
> compiler I've been able to get my hands on in the last day or so seems to do
> it this way as well... I don't know why but they do.  Although I don't use
> distcc with anything other than gcc at the moment, this looks to be
> something that would have to be changed in distcc to make it work the same
> way for a wide range of compilers.

Another problem with gcc's behaviour is that it means the object file
is not byte-for-byte identical with one compiled locally, which would
be nice for demonstrating that distcc is working correctly.  I suppose
the integrated preprocessor makes this a lost cause though...

> What are your thoughts on having the distcc client automatically expand
> foo.c to $PWD/foo.c before passing it to the preprocessor?

I have been wondering for a while whether to do that.

One small issue is that compiler error messages will then have the
full path, which may make them much longer.

Alternatively, Tim Janik has a patch that edits the .i file to
"absolutify" all the # lines.  The main difference is that this will
not affect any references to __FILE__, which are expanded by the
preprocessor.  The downside is that it is slightly more intrusive into
the workings of the compiler, which is something I would generally
like to avoid.

I think if I did it I would make it a ternary option: on, off, or
"only if -g* is seen".

> You would obviously have to make this optional (I'll leave whether
> to enable it by default or not to you) to avoid breaking ccache
> until (if?) they look into interpreting the .i file a bit before
> hashing.

Actually I suppose this ought to be done in ccache (as well).

> This would make debuggers work on all platforms without too much
> effort...

The only debugger I have used with distcc is gdb (and things based on
gdb.)  At least for gdb, it is reasonably easy to use the "directory"
command to find the right source file.  The main problem is that most
people have never needed to know about the dir command before.

In fact the situation for ccache is much worse than for distcc.
distcc is likely to produce object files that point to
/tmp/distcc_blah, which will simply fail.  But ccache might point you
at a different but valid source directory (if you have multiple
working trees), which could be very confusing.

-- 
Martin 


More information about the distcc mailing list