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>
+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
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;
}
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