]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Handle dwarf_attr_string returning NULL in show-die-info.c
authorMark Wielaard <mark@klomp.org>
Wed, 6 Oct 2021 21:53:34 +0000 (23:53 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 6 Oct 2021 21:53:34 +0000 (23:53 +0200)
Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Signed-off-by: Mark Wielaard <mark@klomp.org>
tests/ChangeLog
tests/show-die-info.c

index d289b27cf253b016f161380659feae357217486c..07e018b0fb58d5bb0ac606f018d5640abc4d8025 100644 (file)
@@ -1,3 +1,7 @@
+2021-10-06  Mark Wielaard  <mark@klomp.org>
+
+       * show-die-info.c (handle): Handle dwarf_attr_string returning NULL.
+
 2021-10-06  Di Chen <dichen@redhat.com>
 
        PR28242
index 34e27a3b339af154695763346d4bd32727b94aec..1a3191cd5eb73519e0c729f95e1a1b49161e772f 100644 (file)
@@ -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)