From ce0469a04bf3b8e438647bb66f468c16ac52a4af Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Nov 2017 11:13:00 +0100 Subject: [PATCH] readelf: Print attribute name and form in error message. Now an error getting the attribute value will not only print the DIE offset and the reason, but also the attribute name and form. e.g. DIE [b] cannot get attribute 'ranges' (sec_offset) value: .debug_ranges section missing Signed-off-by: Mark Wielaard --- src/ChangeLog | 5 +++++ src/readelf.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index d112cd2..d2b25de 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2017-11-21 Mark Wielaard + + * readelf.c (attr_callback): Print attribute name and form in error + message. + 2017-10-03 Mark Wielaard * readelf.c (attr_callback): Print DIE offset in error messages. diff --git a/src/readelf.c b/src/readelf.c index e364583..229c036 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -5968,8 +5968,12 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) attrval_out: if (!cbargs->silent) error (0, 0, gettext ("DIE [%" PRIx64 "] " - "cannot get attribute value: %s"), - dwarf_dieoffset (die), dwarf_errmsg (-1)); + "cannot get attribute '%s' (%s) value: " + "%s"), + dwarf_dieoffset (die), + dwarf_attr_name (attr), + dwarf_form_name (form), + dwarf_errmsg (-1)); return DWARF_CB_ABORT; } char *a = format_dwarf_addr (cbargs->dwflmod, cbargs->addrsize, -- 1.8.3.1