aboutsummaryrefslogtreecommitdiff
path: root/gdbstub.c
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2021-10-26 11:22:34 +0100
committerAlex Bennée <alex.bennee@linaro.org>2021-11-04 10:32:01 +0000
commit4a82be77de9dcfe37c3a8257953737f2b3c9b9d7 (patch)
treee67ef144901bacbb278b277bbc40d2e7f2e901a4 /gdbstub.c
parent8ef3fdf952f061df6a9b30008bd8de9dfaa32435 (diff)
downloadqemu-4a82be77de9dcfe37c3a8257953737f2b3c9b9d7.zip
qemu-4a82be77de9dcfe37c3a8257953737f2b3c9b9d7.tar.gz
qemu-4a82be77de9dcfe37c3a8257953737f2b3c9b9d7.tar.bz2
gdbstub: Switch to the thread receiving a signal
Respond with Txxthread:yyyy; instead of a plain Sxx to indicate which thread received the signal. Otherwise, the debugger will associate it with the main one. Also automatically select this thread, as that is what gdb expects. Signed-off-by: Pavel Labath <pavel@labath.sk> Message-Id: <20211019174953.36560-1-pavel@labath.sk> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20211026102234.3961636-29-alex.bennee@linaro.org>
Diffstat (limited to 'gdbstub.c')
-rw-r--r--gdbstub.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 36b85aa..23baaef 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -3138,8 +3138,12 @@ gdb_handlesig(CPUState *cpu, int sig)
tb_flush(cpu);
if (sig != 0) {
- snprintf(buf, sizeof(buf), "S%02x", target_signal_to_gdb(sig));
- put_packet(buf);
+ gdb_set_stop_cpu(cpu);
+ g_string_printf(gdbserver_state.str_buf,
+ "T%02xthread:", target_signal_to_gdb(sig));
+ gdb_append_thread_id(cpu, gdbserver_state.str_buf);
+ g_string_append_c(gdbserver_state.str_buf, ';');
+ put_strbuf();
}
/* put_packet() might have detected that the peer terminated the
connection. */