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>
This commit is contained in:
Pavel Labath
2021-10-26 11:22:34 +01:00
committed by Alex Bennée
parent 8ef3fdf952
commit 4a82be77de
3 changed files with 75 additions and 3 deletions

View File

@@ -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. */