[PATCH] readelf: Print DIE offset in attribute reading error messages.

Mark Wielaard mark@klomp.org
Wed Nov 22 11:59:00 GMT 2017

On Tue, 2017-11-21 at 11:21 +0100, Mark Wielaard wrote:
> On Thu, 2017-11-16 at 15:31 +0100, Mark Wielaard wrote:
> > On Tue, 2017-10-03 at 16:59 +0200, Mark Wielaard wrote:
> > > When processing large files it is useful to know the DIE offset if
> > > printing of attributes fails (especially when redirecting the output).
> > > With this change the error message looks like:
> > > 
> > >   eu-readelf: DIE [2aeb8ef1] cannot get attribute value: invalid DWARF
> > 
> > Got another report about a large debug file where this improved error
> > message would have been really handy. So I pushed it to master now.
> This has been really useful to debug some DWARF format issues, but it
> could be even more useful. Since we know the attribute name and form
> (or we would have generated an error earlier) add those to the error
> message too.

I made one other tweak to not abort, but keep trying to print the other
attributes of the DIE. It might just be this one attribute whose value
cannot be retrieved/resolved. Other errors (like not being able to
decode the attribute code or form still abort because then we really
don't know how to continue and the abbrev is probably bogus.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-readelf-Print-attribute-name-and-form-in-error-messa.patch
Type: text/x-patch
Size: 2012 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/elfutils-devel/attachments/20171122/37f448dd/attachment.bin>

More information about the Elfutils-devel mailing list