This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Fwd: how to determine location of source?
> 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
This is of course not standardized, so any combination of comp_dir/name
can happen, but this is what GCC does as far as I know. The DWARF
dumper will give you that info.
--
Joel