From patchwork Fri Jun 7 09:05:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 166120 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp440825ili; Fri, 7 Jun 2019 03:15:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbxnnkwWYNWQqSmCIJ8xC9D8NUE+T1Oj1LVrTc6ZjRDHI3B+/JBW640kFBCi/sNIcza07B X-Received: by 2002:ac8:6c59:: with SMTP id z25mr46874956qtu.43.1559902502372; Fri, 07 Jun 2019 03:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559902502; cv=none; d=google.com; s=arc-20160816; b=lKB4K6xMmjLRUuMyIVj7Mcy3XXt7A15Zv2bDrTvlGMu+VmnNe+1H1grazWr1NfOcJl XGiAt7V6/D4hSLI7jZFok0fRWOpemNs3krXy1pqo86zi4+J8cqY7gUlCs3z+0D2cloBk bfAUHnIE6EwZjnx4UbZOffHhgF0XIR3NdryeGzK6nRF9050pwmqsPfOgLYX5hEfRhtLB y8qYOTpdQaw3bmJvWK8GE6+Vvs59v4xq6qGaoAsxV4Tstm0oF2p0JPX/dMGyJxdQ3X/C R9+WPLNG3AeDCEQ4Vt+efpG7g5i8jLWCDVuYNUpFuxnknAyw7XWN9unjYnaBqyMx1kpe OJOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=Kno1JHe4Nw5DNpZGIjJXu5QHXO+/4yvTRz2xZM/0txY=; b=yYKQN/wsTpbsVuP0w9KYwDsXEJqzWyajwXT/N9AQmmmXqmXq3tbWkUa53R7ejwdbP+ 2HhtQ8yWmt9iZVVvutNZpGfI7uXUf8fO3F7hipkhifpmgJKyoxV7em6efP4//ftT6ggn rr1YPES/lG68n08A6uBIap9Oae1+Im58l9kHJLeibxBWHGmNOVdNFidbFpC3F8hGfpf0 XFte9fftwrtKUi+PXTzpQaATNBefTNgML4JEL1YUIWauY9azYBLSbUMmiFak2G1brLZJ zr8EvFaWuao+9Val2mX33+YEldNXQtnG/1Sgu31aRNGi0Hz2y0yZANKe/+dwypLJo3qX t9+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fPLuKuwc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.47]) by mx.google.com with ESMTPS id j7si343460qth.112.2019.06.07.03.15.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 03:15:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fPLuKuwc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.47 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47920 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZBtl-0003cn-P9 for patch@linaro.org; Fri, 07 Jun 2019 06:15:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42202) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZAvT-0002FY-AQ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZAvQ-0004z4-PA for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:43 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:54778) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZAvQ-0004k3-E7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 05:12:40 -0400 Received: by mail-wm1-x332.google.com with SMTP id g135so1233880wme.4 for ; Fri, 07 Jun 2019 02:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kno1JHe4Nw5DNpZGIjJXu5QHXO+/4yvTRz2xZM/0txY=; b=fPLuKuwcdE23w8v3w974LXwbmBDbFl9vHRaFOyhB64LpZrwmbgiotLN8rzpwei/E7X 3PGMPiACY9nRuC4TQPl6xwXT9KQNsgyVPdpy1MlsU3MQASr/dx+RxsjFVE/uU30ZAhUZ Ub22ZuVqilQLspgqCtiF1gmDzpEe5zl8zLf4ra003OYL5p2Jmu7tndvgeLG2ore4eUOi kliwv2pqeIzdMtgCdwJjdFNfekbMyVSJNTN+8nQSCsJx0q1BXaYiMCuHWCaoHhKjIUml +MUsy9Xxnq71CJRxbJycVWXpJg93eb3eyszEB6rHD511ekLYXmzC26VzNI+6eRJZ6RdH T4wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Kno1JHe4Nw5DNpZGIjJXu5QHXO+/4yvTRz2xZM/0txY=; b=uVDcE5kmJoyLsN0tFkT4pdXw+gfITumk1vwsTKVFyGIUSNY8O36M9ocg41gpl8tbw6 /X2unlqcpR+yoZotST+i4dZ1uh+w1c3CEnRPTSJmUIzux5HLbU65JoDrQPLTYTduZ1+I AfXJ7Ar9R4mbs0nsBNToTXemsWj0WEVrgQGjOnUpt9HIoqEoyFz7DbskX5hHHXCUKWmR 0vD3rY6EHawp7ogqVzZaq7tzwaLyuS6TSvst6RjEGuDLStww177PgyVWtrMN+SdXlEdF kvbeaeryfTOfPuuUeGDb5Kk+wO6cAR9m/syeYglt4ozUylbGn5OWVDnCC59/YND0yN+e GeoA== X-Gm-Message-State: APjAAAXV4ov3aGCzqgFVUsNH08aDRz3mOt3Nmf8RynNirGB56k1GWksu k3Q4HJgy6SpNCetNFR2YyNj//Q== X-Received: by 2002:a1c:c305:: with SMTP id t5mr2790706wmf.163.1559898752590; Fri, 07 Jun 2019 02:12:32 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id q24sm1211067wmc.43.2019.06.07.02.12.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 07 Jun 2019 02:12:30 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 39A9D1FFBF; Fri, 7 Jun 2019 10:05:55 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 7 Jun 2019 10:05:39 +0100 Message-Id: <20190607090552.12434-41-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190607090552.12434-1-alex.bennee@linaro.org> References: <20190607090552.12434-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 40/52] gdbstub: Implement set register (P pkt) with new infra X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Jon Doron Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Jon Doron Signed-off-by: Jon Doron Message-Id: <20190529064148.19856-9-arilou@gmail.com> Signed-off-by: Alex Bennée -- 2.20.1 diff --git a/gdbstub.c b/gdbstub.c index 8416f4c13f..630f931765 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1651,6 +1651,27 @@ static void handle_remove_bp(GdbCmdContext *gdb_ctx, void *user_ctx) put_packet(gdb_ctx->s, "E22"); } +static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int reg_size; + + if (!gdb_has_xml) { + put_packet(gdb_ctx->s, "E00"); + return; + } + + if (gdb_ctx->num_params != 2) { + put_packet(gdb_ctx->s, "E22"); + return; + } + + reg_size = strlen(gdb_ctx->params[1].data) / 2; + hextomem(gdb_ctx->mem_buf, gdb_ctx->params[1].data, reg_size); + gdb_write_register(gdb_ctx->s->g_cpu, gdb_ctx->mem_buf, + gdb_ctx->params[0].val_ull); + put_packet(gdb_ctx->s, "OK"); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1895,15 +1916,15 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } break; case 'P': - if (!gdb_has_xml) - goto unknown_command; - addr = strtoull(p, (char **)&p, 16); - if (*p == '=') - p++; - reg_size = strlen(p) / 2; - hextomem(mem_buf, p, reg_size); - gdb_write_register(s->g_cpu, mem_buf, addr); - put_packet(s, "OK"); + { + static const GdbCmdParseEntry set_reg_cmd_desc = { + .handler = handle_set_reg, + .cmd = "P", + .cmd_startswith = 1, + .schema = "L?s0" + }; + cmd_parser = &set_reg_cmd_desc; + } break; case 'Z': {