From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [COMMITTED] readelf: Use dwarf_form_name for printing (unknown) forms.
Date: Mon, 01 Jan 2018 21:44:00 -0000 [thread overview]
Message-ID: <20180101214428.32001-1-mark@klomp.org> (raw)
A quick first commit of the year to make (error) output more consistent
in readelf:
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 | 5 +++++
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 <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
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
--
2.14.3
reply other threads:[~2018-01-01 21:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180101214428.32001-1-mark@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).