summary refs log tree commit diff stats
path: root/bsd-user
diff options
context:
space:
mode:
authorGustavo Romero <gustavo.romero@linaro.org>2024-03-09 03:08:59 +0000
committerAlex Bennée <alex.bennee@linaro.org>2024-03-13 11:43:52 +0000
commitf84e313e0278222eb88b9ca29311f0df71abd001 (patch)
treef6f7fca9201712d62bb6615280430f47484a8877 /bsd-user
parent4d6d8a05a0a6d102ca94e59a43804d65309921e3 (diff)
downloadfocaccia-qemu-f84e313e0278222eb88b9ca29311f0df71abd001.tar.gz
focaccia-qemu-f84e313e0278222eb88b9ca29311f0df71abd001.zip
gdbstub: Save target's siginfo
Save target's siginfo into gdbserver_state so it can be used later, for
example, in any stub that requires the target's si_signo and si_code.

This change affects only linux-user mode.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240309030901.1726211-4-gustavo.romero@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'bsd-user')
-rw-r--r--bsd-user/main.c2
-rw-r--r--bsd-user/signal.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 3dc285e5b7..01b313756e 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -606,7 +606,7 @@ int main(int argc, char **argv)
 
     if (gdbstub) {
         gdbserver_start(gdbstub);
-        gdb_handlesig(cpu, 0);
+        gdb_handlesig(cpu, 0, NULL, NULL, 0);
     }
     cpu_loop(env);
     /* never exits */
diff --git a/bsd-user/signal.c b/bsd-user/signal.c
index 3ac50c2d71..e5a773ddde 100644
--- a/bsd-user/signal.c
+++ b/bsd-user/signal.c
@@ -27,6 +27,9 @@
 #include "hw/core/tcg-cpu-ops.h"
 #include "host-signal.h"
 
+/* target_siginfo_t must fit in gdbstub's siginfo save area. */
+QEMU_BUILD_BUG_ON(sizeof(target_siginfo_t) > MAX_SIGINFO_LENGTH);
+
 static struct target_sigaction sigact_table[TARGET_NSIG];
 static void host_signal_handler(int host_sig, siginfo_t *info, void *puc);
 static void target_to_host_sigset_internal(sigset_t *d,
@@ -889,7 +892,7 @@ static void handle_pending_signal(CPUArchState *env, int sig,
 
     k->pending = 0;
 
-    sig = gdb_handlesig(cpu, sig);
+    sig = gdb_handlesig(cpu, sig, NULL, &k->info, sizeof(k->info));
     if (!sig) {
         sa = NULL;
         handler = TARGET_SIG_IGN;