gdbstub: Implement file io (F pkt) with new infra
Signed-off-by: Jon Doron <arilou@gmail.com> Message-Id: <20190529064148.19856-15-arilou@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
parent
397d137046
commit
4b20fab101
48
gdbstub.c
48
gdbstub.c
@ -1793,6 +1793,25 @@ static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx)
|
|||||||
put_packet(gdb_ctx->s, gdb_ctx->str_buf);
|
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)
|
static int gdb_handle_packet(GDBState *s, const char *line_buf)
|
||||||
{
|
{
|
||||||
CPUState *cpu;
|
CPUState *cpu;
|
||||||
@ -1934,28 +1953,13 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
|
|||||||
return RS_IDLE;
|
return RS_IDLE;
|
||||||
case 'F':
|
case 'F':
|
||||||
{
|
{
|
||||||
target_ulong ret;
|
static const GdbCmdParseEntry file_io_cmd_desc = {
|
||||||
target_ulong err;
|
.handler = handle_file_io,
|
||||||
|
.cmd = "F",
|
||||||
ret = strtoull(p, (char **)&p, 16);
|
.cmd_startswith = 1,
|
||||||
if (*p == ',') {
|
.schema = "L,L,o0"
|
||||||
p++;
|
};
|
||||||
err = strtoull(p, (char **)&p, 16);
|
cmd_parser = &file_io_cmd_desc;
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
|
Loading…
Reference in New Issue
Block a user