Trying to get GDB to find PE symbol file via build-id

Benjamin Gilbert <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAFKqAcSMNCqZ8cu80XTXkysw_8GZcPvMoSCFu=D=YU49o7zEMw@mail.gmail.com>
[re-sent due to Gmail HTMLification]

Hi all,

I'm trying to build a Win32 DLL with separate debug symbols, but I
can't seem to get GDB to automatically load a symbol file using the PE
build-id support added in ld 2.25.  I'm running on Fedora 21 x86_64,
with a gdb built from binutils-gdb HEAD (3e95021) and configured with
"--target=i686-w64-mingw32".

What I'm doing:

1.  Cross-build the DLL with MinGW-w64 and LDFLAGS="-Wl,--build-id".

2.  Create stripped DLL with "i686-w64-mingw32-objcopy -S
unstripped.dll stripped.dll".

3.  Create symbol file with "i686-w64-mingw32-objcopy
--only-keep-debug unstripped.dll debug/.build-id/MM/NNNN.debug", where
"MMNNNN" is the hex string returned by "i686-w64-mingw32-objdump -p
unstripped.dll | grep signature".

4.  In i686-w64-mingw32-gdb, run "set debug-file-directory debug" and
"file stripped.dll".

Result: "Reading symbols from stripped.dll...(no debugging symbols
found)...done."

An strace of the gdb process shows that it doesn't try to access any
.debug files in debug/, so the problem isn't that I used the wrong
filename.  Manually loading the symbol file with "symbol-file
debug/.build-id/MM/NNNN.debug" does work.

Advice?  Am I going about this wrong?

Thanks,
--Benjamin Gilbert
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.