aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-05-10 12:13:36 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-05-10 12:13:36 -0400
commit31aceaef1cba910c84b81c78064d226fd10d8976 (patch)
tree701268cd60ce80ba998856b978768a9928e0e9ae /gdb/nat
parent23182ac0d832477d316547ec2a758d22b43d0837 (diff)
downloadgdb-31aceaef1cba910c84b81c78064d226fd10d8976.zip
gdb-31aceaef1cba910c84b81c78064d226fd10d8976.tar.gz
gdb-31aceaef1cba910c84b81c78064d226fd10d8976.tar.bz2
gdb, gdbserver: make status_to_str display the signal name
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
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/linux-waitpid.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index f205df7..9948904 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -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));