]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: skip '(null)' symname frames in backtrace tests
authorMark Wielaard <mark@klomp.org>
Sat, 4 Mar 2023 20:55:56 +0000 (21:55 +0100)
committerMark Wielaard <mark@klomp.org>
Sun, 5 Mar 2023 12:15:53 +0000 (13:15 +0100)
Some setups might have some frames for unknown (null) functions
in the thread backtrace. Skip these frames instead of failing
immediately.

    * tests/backtrace.c (callback_verify): Check and skip nulls_seen.

https://sourceware.org/bugzilla/show_bug.cgi?id=29176

Signed-off-by: Mark Wielaard <mark@klomp.org>
tests/backtrace.c

index afc12fb939a1c24e876b731b4937656eecdb4107..555553012ff9322b701b03c7d2421612658e116a 100644 (file)
@@ -90,6 +90,14 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
       return;
     }
   Dwfl_Module *mod;
+  /* Skip frames for which there isn't a function name.  */
+  static int nulls_seen = 0;
+  if (symname == NULL)
+    {
+      nulls_seen++;
+      return;
+    }
+  frameno -= nulls_seen;
   /* See case 4. Special case to help out simple frame pointer unwinders. */
   static bool duplicate_sigusr2 = false;
   if (duplicate_sigusr2)