This is the mail archive of the
mailing list for the elfutils project.
[PATCH] readelf: Print DW_AT_data_member_location as decimal offset, not hex number.
- From: Mark Wielaard <mark at klomp dot org>
- To: elfutils-devel at sourceware dot org
- Cc: Mark Wielaard <mark at klomp dot org>
- Date: Wed, 3 Apr 2019 16:54:15 +0200
- Subject: [PATCH] readelf: Print DW_AT_data_member_location as decimal offset, not hex number.
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 <firstname.lastname@example.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
@@ -1,3 +1,8 @@
+2019-04-03 Mark Wielaard <email@example.com>
+ * readelf.c (attr_callback): Print DW_AT_data_member_location as
+ decimal offset, not hex number.
2019-03-29 Mark Wielaard <firstname.lastname@example.org>
* readelf.c (print_debug_macinfo_section): Check cus is not the
diff --git a/src/readelf.c b/src/readelf.c
index 5654fd1..c346e1f 100644
@@ -7092,7 +7092,7 @@ attr_callback (Dwarf_Attribute *attrp, void *arg)
|| (form != DW_FORM_data4 && form != DW_FORM_data8)))
- 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);