mirror of https://gitee.com/openkylin/qemu.git
Add GDB qAttached support
With this patch QEMU handles qAttached request from gdb. When QEMU replies 1, GDB sends a "detach" command at the end of a debugging session otherwise GDB sends "kill". The default value for qAttached is 1 on system emulation and 0 on user emulation. Based on original version by Fabien Chouteau. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
4dabe747af
commit
a3919386ea
10
gdbstub.c
10
gdbstub.c
|
@ -41,6 +41,12 @@
|
||||||
#include "qemu/sockets.h"
|
#include "qemu/sockets.h"
|
||||||
#include "sysemu/kvm.h"
|
#include "sysemu/kvm.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_USER_ONLY
|
||||||
|
#define GDB_ATTACHED "0"
|
||||||
|
#else
|
||||||
|
#define GDB_ATTACHED "1"
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||||
uint8_t *buf, int len, bool is_write)
|
uint8_t *buf, int len, bool is_write)
|
||||||
{
|
{
|
||||||
|
@ -1195,6 +1201,10 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
|
||||||
put_packet_binary(s, buf, len + 1);
|
put_packet_binary(s, buf, len + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (is_query_packet(p, "Attached", ':')) {
|
||||||
|
put_packet(s, GDB_ATTACHED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* Unrecognised 'q' command. */
|
/* Unrecognised 'q' command. */
|
||||||
goto unknown_command;
|
goto unknown_command;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue