diff options
author | Mark Wielaard <[email protected]> | 2018-01-01 22:39:24 +0100 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2018-01-01 22:42:05 +0100 |
commit | 68cd423edbba61af902eed2abe85578f1c134a25 (patch) | |
tree | cb617cc51f9d33302d52df7b9e0bb6da885a0cbd | |
parent | 699a741b488010d56cc358a5f7b4d8a8f4886347 (diff) |
readelf: Use dwarf_form_name for printing (unknown) forms.
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 <[email protected]>
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/readelf.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9d6ec830..49b0cc03 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2018-01-01 Mark Wielaard <[email protected]> + + * 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 <[email protected]> * readelf.c (print_debug_units): Print DIE offset in error message diff --git a/src/readelf.c b/src/readelf.c index ee9c7e1d..4bdaef20 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -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 |