[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 13/20] gdbstub: Implement write all registers (G
From: |
arilou |
Subject: |
[Qemu-devel] [PATCH v3 13/20] gdbstub: Implement write all registers (G pkt) with new infra |
Date: |
Wed, 24 Apr 2019 17:27:07 +0300 |
From: Jon Doron <address@hidden>
Signed-off-by: Jon Doron <address@hidden>
---
gdbstub.c | 41 +++++++++++++++++++++++++++++++----------
1 file changed, 31 insertions(+), 10 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index deeb78c341..0523deaef2 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1750,6 +1750,29 @@ static void handle_read_mem(GdbCmdContext *gdb_ctx, void
*user_ctx)
put_packet(gdb_ctx->s, gdb_ctx->str_buf);
}
+static void handle_write_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx)
+{
+ target_ulong addr, len;
+ uint8_t *registers;
+ int reg_size;
+
+ if (!gdb_ctx->num_params) {
+ return;
+ }
+
+ cpu_synchronize_state(gdb_ctx->s->g_cpu);
+ registers = gdb_ctx->mem_buf;
+ len = strlen(gdb_ctx->params[0].data) / 2;
+ hextomem(registers, gdb_ctx->params[0].data, len);
+ for (addr = 0; addr < gdb_ctx->s->g_cpu->gdb_num_g_regs && len > 0;
+ addr++) {
+ reg_size = gdb_write_register(gdb_ctx->s->g_cpu, registers, addr);
+ len -= reg_size;
+ registers += reg_size;
+ }
+ put_packet(gdb_ctx->s, "OK");
+}
+
static int gdb_handle_packet(GDBState *s, const char *line_buf)
{
CPUState *cpu;
@@ -1761,7 +1784,6 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
uint8_t mem_buf[MAX_PACKET_LENGTH];
char buf[sizeof(mem_buf) + 1 /* trailing NUL */];
char thread_id[16];
- uint8_t *registers;
target_ulong addr, len;
trace_gdbstub_io_command(line_buf);
@@ -1926,16 +1948,15 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
put_packet(s, buf);
break;
case 'G':
- cpu_synchronize_state(s->g_cpu);
- registers = mem_buf;
- len = strlen(p) / 2;
- hextomem((uint8_t *)registers, p, len);
- for (addr = 0; addr < s->g_cpu->gdb_num_g_regs && len > 0; addr++) {
- reg_size = gdb_write_register(s->g_cpu, registers, addr);
- len -= reg_size;
- registers += reg_size;
+ {
+ static GdbCmdParseEntry write_all_regs_cmd_desc = {
+ .handler = handle_write_all_regs,
+ .cmd = "G",
+ .cmd_startswith = 1,
+ .schema = "s0"
+ };
+ process_string_cmd(s, NULL, line_buf, &write_all_regs_cmd_desc, 1);
}
- put_packet(s, "OK");
break;
case 'm':
{
--
2.20.1
- Re: [Qemu-devel] [PATCH v3 20/20] gdbstub: Refactor parse handle packet to work with a static array, (continued)
- [Qemu-devel] [PATCH v3 15/20] gdbstub: Implement file io (F pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 10/20] gdbstub: Implement get register (p pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 07/20] gdbstub: Implement insert breakpoint (Z pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 06/20] gdbstub: Implement set_thread (H pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 05/20] gdbstub: Implement continue with signal (C pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 08/20] gdbstub: Implement remove breakpoint (z pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 02/20] gdbstub: Implement deatch (D pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 13/20] gdbstub: Implement write all registers (G pkt) with new infra,
arilou <=
- [Qemu-devel] [PATCH v3 12/20] gdbstub: Implement read memory (m pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 11/20] gdbstub: Implement write memory (M pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 09/20] gdbstub: Implement set register (P pkt) with new infra, arilou, 2019/04/24
- [Qemu-devel] [PATCH v3 04/20] gdbstub: Implement continue (c pkt) with new infra, arilou, 2019/04/24
- Re: [Qemu-devel] [PATCH v3 01/20] gdbstub: Add infrastructure to parse cmd packets, Richard Henderson, 2019/04/24
- Re: [Qemu-devel] [PATCH v3 01/20] gdbstub: Add infrastructure to parse cmd packets, Alex Bennée, 2019/04/25
- Re: [Qemu-devel] [PATCH v3 01/20] gdbstub: Add infrastructure to parse cmd packets, Alex Bennée, 2019/04/25