gdbstub: Add a missing case of signal number translation in gdbstub
authorMartin Simmons <martin@lispworks.com>
Wed, 5 Nov 2014 14:47:39 +0000 (14:47 +0000)
committerMichael Tokarev <mjt@tls.msk.ru>
Tue, 11 Nov 2014 05:58:30 +0000 (08:58 +0300)
While using qemu with gdb "target remote" to debug an application that uses
fork and exec, the qemu process receives SIGSTOP every time the forked process
terminates (sending SIGCHLD).

This is caused by a missing call to gdb_signal_to_target in gdbstub.c, which
is fixed by this patch:

Signed-off-by: Martin Simmons <martin@lispworks.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
gdbstub.c

index d1b5afd8fed47ce5b6680889fbffbf8d85066c1f..0faca568d91657c0d451a74731375dffe296d026 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -823,7 +823,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
                 action = *p++;
                 signal = 0;
                 if (action == 'C' || action == 'S') {
-                    signal = strtoul(p, (char **)&p, 16);
+                    signal = gdb_signal_to_target(strtoul(p, (char **)&p, 16));
+                    if (signal == -1) {
+                        signal = 0;
+                    }
                 } else if (action != 'c' && action != 's') {
                     res = 0;
                     break;