From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:42814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hM6th-0003YB-0B for qemu-devel@nongnu.org; Thu, 02 May 2019 04:16:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hM6te-00082k-BW for qemu-devel@nongnu.org; Thu, 02 May 2019 04:16:52 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:36592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hM6ta-0007Ju-8E for qemu-devel@nongnu.org; Thu, 02 May 2019 04:16:46 -0400 Received: by mail-wr1-x441.google.com with SMTP id o4so2022997wra.3 for ; Thu, 02 May 2019 01:16:17 -0700 (PDT) From: Jon Doron Date: Thu, 2 May 2019 11:15:32 +0300 Message-Id: <20190502081554.5521-6-arilou@gmail.com> In-Reply-To: <20190502081554.5521-1-arilou@gmail.com> References: <20190502081554.5521-1-arilou@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v9 05/27] gdbstub: Implement continue with signal (C pkt) with new infra List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, Jon Doron Signed-off-by: Jon Doron --- gdbstub.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 89f1ab6524..469aaeb875 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1532,6 +1532,21 @@ 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; + + 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; @@ -1579,11 +1594,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; -- 2.20.1