aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Doron <arilou@gmail.com>2019-05-29 09:41:33 +0300
committerAlex Bennée <alex.bennee@linaro.org>2019-06-12 17:53:23 +0100
commitccc47d5d01a99d2eaa7fc4f10f78dde844c7d573 (patch)
treee52e07136502bfd10d65803ab94e869f842df539
parent4d6e3fe2794f6b586d59dfe26ce3969e7a7cf36a (diff)
gdbstub: Implement continue with signal (C pkt) with new infra
Signed-off-by: Jon Doron <arilou@gmail.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20190529064148.19856-6-arilou@gmail.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
-rw-r--r--gdbstub.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/gdbstub.c b/gdbstub.c
index 53149c565a..25ee936a8c 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -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;
@@ -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;