mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-14 21:52:18 -06:00
gdbstub: Allow specifying a reason in stop packets
The upcoming syscall catchpoint support needs to send stop packets with an associated reason to GDB. Add an extra parameter to gdb_handlesig() for that, and rename it to gdb_handlesig_reason(). Provide a compatibility wrapper with an old name. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240202152506.279476-3-iii@linux.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240207163812.3231697-12-alex.bennee@linaro.org>
This commit is contained in:
parent
4aad096587
commit
8b7fcb8ed1
2 changed files with 18 additions and 3 deletions
|
@ -121,7 +121,7 @@ void gdb_qemu_exit(int code)
|
||||||
exit(code);
|
exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gdb_handlesig(CPUState *cpu, int sig)
|
int gdb_handlesig_reason(CPUState *cpu, int sig, const char *reason)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
int n;
|
int n;
|
||||||
|
@ -141,6 +141,9 @@ int gdb_handlesig(CPUState *cpu, int sig)
|
||||||
"T%02xthread:", gdb_target_signal_to_gdb(sig));
|
"T%02xthread:", gdb_target_signal_to_gdb(sig));
|
||||||
gdb_append_thread_id(cpu, gdbserver_state.str_buf);
|
gdb_append_thread_id(cpu, gdbserver_state.str_buf);
|
||||||
g_string_append_c(gdbserver_state.str_buf, ';');
|
g_string_append_c(gdbserver_state.str_buf, ';');
|
||||||
|
if (reason) {
|
||||||
|
g_string_append(gdbserver_state.str_buf, reason);
|
||||||
|
}
|
||||||
gdb_put_strbuf();
|
gdb_put_strbuf();
|
||||||
gdbserver_state.allow_stop_reply = false;
|
gdbserver_state.allow_stop_reply = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,10 @@
|
||||||
#define GDBSTUB_USER_H
|
#define GDBSTUB_USER_H
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdb_handlesig() - yield control to gdb
|
* gdb_handlesig_reason() - yield control to gdb
|
||||||
* @cpu: CPU
|
* @cpu: CPU
|
||||||
* @sig: if non-zero, the signal number which caused us to stop
|
* @sig: if non-zero, the signal number which caused us to stop
|
||||||
|
* @reason: stop reason for stop reply packet or NULL
|
||||||
*
|
*
|
||||||
* This function yields control to gdb, when a user-mode-only target
|
* This function yields control to gdb, when a user-mode-only target
|
||||||
* needs to stop execution. If @sig is non-zero, then we will send a
|
* needs to stop execution. If @sig is non-zero, then we will send a
|
||||||
|
@ -24,7 +25,18 @@
|
||||||
* or 0 if no signal should be delivered, ie the signal that caused
|
* or 0 if no signal should be delivered, ie the signal that caused
|
||||||
* us to stop should be ignored.
|
* us to stop should be ignored.
|
||||||
*/
|
*/
|
||||||
int gdb_handlesig(CPUState *, int);
|
int gdb_handlesig_reason(CPUState *, int, const char *);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdb_handlesig() - yield control to gdb
|
||||||
|
* @cpu CPU
|
||||||
|
* @sig: if non-zero, the signal number which caused us to stop
|
||||||
|
* @see gdb_handlesig_reason()
|
||||||
|
*/
|
||||||
|
static inline int gdb_handlesig(CPUState *cpu, int sig)
|
||||||
|
{
|
||||||
|
return gdb_handlesig_reason(cpu, sig, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdb_signalled() - inform remote gdb of sig exit
|
* gdb_signalled() - inform remote gdb of sig exit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue