]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Print attribute name and form in error message.
authorMark Wielaard <mark@klomp.org>
Tue, 21 Nov 2017 10:13:00 +0000 (11:13 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 24 Nov 2017 10:20:44 +0000 (11:20 +0100)
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 <mark@klomp.org>
src/ChangeLog
src/readelf.c

index d112cd2e5543813695f6019e4f7583272124ca3b..c56c323cc4b204062376e87049fd104d47e478a5 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-21  Mark Wielaard  <mark@klomp.org>
+
+       * 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  <mark@klomp.org>
 
        * readelf.c (attr_callback): Print DIE offset in error messages.
index e364583c8c580185e17d24e173599be0dbb72170..a9168d1e2a0d9459e95c66b668c4ba728b47eec8 100644 (file)
@@ -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);