diff options
author | Mark Wielaard <[email protected]> | 2017-11-21 11:13:00 +0100 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2017-11-24 11:20:44 +0100 |
commit | 080e3f5b39eb722edd7ced68c072a82a6cc5bffb (patch) | |
tree | 05ce2686bd48c4a8d9b8b816cd298a163942d062 | |
parent | 4d36d125fac8999506b8b2137d6b04c0354954ac (diff) |
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
Also we don't abort, but try to print the other attributes of the DIE
anyway. It might just be one attribute whose value cannot be resolved.
Signed-off-by: Mark Wielaard <[email protected]>
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/readelf.c | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d112cd2e..c56c323c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2017-11-21 Mark Wielaard <[email protected]> + + * readelf.c (attr_callback): Print attribute name and form in error + message. If only the value cannot be retrieved/resolved don't abort. + 2017-10-03 Mark Wielaard <[email protected]> * readelf.c (attr_callback): Print DIE offset in error messages. diff --git a/src/readelf.c b/src/readelf.c index e364583c..a9168d1e 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -5968,9 +5968,14 @@ 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)); - return DWARF_CB_ABORT; + "cannot get attribute '%s' (%s) value: " + "%s"), + dwarf_dieoffset (die), + dwarf_attr_name (attr), + dwarf_form_name (form), + dwarf_errmsg (-1)); + /* Don't ABORT, it might be other attributes can be resolved. */ + return DWARF_CB_OK; } char *a = format_dwarf_addr (cbargs->dwflmod, cbargs->addrsize, addr, addr); |