[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 50/52] gdbstub: Implement target halted (? pkt) with
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 50/52] gdbstub: Implement target halted (? pkt) with new infra |
Date: |
Fri, 7 Jun 2019 10:05:49 +0100 |
From: Jon Doron <address@hidden>
Note: The user-mode thread-id has been correctly reported since bd88c780e6
Signed-off-by: Jon Doron <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
diff --git a/gdbstub.c b/gdbstub.c
index c45cefd721..26c0c30682 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2265,13 +2265,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);
@@ -2283,15 +2299,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.20.1
- [Qemu-devel] [PULL 26/52] semihosting: split console_out into string and char versions, (continued)
- [Qemu-devel] [PULL 26/52] semihosting: split console_out into string and char versions, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 45/52] gdbstub: Implement read all registers (g pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 29/52] tests/tcg: clean-up VPATH/TESTS for i386, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 40/52] gdbstub: Implement set register (P pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 18/52] tests/vm: add vm-boot-{ssh, serial}-<guest> targets, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 43/52] gdbstub: Implement read memory (m pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 13/52] tests/vm: python3 fixes, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 25/52] tests/vm: ubuntu.i386: apt proxy setup, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 27/52] cputlb: use uint64_t for interim values for unaligned load, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 44/52] gdbstub: Implement write all registers (G pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 50/52] gdbstub: Implement target halted (? pkt) with new infra,
Alex Bennée <=
- [Qemu-devel] [PULL 28/52] tests/tcg: better detect truncated reads, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 46/52] gdbstub: Implement file io (F pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 33/52] gdbstub: Add infrastructure to parse cmd packets, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 47/52] gdbstub: Implement step (s pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 41/52] gdbstub: Implement get register (p pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 35/52] gdbstub: Implement thread_alive (T pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 37/52] gdbstub: Implement continue with signal (C pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 16/52] tests/vm: run test builds on snapshot, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 34/52] gdbstub: Implement deatch (D pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 21/52] tests/vm: openbsd autoinstall, using serial console, Alex Bennée, 2019/06/07