]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf: Use dwarf_form_name for printing (unknown) forms.
authorMark Wielaard <mark@klomp.org>
Mon, 1 Jan 2018 21:39:24 +0000 (22:39 +0100)
committerMark Wielaard <mark@klomp.org>
Mon, 1 Jan 2018 21:42:05 +0000 (22:42 +0100)
Use dwarf_form_name consistently to print forms. attr_callback was
using its own string conversion, print_debug_macro_section was using
dwarf_form_string instead of dwarf_form_name.

The difference between dwarf_form_string and dwarf_form_name is that
the first returns NULL if the form is unknown and the second returns
an hexadecimal string representation in that case.

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/readelf.c

index 9d6ec8304e482dcbbd84d5035b7276280e571319..49b0cc036706a7ebd1c7a9b3ffb8998b64d6ff6d 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-01  Mark Wielaard  <mark@klomp.org>
+
+       * readelf.c (attr_callback): Use dwarf_form_name for unknown forms.
+       (print_debug_macro_section): Print form using dwarf_form_name.
+
 2017-12-28  Mark Wielaard  <mark@klomp.org>
 
        * readelf.c (print_debug_units): Print DIE offset in error message
index ee9c7e1d7d67a98a33e9c930f23c0ee7fcb4ca3c..4bdaef204eec0e06cfbc924545faa5a703c4a4c2 100644 (file)
@@ -6306,9 +6306,9 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
     default:
       if (cbargs->silent)
        break;
-      printf ("           %*s%-20s (form: %#x) ???\n",
+      printf ("           %*s%-20s (%s) ???\n",
              (int) (level * 2), "", dwarf_attr_name (attr),
-             (int) form);
+             dwarf_form_name (form));
       break;
     }
 
@@ -7552,7 +7552,7 @@ print_debug_macro_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
                      if (readp + 1 > readendp)
                        goto invalid_data;
                      unsigned int form = *readp++;
-                     printf (" %s", dwarf_form_string (form));
+                     printf (" %s", dwarf_form_name (form));
                      if (form != DW_FORM_data1
                          && form != DW_FORM_data2
                          && form != DW_FORM_data4