This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] add -foverride-comp-dir
- From: Dan Aloni <da-x at monatomic dot org>
- To: Geoffrey Keating <geoffk at apple dot com>, gcc-patches at gcc dot gnu dot org
- Cc: Daniel Jacobowitz <drow at false dot org>
- Date: Sun, 1 Oct 2006 10:40:05 +0200
- Subject: Re: [PATCH] add -foverride-comp-dir
- References: <20060926135209.GA3599@localdomain> <email@example.com> <20061001013819.GA12702@nevyn.them.org>
On Sat, Sep 30, 2006 at 09:38:19PM -0400, Daniel Jacobowitz wrote:
> On Wed, Sep 27, 2006 at 12:25:32AM -0700, Geoffrey Keating wrote:
> > Dan Aloni <firstname.lastname@example.org> writes:
> > > Hello,
> > >
> > > The following patch adds a new switch to gcc that allows to override
> > > the DW_AT_comp_dir DWARF2 attribute. The reason why I need this change
> > > is that one of our project's build system is using content-hashing in
> > > order to save build and compilation time among several developers that
> > > are working on that project.
> > >
> > > When debug information is used, we need to make sure that that the
> > > result binaries are identical if compiled from the same source between
> > > several developers working from different directories, and also to be
> > > able to look at core files from gdb with proper (i.e. path-relative)
> > > source code lookup. By simply passing -foverride-comp-dir=. to gcc
> > > after this feature is patched in, we are able to achieve our goals.
> > Would it be better to simply have a -fno-comp-dir flag, to omit this
> > information entirely from the DWARF output?
Could having no DW_AT_comp_dir confuse gdb? I'm not certain about it, but
we should check this. Anyway, it would require a longer patch.
> A related FYI: While it won't help with the content-hashing, the GDB
> side of this is addressed by the recently added substitution commands
> in CVS.
So, in that case we could run gdb from any directory and then run a command
to substitute '.' with the `pwd` of compilation. Sounds useful.
BTW if I wasn't clear in my first mail, we are compiling all our C files
from the same `pwd`, even if the files are in sub-directories.
gcc -c dir/subdir/a.c -o dir/subdir/a.o
gcc -c other/b.c -o other/b.o
I prefer to have this backward compatible - I already know that at least
one older version of gdb perfectly handles the situation where '.' is the
Dan Aloni, Linux specialist
XIV LTD, http://www.xivstorage.com
email@example.com, firstname.lastname@example.org, email@example.com, firstname.lastname@example.org