public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: Trying to get GDB to find PE symbol file via build-id
       [not found] <CAFKqAcT3qbRGNrczTyPpVW7vrm2GhVUbWVuhupn1YYwEQCOomA@mail.gmail.com>
@ 2015-03-09 16:44 ` Jon TURNEY
  2015-03-16 15:41   ` Jon TURNEY
  0 siblings, 1 reply; 7+ messages in thread
From: Jon TURNEY @ 2015-03-09 16:44 UTC (permalink / raw)
  To: Benjamin Gilbert, gdb

On 08/03/2015 22:52, Benjamin Gilbert wrote:
> 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".

Sorry, this was not something that I needed, so I never got around to 
looking at what was needed to hook this up in gdb.

At the moment, fetching the build-id for gdb is only implemented for ELF 
files (See gdb/build-ic.c:build_id_bfd_get())

It should be pretty straightforward to extend that to handle PE files as 
well, and add an interface to get the PE build-id out of BFD...


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to get GDB to find PE symbol file via build-id
  2015-03-09 16:44 ` Trying to get GDB to find PE symbol file via build-id Jon TURNEY
@ 2015-03-16 15:41   ` Jon TURNEY
  2015-03-19  5:05     ` Benjamin Gilbert
  0 siblings, 1 reply; 7+ messages in thread
From: Jon TURNEY @ 2015-03-16 15:41 UTC (permalink / raw)
  To: Benjamin Gilbert, gdb

On 09/03/2015 16:44, Jon TURNEY wrote:
> On 08/03/2015 22:52, Benjamin Gilbert wrote:
>> 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".
>
> Sorry, this was not something that I needed, so I never got around to
> looking at what was needed to hook this up in gdb.
>
> At the moment, fetching the build-id for gdb is only implemented for ELF
> files (See gdb/build-ic.c:build_id_bfd_get())
>
> It should be pretty straightforward to extend that to handle PE files as
> well, and add an interface to get the PE build-id out of BFD...

Well, slightly less straightforward than I thought it would be, but I 
wrote a patch to do that...

[1] https://sourceware.org/ml/gdb-patches/2015-03/msg00458.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to get GDB to find PE symbol file via build-id
  2015-03-16 15:41   ` Jon TURNEY
@ 2015-03-19  5:05     ` Benjamin Gilbert
  2015-03-19  6:31       ` asmwarrior
  0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Gilbert @ 2015-03-19  5:05 UTC (permalink / raw)
  To: Jon TURNEY; +Cc: gdb

On Mon, Mar 16, 2015 at 11:41 AM, Jon TURNEY
<jon.turney@dronecode.org.uk> wrote:
> On 09/03/2015 16:44, Jon TURNEY wrote:
>> At the moment, fetching the build-id for gdb is only implemented for ELF
>> files (See gdb/build-ic.c:build_id_bfd_get())
>>
>> It should be pretty straightforward to extend that to handle PE files as
>> well, and add an interface to get the PE build-id out of BFD...
>
> Well, slightly less straightforward than I thought it would be, but I wrote a patch to do that...
>
> [1] https://sourceware.org/ml/gdb-patches/2015-03/msg00458.html

Your patch works for me.

Thanks,
--Benjamin Gilbert

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to get GDB to find PE symbol file via build-id
  2015-03-19  5:05     ` Benjamin Gilbert
@ 2015-03-19  6:31       ` asmwarrior
  2015-03-19  6:53         ` asmwarrior
  2015-03-19 12:23         ` Jon TURNEY
  0 siblings, 2 replies; 7+ messages in thread
From: asmwarrior @ 2015-03-19  6:31 UTC (permalink / raw)
  To: Benjamin Gilbert, Jon TURNEY; +Cc: gdb

On 2015-3-19 13:05, Benjamin Gilbert wrote:
> On Mon, Mar 16, 2015 at 11:41 AM, Jon TURNEY
> <jon.turney@dronecode.org.uk> wrote:
>> On 09/03/2015 16:44, Jon TURNEY wrote:
>>> At the moment, fetching the build-id for gdb is only implemented for ELF
>>> files (See gdb/build-ic.c:build_id_bfd_get())
>>>
>>> It should be pretty straightforward to extend that to handle PE files as
>>> well, and add an interface to get the PE build-id out of BFD...
>>
>> Well, slightly less straightforward than I thought it would be, but I wrote a patch to do that...
>>
>> [1] https://sourceware.org/ml/gdb-patches/2015-03/msg00458.html
> 
> Your patch works for me.
> 
Do you know there are any native compiler suite under Windows which support "build-id" option? 
I just tried recent native MinGW and MinGW-W64 compiler suite, the ld.exe in those suites doesn't supoort this option.

Yuanhui Zhang


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to get GDB to find PE symbol file via build-id
  2015-03-19  6:31       ` asmwarrior
@ 2015-03-19  6:53         ` asmwarrior
  2015-03-19 12:23         ` Jon TURNEY
  1 sibling, 0 replies; 7+ messages in thread
From: asmwarrior @ 2015-03-19  6:53 UTC (permalink / raw)
  To: Benjamin Gilbert; +Cc: gdb

On 2015-3-19 14:38, asmwarrior wrote:
> Do you know there are any native compiler suite under Windows which support "build-id" option? 
> I just tried recent native MinGW and MinGW-W64 compiler suite, the ld.exe in those suites doesn't supoort this option.
I see your post:
> 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".
The feature is added in ld 2.25, I see mingw-w64 and mingw now only ship 2.24 version.
Sorry about the noise.

Yuanhui Zhang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Trying to get GDB to find PE symbol file via build-id
  2015-03-19  6:31       ` asmwarrior
  2015-03-19  6:53         ` asmwarrior
@ 2015-03-19 12:23         ` Jon TURNEY
  1 sibling, 0 replies; 7+ messages in thread
From: Jon TURNEY @ 2015-03-19 12:23 UTC (permalink / raw)
  To: asmwarrior; +Cc: gdb

On 19/03/2015 06:38, asmwarrior wrote:
> On 2015-3-19 13:05, Benjamin Gilbert wrote:
>> On Mon, Mar 16, 2015 at 11:41 AM, Jon TURNEY wrote:
>>> On 09/03/2015 16:44, Jon TURNEY wrote:
>>>> At the moment, fetching the build-id for gdb is only implemented for ELF
>>>> files (See gdb/build-ic.c:build_id_bfd_get())
>>>>
>>>> It should be pretty straightforward to extend that to handle PE files as
>>>> well, and add an interface to get the PE build-id out of BFD...
>>>
>>> Well, slightly less straightforward than I thought it would be, but I wrote a patch to do that...
>>>
>>> [1] https://sourceware.org/ml/gdb-patches/2015-03/msg00458.html
>>
>> Your patch works for me.
>>
> Do you know there are any native compiler suite under Windows which support "build-id" option?
> I just tried recent native MinGW and MinGW-W64 compiler suite, the ld.exe in those suites doesn't support this option.

You need a recent binutils (2.25 or later).  If you have that, it should 
work.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Trying to get GDB to find PE symbol file via build-id
@ 2015-03-08 22:57 Benjamin Gilbert
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Gilbert @ 2015-03-08 22:57 UTC (permalink / raw)
  To: gdb; +Cc: jon.turney

[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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-19 12:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAFKqAcT3qbRGNrczTyPpVW7vrm2GhVUbWVuhupn1YYwEQCOomA@mail.gmail.com>
2015-03-09 16:44 ` Trying to get GDB to find PE symbol file via build-id Jon TURNEY
2015-03-16 15:41   ` Jon TURNEY
2015-03-19  5:05     ` Benjamin Gilbert
2015-03-19  6:31       ` asmwarrior
2015-03-19  6:53         ` asmwarrior
2015-03-19 12:23         ` Jon TURNEY
2015-03-08 22:57 Benjamin Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).