[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 45/52] gdbstub: Implement read all registers (g pkt)
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 45/52] gdbstub: Implement read all registers (g pkt) with new infra |
Date: |
Fri, 7 Jun 2019 10:05:44 +0100 |
From: Jon Doron <address@hidden>
Signed-off-by: Jon Doron <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
diff --git a/gdbstub.c b/gdbstub.c
index 880bbb469a..b3c5ced80d 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1774,6 +1774,21 @@ static void handle_write_all_regs(GdbCmdContext
*gdb_ctx, void *user_ctx)
put_packet(gdb_ctx->s, "OK");
}
+static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx)
+{
+ target_ulong addr, len;
+
+ cpu_synchronize_state(gdb_ctx->s->g_cpu);
+ len = 0;
+ for (addr = 0; addr < gdb_ctx->s->g_cpu->gdb_num_g_regs; addr++) {
+ len += gdb_read_register(gdb_ctx->s->g_cpu, gdb_ctx->mem_buf + len,
+ addr);
+ }
+
+ memtohex(gdb_ctx->str_buf, gdb_ctx->mem_buf, len);
+ put_packet(gdb_ctx->s, gdb_ctx->str_buf);
+}
+
static int gdb_handle_packet(GDBState *s, const char *line_buf)
{
CPUState *cpu;
@@ -1781,7 +1796,7 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
CPUClass *cc;
const char *p;
uint32_t pid, tid;
- int ch, reg_size, type, res;
+ int ch, type, res;
uint8_t mem_buf[MAX_PACKET_LENGTH];
char buf[sizeof(mem_buf) + 1 /* trailing NUL */];
char thread_id[16];
@@ -1940,14 +1955,14 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
}
break;
case 'g':
- cpu_synchronize_state(s->g_cpu);
- len = 0;
- for (addr = 0; addr < s->g_cpu->gdb_num_g_regs; addr++) {
- reg_size = gdb_read_register(s->g_cpu, mem_buf + len, addr);
- len += reg_size;
+ {
+ static const GdbCmdParseEntry read_all_regs_cmd_desc = {
+ .handler = handle_read_all_regs,
+ .cmd = "g",
+ .cmd_startswith = 1
+ };
+ cmd_parser = &read_all_regs_cmd_desc;
}
- memtohex(buf, mem_buf, len);
- put_packet(s, buf);
break;
case 'G':
{
--
2.20.1
- [Qemu-devel] [PULL 11/52] tests/vm: Add missing variables on help, (continued)
- [Qemu-devel] [PULL 11/52] tests/vm: Add missing variables on help, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 17/52] tests/vm: proper guest shutdown, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 42/52] gdbstub: Implement write memory (M pkt) with new infra, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 51/52] gdbstub: Clear unused variables in gdb_handle_packet, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 20/52] tests/vm: serial console support helpers, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 32/52] cputlb: cast size_t to target_ulong before using for address masks, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 15/52] tests/vm: use ssh with pty unconditionally, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 30/52] tests/tcg/x86_64: add a PVH crt.o for x86_64 system tests, Alex Bennée, 2019/06/07
- [Qemu-devel] [PULL 23/52] tests/vm: netbsd autoinstall, using serial console, Alex Bennée, 2019/06/07
- [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 <=
- [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, 2019/06/07
- [Qemu-devel] [PULL 28/52] tests/tcg: better detect truncated reads, Alex Bennée, 2019/06/07