summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2021-10-06 23:53:34 +0200
committerMark Wielaard <[email protected]>2021-10-06 23:53:34 +0200
commit47b0ebe9033daa7ac9c732b25c85520b97f9635a (patch)
treed5a7c333645cffa61590478a7034d39a41d6131e /tests
parent3d9f12883d0c131bd4ab6045e1f60d3fe6d150ea (diff)
tests: Handle dwarf_attr_string returning NULL in show-die-info.c
Reported-by: Jan-Benedict Glaw <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog4
-rw-r--r--tests/show-die-info.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index d289b27c..07e018b0 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2021-10-06 Mark Wielaard <[email protected]>
+
+ * show-die-info.c (handle): Handle dwarf_attr_string returning NULL.
+
2021-10-06 Di Chen <[email protected]>
PR28242
diff --git a/tests/show-die-info.c b/tests/show-die-info.c
index 34e27a3b..1a3191cd 100644
--- a/tests/show-die-info.c
+++ b/tests/show-die-info.c
@@ -97,7 +97,7 @@ handle (Dwarf *dbg, Dwarf_Die *die, int n)
printf ("%*s Attrs :", n * 5, "");
for (cnt = 0; cnt < 0xffff; ++cnt)
if (dwarf_hasattr (die, cnt))
- printf (" %s", dwarf_attr_string (cnt));
+ printf (" %s", dwarf_attr_string (cnt) ?: "<unknown>");
puts ("");
if (dwarf_hasattr (die, DW_AT_low_pc) && dwarf_lowpc (die, &addr) == 0)