gdb, gdbserver: make status_to_str display the signal name
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 10 May 2021 16:13:36 +0000 (12:13 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 10 May 2021 16:13:36 +0000 (12:13 -0400)
I was looking at some "set debug lin-lwp" logs, and saw that a thread
received the "Child exited" signal.  It took me a moment to realize that
this was SIGCHLD.  I then thought that it would be nice for
status_to_str to show the signal name (SIGCHLD) in addition to the
description "Child exited", since people are much more used to referring
to signals using their names.

Fortunately, libiberty contains a handy function to get the signal name
from the signal number, strsigno, use that.

The output of "set debug lin-lwp" now looks like:

    [linux-nat] linux_nat_wait_1: waitpid 1209631 received SIGTRAP - Trace/breakpoint trap (stopped)

gdb/ChangeLog:

* nat/linux-waitpid.c (status_to_str): Show signal name.

Change-Id: I8ad9b1e744dd64461fd87b08d5c29f9ef97c4691

gdb/ChangeLog
gdb/nat/linux-waitpid.c

index 8fa698023410cadca17918aa3b8fc7297946559a..52d5faac8a9db8fe66cd64cf533a32260a7a4b48 100644 (file)
@@ -1,3 +1,7 @@
+2021-05-10  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * nat/linux-waitpid.c (status_to_str): Show signal name.
+
 2021-05-09  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * python/py-breakpoint.c (pybp_debug): New static global.
index f205df7a2464e0552d082449a8b2a3b6dc9f5194..99489040fb0226ca0c3bf5fb1daa698d75ba72b2 100644 (file)
@@ -32,14 +32,16 @@ status_to_str (int status)
   if (WIFSTOPPED (status))
     {
       if (WSTOPSIG (status) == SYSCALL_SIGTRAP)
-       return string_printf ("%s (stopped at syscall)",
-                             strsignal (SIGTRAP));
+       return string_printf ("%s - %s (stopped at syscall)",
+                             strsigno (SIGTRAP), strsignal (SIGTRAP));
       else
-       return string_printf ("%s (stopped)",
+       return string_printf ("%s - %s (stopped)",
+                             strsigno (WSTOPSIG (status)),
                              strsignal (WSTOPSIG (status)));
     }
   else if (WIFSIGNALED (status))
-    return string_printf ("%s (terminated)",
+    return string_printf ("%s - %s (terminated)",
+                         strsigno (WTERMSIG (status)),
                          strsignal (WTERMSIG (status)));
   else
     return string_printf ("%d (exited)", WEXITSTATUS (status));
This page took 0.027175 seconds and 4 git commands to generate.