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

Dmitry V. Levin <ldv at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ldv at sourceware dot org

--- Comment #10 from Dmitry V. Levin <ldv at sourceware dot org> ---
I'd suggest the following change to enhance error diagnostics:

diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index 35f25ed6..3a22db31 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -143,9 +143,8 @@ main (int argc __attribute__ ((unused)), char **argv)
     case -1:
       abort ();
     case 0:;
-      long l = ptrace (PTRACE_TRACEME, 0, NULL, NULL);
-      assert (errno == 0);
-      assert (l == 0);
+      if (ptrace (PTRACE_TRACEME, 0, NULL, NULL))
+        _exit(errno ?: -1);
       cleanup_13_main ();
       abort ();
     default:
@@ -155,10 +154,12 @@ main (int argc __attribute__ ((unused)), char **argv)
   errno = 0;
   int status;
   pid_t got = waitpid (pid, &status, 0);
-  assert (errno == 0);
-  assert (got == pid);
-  assert (WIFSTOPPED (status));
-  assert (WSTOPSIG (status) == SIGABRT);
+  if (got != pid)
+    error (1, errno, "waitpid returned %d", got);
+  if (!WIFSTOPPED (status))
+    error (1, 0, "unexpected wait status %u", status);
+  if (WSTOPSIG (status) != SIGABRT)
+    error (1, 0, "unexpected signal %u", WSTOPSIG (status));

   Dwfl *dwfl = pid_to_dwfl (pid);
   dwfl_getthreads (dwfl, thread_callback, NULL);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to