From nobody Mon Feb 9 06:00:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1556254551; cv=none; d=zoho.com; s=zohoarc; b=e7Qcv6Zi1dDIOWqhNz531HExClMOLLGJioW9gtRxc2DAY1NZOW/Kxl5WY4Tx9f+Vutd7u/61xdIksJ3ooPTU746ubS0IDhEWr3qxIyalsN85NzIhgqdBluhh0QDJ/rkgeX1qcyYwboMQ1qwne/dzRQRje5oBbY8dXiutCj4WWgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556254551; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6OoH0VZvs5cN/77prjtAmvXUSegJODVLc//0yGYVjjY=; b=LTOWECZXFAct2iailqzNNsV8iii3qMVYr+80GHmc8XTic8oUy4Le88XAlshSWguC9XFF7I/Qzq/hdPC5ezgAc4cfm6jt8N2yZDbp41SKAsg39WnVBfM6x2/rsU0NlPqKvT5K0hfDtEpXyyK/Fd8aiTrPAXvF08WV1u50Ow//o68= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556254551685623.7332790266682; Thu, 25 Apr 2019 21:55:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:39211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJsth-0007xC-Kj for importer@patchew.org; Fri, 26 Apr 2019 00:55:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJsmf-0000dE-E5 for qemu-devel@nongnu.org; Fri, 26 Apr 2019 00:48:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJsb3-0004Rr-Fl for qemu-devel@nongnu.org; Fri, 26 Apr 2019 00:36:26 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:40707) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJsb3-0004Q5-9U for qemu-devel@nongnu.org; Fri, 26 Apr 2019 00:36:25 -0400 Received: by mail-wr1-x444.google.com with SMTP id h4so2438658wre.7 for ; Thu, 25 Apr 2019 21:36:25 -0700 (PDT) Received: from localhost.localdomain (bzq-79-178-247-46.red.bezeqint.net. [79.178.247.46]) by smtp.gmail.com with ESMTPSA id h5sm3467088wmf.38.2019.04.25.21.36.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2019 21:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6OoH0VZvs5cN/77prjtAmvXUSegJODVLc//0yGYVjjY=; b=uwg1RQYsgwBPEOxFTvFOaDqh6ZEi2lTBJyr+fRp43kx+QeD/E0S9N4UfiFgLfrL9ty vSLK160mzxUZE6ULWZfQi1sHyAjFGRWkhYQDPKGk+mF3MiirK3XqbVCTSIsUoGOaCISW QixASgsdtwMG0jaIp7ZYtfvwSDvL8JuiCD6gcE8//S3tXhziW2KKzY+Wylsv/UK8kFl/ BdqLYgNlXqnRebdxU4oxO6RuJNNWESfPsBoI73GbhrOB4jelr5nMeOYgab5l9ce5+dcK spajNVfD5cgR/P9HoKY+cYr+BABTYK5avc9x+4q82M8l5ndjzZAHBjq/QxtqMi1W2z+N frZw== 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=6OoH0VZvs5cN/77prjtAmvXUSegJODVLc//0yGYVjjY=; b=PqE9AMNPiAkpUtyJuBnEmjuTBTF6WqGTSHvxKC/Djkb4gjvvvXjpudt0NQIqrYmsDZ iFmPxGee4WXgHz0fwFgqfMe/5xc7NJtq83m2BXmUcJ1Jr2ymDwmTEOlUTtStASgfSkho Tj/vlElM+LRATJn34aKJ6nPGmSD1AQAZ9jYwtFavI2UFfFsf23y5ck5r4XTgV9HZjARG VbA3C5cZ+D1bJW814Pcj99KI2tE8cd7Zk+TBYSanJHlRSSxEUThoOrvZejfzvU09BXxT egi2VwPKzBbB+otD8ELZBkUqKYdLsIOM3H6gLjVYcxFkxAjuWb2gF4WJiwM0GrYITqyR eFSg== X-Gm-Message-State: APjAAAV7WNUKxXpOkxzTzid9N6m5ffdI4pZHxNAX/K7YGNkpUJCRSaeT 7OdjOZkaq4lyJRDLWZNoxl7ztV0z X-Google-Smtp-Source: APXvYqyDOwg9VcXu3GWfwvVg4nX+8CwandTAo9p4prMmapUow+j7CPrCT/E5eDL5+I4Q47WPX17Nfg== X-Received: by 2002:adf:ec4e:: with SMTP id w14mr5479137wrn.53.1556253383464; Thu, 25 Apr 2019 21:36:23 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Fri, 26 Apr 2019 07:35:46 +0300 Message-Id: <20190426043558.6888-10-arilou@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426043558.6888-1-arilou@gmail.com> References: <20190426043558.6888-1-arilou@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH v7 09/21] gdbstub: Implement set register (P pkt) with new infra X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, Jon Doron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jon Doron --- gdbstub.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index b42425b24c..10e3f12a68 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1634,6 +1634,27 @@ static void handle_remove_bp(GdbCmdContext *gdb_ctx,= void *user_ctx) put_packet(gdb_ctx->s, "E22"); } =20 +static void handle_set_reg(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + int reg_size; + + if (!gdb_has_xml) { + put_packet(gdb_ctx->s, ""); + return; + } + + if (gdb_ctx->num_params < 2) { + put_packet(gdb_ctx->s, ""); + return; + } + + reg_size =3D 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; @@ -1878,15 +1899,15 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) } break; case 'P': - if (!gdb_has_xml) - goto unknown_command; - addr =3D strtoull(p, (char **)&p, 16); - if (*p =3D=3D '=3D') - p++; - reg_size =3D 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 =3D { + .handler =3D handle_set_reg, + .cmd =3D "P", + .cmd_startswith =3D 1, + .schema =3D "L?s0" + }; + cmd_parser =3D &set_reg_cmd_desc; + } break; case 'Z': { --=20 2.20.1