public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] tests: skip '(null)' symname frames in backtrace tests
@ 2023-03-04 21:35 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2023-03-04 21:35 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

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 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/backtrace.c b/tests/backtrace.c
index afc12fb9..55555301 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -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)
-- 
2.31.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-04 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-04 21:35 [PATCH] tests: skip '(null)' symname frames in backtrace tests Mark Wielaard

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).