[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v11 18/20] gdbstub: Implement target halted (? pkt)
From: |
Jon Doron |
Subject: |
[Qemu-devel] [PATCH v11 18/20] gdbstub: Implement target halted (? pkt) with new infra |
Date: |
Fri, 24 May 2019 19:01:16 +0300 |
Note: The user-mode thread-id has been correctly reported since bd88c780e6
Signed-off-by: Jon Doron <address@hidden>
---
gdbstub.c | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index 57a05fd6a4..097b7d1231 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2251,13 +2251,29 @@ static void handle_gen_set(GdbCmdContext *gdb_ctx, void
*user_ctx)
}
}
+static void handle_target_halt(GdbCmdContext *gdb_ctx, void *user_ctx)
+{
+ char thread_id[16];
+
+ gdb_fmt_thread_id(gdb_ctx->s, gdb_ctx->s->c_cpu, thread_id,
+ sizeof(thread_id));
+ snprintf(gdb_ctx->str_buf, sizeof(gdb_ctx->str_buf), "T%02xthread:%s;",
+ GDB_SIGNAL_TRAP, thread_id);
+ put_packet(gdb_ctx->s, gdb_ctx->str_buf);
+ /*
+ * Remove all the breakpoints when this query is issued,
+ * because gdb is doing an initial connect and the state
+ * should be cleaned up.
+ */
+ gdb_breakpoint_remove_all();
+}
+
static int gdb_handle_packet(GDBState *s, const char *line_buf)
{
const char *p;
int ch;
uint8_t mem_buf[MAX_PACKET_LENGTH];
char buf[sizeof(mem_buf) + 1 /* trailing NUL */];
- char thread_id[16];
const GdbCmdParseEntry *cmd_parser = NULL;
trace_gdbstub_io_command(line_buf);
@@ -2269,15 +2285,14 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
put_packet(s, "OK");
break;
case '?':
- /* TODO: Make this return the correct value for user-mode. */
- snprintf(buf, sizeof(buf), "T%02xthread:%s;", GDB_SIGNAL_TRAP,
- gdb_fmt_thread_id(s, s->c_cpu, thread_id, sizeof(thread_id)));
- put_packet(s, buf);
- /* Remove all the breakpoints when this query is issued,
- * because gdb is doing and initial connect and the state
- * should be cleaned up.
- */
- gdb_breakpoint_remove_all();
+ {
+ static const GdbCmdParseEntry target_halted_cmd_desc = {
+ .handler = handle_target_halt,
+ .cmd = "?",
+ .cmd_startswith = 1
+ };
+ cmd_parser = &target_halted_cmd_desc;
+ }
break;
case 'c':
{
--
2.21.0
- [Qemu-devel] [PATCH v11 08/20] gdbstub: Implement set register (P pkt) with new infra, (continued)
- [Qemu-devel] [PATCH v11 08/20] gdbstub: Implement set register (P pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 07/20] gdbstub: Implement breakpoint commands (Z/z pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 01/20] gdbstub: Add infrastructure to parse cmd packets, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 09/20] gdbstub: Implement get register (p pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 11/20] gdbstub: Implement read memory (m pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 12/20] gdbstub: Implement write all registers (G pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 13/20] gdbstub: Implement read all registers (g pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 10/20] gdbstub: Implement write memory (M pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 19/20] gdbstub: Clear unused variables in gdb_handle_packet, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 16/20] gdbstub: Implement v commands with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 18/20] gdbstub: Implement target halted (? pkt) with new infra,
Jon Doron <=
- [Qemu-devel] [PATCH v11 15/20] gdbstub: Implement step (s pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 14/20] gdbstub: Implement file io (F pkt) with new infra, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 20/20] gdbstub: Implement qemu physical memory mode, Jon Doron, 2019/05/24
- [Qemu-devel] [PATCH v11 17/20] gdbstub: Implement generic set/query (Q/q pkt) with new infra, Jon Doron, 2019/05/24