Reading DWARF debug information from a PE executable

Nick Clifton nickc@redhat.com
Thu Apr 18 09:17:00 GMT 2019


Hi Artem,

> This is my first question here and I hope it is suitable for this list.

Actually you might find it more helpful ask this question on the elfutils
mailing list (elfutils-devel@sourceware.org) since libdwarf is part of that
project.  Or you could try the binutils mailing list (binutils@sourceware.org) 
as the facilities that you are asking for are available in the BFD library, 
which is part of the binutils project.


> I've tried to adopt libdwarf but it seems to be able to read files in
> ELF format only. At the same time mingw places debug information to
> several PE sections.

One possible solution - albeit rather of a hack - is to extract the debug
sections from the PE file and then insert them into an ELF file and the
use libdwarf to examine them.

> Or probably there are other ways to work with DWARF in case of PE executables...

Check out the BFD library from the binutils project.  It has the ability
to read PE format files, and to traverse the debug information in them.
For example the objdump utility from the binutils project supports a -w
command line option to display debug information which works even on PE
format files.

Cheers
  Nick




More information about the Gdb mailing list