The data_member_location attribute was printed as a hex number, but other constant attributes like bit_offset, byte_size or alignment were printed as decimal numbers. This is confusing.
The reason that data_member_location was printed as hex seemed to have been because it could also have been a location description, in which case it might have been of DW_FORM_loclist, for which it makes sense to print as hex offset (between square brackets). Signed-off-by: Mark Wielaard <m...@klomp.org> --- src/ChangeLog | 5 +++++ src/readelf.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 99ca1b7..57db6ca 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2019-04-03 Mark Wielaard <m...@klomp.org> + + * readelf.c (attr_callback): Print DW_AT_data_member_location as + decimal offset, not hex number. + 2019-03-29 Mark Wielaard <m...@klomp.org> * readelf.c (print_debug_macinfo_section): Check cus[0] is not the diff --git a/src/readelf.c b/src/readelf.c index 5654fd1..c346e1f 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -7092,7 +7092,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg) || (form != DW_FORM_data4 && form != DW_FORM_data8))) { if (!cbargs->silent) - printf (" %*s%-20s (%s) %" PRIxMAX "\n", + printf (" %*s%-20s (%s) %" PRIuMAX "\n", (int) (level * 2), "", dwarf_attr_name (attr), dwarf_form_name (form), (uintmax_t) num); return DWARF_CB_OK; -- 1.8.3.1