working with split debug files and sectionless ELFs

Mike Frysinger vapier@gentoo.org
Fri Oct 14 15:37:00 GMT 2011


On Friday 14 October 2011 10:23:04 Aleksandar Ristovski wrote:
> On 11-10-12 01:35 PM, Mike Frysinger wrote:
> > second, i wonder if we can't have this work more intelligently out of the
> > box. is it unreasonable to have gdb automatically search /usr/lib/debug/
> > for split debuf files if the .gnu_debuglink section does not exist ?  or
> > at least do it if the ELF has no sections at all ?  it'd be nice if we
> > could do `gdb prog` and gdb is smart enough to at least check
> > /usr/lib/debug/usr/bin/prog.debug. -mike
> 
> Can this be used for what you want:
> 
> (gdb) help set debug-file-directory

that is already set to "/usr/lib/debug/" by default.  if you look at the logic 
that loads the split debug files, the issue is that it immediately returns if 
no debugging information is found in the ELF -- which there isn't if all the 
sections have been split out.  so it doesn't get a chance to scan the debug 
file directory.

check out symfile.c:find_separate_debug_file_by_debuglink().  i hacked it locally 
so that when get_debug_link_info() returns NULL, the code would fall back to 
searching for the basename(argv[0]) + ".debug" of the ELF in question.  that 
seemed to do what i want: "just work".
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/gdb/attachments/20111014/b7af113d/attachment-0001.sig>


More information about the Gdb mailing list