This is the mail archive of the
mailing list for the GDB project.
Fwd: Fwd: how to determine location of source?
Er, sorry, I keep forgetting to hit reply to all.
---------- Forwarded message ----------
From: Brendan Miller <email@example.com>
Date: Mon, Mar 2, 2009 at 7:27 PM
Subject: Re: Fwd: how to determine location of source?
To: Joel Brobecker <firstname.lastname@example.org>
On Mon, Mar 2, 2009 at 6:38 PM, Joel Brobecker <email@example.com> wrote:
>> Hmm... info sources and maintenance print psymbols PSYMS gives me
>> relative, not absolute paths. Maybe that's all that's encoded into my
> Yes and no. I will assume that you are building on a target that
> runs ELF binaries and that your debugging info is DWARF, but the
> principles are the same regardless.
> Usually, what the compiler provides a debugging information is
> one attribute that tells you the name of the directory from which
> the compilation was done. Check out the DW_AT_comp_dir attribute,
> and then one attribute that gives you the name of the source file
> as it was given to GCC.
> /my/sources% gcc -c -g subdir/foo.c
> Will result in:
> DW_AT_comp_dir = /my/sources
> DW_AT_name = subdir/foo.c
Ah, excellent, I was able to get at that information with readelf -w