[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 43/52] gdbstub: Implement read memory (m pkt) with ne
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 43/52] gdbstub: Implement read memory (m pkt) with new infra |
Date: |
Fri, 7 Jun 2019 10:05:42 +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 681a0c8550..ceaa47d184 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1727,6 +1727,30 @@ static void handle_write_mem(GdbCmdContext *gdb_ctx,
void *user_ctx)
put_packet(gdb_ctx->s, "OK");
}
+static void handle_read_mem(GdbCmdContext *gdb_ctx, void *user_ctx)
+{
+ if (gdb_ctx->num_params != 2) {
+ put_packet(gdb_ctx->s, "E22");
+ return;
+ }
+
+ /* memtohex() doubles the required space */
+ if (gdb_ctx->params[1].val_ull > MAX_PACKET_LENGTH / 2) {
+ put_packet(gdb_ctx->s, "E22");
+ return;
+ }
+
+ if (target_memory_rw_debug(gdb_ctx->s->g_cpu, gdb_ctx->params[0].val_ull,
+ gdb_ctx->mem_buf,
+ gdb_ctx->params[1].val_ull, false)) {
+ put_packet(gdb_ctx->s, "E14");
+ return;
+ }
+
+ memtohex(gdb_ctx->str_buf, gdb_ctx->mem_buf, gdb_ctx->params[1].val_ull);
+ put_packet(gdb_ctx->s, gdb_ctx->str_buf);
+}
+
static int gdb_handle_packet(GDBState *s, const char *line_buf)
{
CPUState *cpu;
@@ -1916,22 +1940,14 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
put_packet(s, "OK");
break;
case 'm':
- addr = strtoull(p, (char **)&p, 16);
- if (*p == ',')
- p++;
- len = strtoull(p, NULL, 16);
-
- /* memtohex() doubles the required space */
- if (len > MAX_PACKET_LENGTH / 2) {
- put_packet (s, "E22");
- break;
- }
-
- if (target_memory_rw_debug(s->g_cpu, addr, mem_buf, len, false) != 0) {
- put_packet (s, "E14");
- } else {
- memtohex(buf, mem_buf, len);
- put_packet(s, buf);
+ {
+ static const GdbCmdParseEntry read_mem_cmd_desc = {
+ .handler = handle_read_mem,
+ .cmd = "m",
+ .cmd_startswith = 1,
+ .schema = "L,L0"
+ };
+ cmd_parser = &read_mem_cmd_desc;
}
break;
case 'M':
--
2.20.1
- [Qemu-devel] [PULL 20/52] tests/vm: serial console support helpers, (continued)
- [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, 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 <=
- [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
- [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