[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v12 14/20] gdbstub: Implement file io (F pkt) with n
From: |
Jon Doron |
Subject: |
[Qemu-devel] [PATCH v12 14/20] gdbstub: Implement file io (F pkt) with new infra |
Date: |
Wed, 29 May 2019 09:41:42 +0300 |
Signed-off-by: Jon Doron <address@hidden>
---
gdbstub.c | 48 ++++++++++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 22 deletions(-)
diff --git a/gdbstub.c b/gdbstub.c
index 8a401e6527..ea85966b27 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1789,6 +1789,25 @@ static void handle_read_all_regs(GdbCmdContext *gdb_ctx,
void *user_ctx)
put_packet(gdb_ctx->s, gdb_ctx->str_buf);
}
+static void handle_file_io(GdbCmdContext *gdb_ctx, void *user_ctx)
+{
+ if (gdb_ctx->num_params >= 2 && gdb_ctx->s->current_syscall_cb) {
+ target_ulong ret, err;
+
+ ret = (target_ulong)gdb_ctx->params[0].val_ull;
+ err = (target_ulong)gdb_ctx->params[1].val_ull;
+ gdb_ctx->s->current_syscall_cb(gdb_ctx->s->c_cpu, ret, err);
+ gdb_ctx->s->current_syscall_cb = NULL;
+ }
+
+ if (gdb_ctx->num_params >= 3 && gdb_ctx->params[2].opcode == (uint8_t)'C')
{
+ put_packet(gdb_ctx->s, "T02");
+ return;
+ }
+
+ gdb_continue(gdb_ctx->s);
+}
+
static int gdb_handle_packet(GDBState *s, const char *line_buf)
{
CPUState *cpu;
@@ -1930,28 +1949,13 @@ static int gdb_handle_packet(GDBState *s, const char
*line_buf)
return RS_IDLE;
case 'F':
{
- target_ulong ret;
- target_ulong err;
-
- ret = strtoull(p, (char **)&p, 16);
- if (*p == ',') {
- p++;
- err = strtoull(p, (char **)&p, 16);
- } else {
- err = 0;
- }
- if (*p == ',')
- p++;
- type = *p;
- if (s->current_syscall_cb) {
- s->current_syscall_cb(s->c_cpu, ret, err);
- s->current_syscall_cb = NULL;
- }
- if (type == 'C') {
- put_packet(s, "T02");
- } else {
- gdb_continue(s);
- }
+ static const GdbCmdParseEntry file_io_cmd_desc = {
+ .handler = handle_file_io,
+ .cmd = "F",
+ .cmd_startswith = 1,
+ .schema = "L,L,o0"
+ };
+ cmd_parser = &file_io_cmd_desc;
}
break;
case 'g':
--
2.21.0
- [Qemu-devel] [PATCH v12 07/20] gdbstub: Implement breakpoint commands (Z/z pkt) with new infra, (continued)
- [Qemu-devel] [PATCH v12 07/20] gdbstub: Implement breakpoint commands (Z/z pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 04/20] gdbstub: Implement continue (c pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 06/20] gdbstub: Implement set_thread (H pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 08/20] gdbstub: Implement set register (P pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 09/20] gdbstub: Implement get register (p pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 10/20] gdbstub: Implement write memory (M pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 13/20] gdbstub: Implement read all registers (g pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 14/20] gdbstub: Implement file io (F pkt) with new infra,
Jon Doron <=
- [Qemu-devel] [PATCH v12 11/20] gdbstub: Implement read memory (m pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 12/20] gdbstub: Implement write all registers (G pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 16/20] gdbstub: Implement v commands with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 19/20] gdbstub: Clear unused variables in gdb_handle_packet, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 18/20] gdbstub: Implement target halted (? pkt) with new infra, Jon Doron, 2019/05/29
- [Qemu-devel] [PATCH v12 17/20] gdbstub: Implement generic set/query (Q/q pkt) with new infra, Jon Doron, 2019/05/29