This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: Fwd: how to determine location of source?


Er, sorry, I keep forgetting to hit reply to all.


---------- Forwarded message ----------
From: Brendan Miller <catphive@catphive.net>
Date: Mon, Mar 2, 2009 at 7:27 PM
Subject: Re: Fwd: how to determine location of source?
To: Joel Brobecker <brobecker@adacore.com>


On Mon, Mar 2, 2009 at 6:38 PM, Joel Brobecker <brobecker@adacore.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
>> binaries
>
> 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

Brendan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]