Skip to content

Commit

Permalink
gdbstub: Implement continue with signal (C pkt) with new infra
Browse files Browse the repository at this point in the history
Signed-off-by: Jon Doron <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
  • Loading branch information
arilou authored and stsquad committed Jun 12, 2019
1 parent 4d6e3fe commit ccc47d5
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions gdbstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,25 @@ static void handle_continue(GdbCmdContext *gdb_ctx, void *user_ctx)
gdb_continue(gdb_ctx->s);
}

static void handle_cont_with_sig(GdbCmdContext *gdb_ctx, void *user_ctx)
{
unsigned long signal = 0;

/*
* Note: C sig;[addr] is currently unsupported and we simply
* omit the addr parameter
*/
if (gdb_ctx->num_params) {
signal = gdb_ctx->params[0].val_ul;
}

gdb_ctx->s->signal = gdb_signal_to_target(signal);
if (gdb_ctx->s->signal == -1) {
gdb_ctx->s->signal = 0;
}
gdb_continue(gdb_ctx->s);
}

static int gdb_handle_packet(GDBState *s, const char *line_buf)
{
CPUState *cpu;
Expand Down Expand Up @@ -1592,11 +1611,16 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
}
break;
case 'C':
s->signal = gdb_signal_to_target (strtoul(p, (char **)&p, 16));
if (s->signal == -1)
s->signal = 0;
gdb_continue(s);
return RS_IDLE;
{
static const GdbCmdParseEntry cont_with_sig_cmd_desc = {
.handler = handle_cont_with_sig,
.cmd = "C",
.cmd_startswith = 1,
.schema = "l0"
};
cmd_parser = &cont_with_sig_cmd_desc;
}
break;
case 'v':
if (strncmp(p, "Cont", 4) == 0) {
p += 4;
Expand Down

0 comments on commit ccc47d5

Please sign in to comment.