From nobody Mon Feb 9 04:03:29 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=1558714601; cv=none; d=zoho.com; s=zohoarc; b=Esz7kh/ni/22aHixLCytGmVilwnZx0h/ZZLSOK2l6ZbZZs9kbjt/uT4DmIr8UuaBg6x6Z2+zi/RaZazCJaW+5w3Pk+6c09fIoUIqYQSLModyPerBdfQ1Sv1v0s7EE1wNrL7VLu5hMy3BJ39bEitKlqhnyPHcRRDcpp7U7LXC4G0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558714601; h=Content-Type: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=0K6XJDL6BHpBdzcJvkw9ibcDs824edt12MdOLNnZMaI=; b=KkMiwEceoXogYhI/GC+RwLq5xN99ZlfQPp4wJ1l1l6izoG1gt0Yy5SAHPG5U+KQ0fsxFV/RG98HOv5A/nAJh/tMnplIoWBalOvJGjlWesIPIDwFL3LPTxMWpOqJhmEDWPsUMnPqhzOcKExaBNkIed6zMSZSN7sp2W4lxsiIKjiU= 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 155871460146978.45262879332176; Fri, 24 May 2019 09:16:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:57091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUCrX-0007yw-92 for importer@patchew.org; Fri, 24 May 2019 12:16:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUCdn-0004D3-NX for qemu-devel@nongnu.org; Fri, 24 May 2019 12:01:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUCdl-0002Dj-Pe for qemu-devel@nongnu.org; Fri, 24 May 2019 12:01:55 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:40896) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hUCdf-00024A-HH for qemu-devel@nongnu.org; Fri, 24 May 2019 12:01:51 -0400 Received: by mail-wm1-x341.google.com with SMTP id 15so9728731wmg.5 for ; Fri, 24 May 2019 09:01:46 -0700 (PDT) Received: from jondnuc.lan ([176.230.64.37]) by smtp.gmail.com with ESMTPSA id s11sm370863wro.17.2019.05.24.09.01.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 09:01:44 -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=0K6XJDL6BHpBdzcJvkw9ibcDs824edt12MdOLNnZMaI=; b=sqi7gUtstUuOrGxyZdWPlvRtpQ0YniOVr/ragnGrFcgQ5iXBWqPJj1kJHcocn5Ql9a fE0xCOXpYqtjGTvDY7nW4wL1nbQouZ+KlAenRfs1h+TXryyIHWwUhp8xs5reJv5Nt5ID O8A/DwO5bygT3SxffQutIOWD8x+t1rdBaYgfoNcJdxdq0FRIG8uZT2TRm3udQm4qJSGr OTiwa8gySkl9qyv7GuoeybytEHTEUnB5eX0ZnSUfqiOVRBSN2xlkReJCByLCUzhhU1iW B4HmgCdqoOBWIuewFSZ1TjVO+hd9+yTR6IAcw+FdGKJbRP62bhLOjzuOZH6lX/rkRmrc dNUA== 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=0K6XJDL6BHpBdzcJvkw9ibcDs824edt12MdOLNnZMaI=; b=LOi+W4x1QBBOYt1Qbu+AC946z23DCb7WjSxutpQDxcYE3TvycFEXFgFbGLBqTzzg80 uy9OiuB3frSzXtgIebbG0VAR0s1dqXUqkiMi+ZssNETK3Yh6iNR+tmcRFcXgMWAEiJ3R 92aToMVSxbYSXD0zDZmNT7FMZhUJoJNKMp4wHnlsN+lUVX8GQWKMoipXSHF0PrtVxqDs wwc3OfkMfDjP3KLELgjLu5OH0fyNsvl1HJmLL5LW1wECh86Sn62NNhhV5/QZEGRhtoVe dkf2LHJ9+HT8UD6eT5jCcQe26RJAjVyzE9vZhUEkNx9aWL2tiE3oPOfnkeDUk3HLfiJ/ ze3g== X-Gm-Message-State: APjAAAXL5I7u+0lIdCiKkFgfJapJ+hrxtjn6bPl2BkAHOfEiWujxNnCr 6AO8DcVzAQCCIVsJhNefyMUT/fy7 X-Google-Smtp-Source: APXvYqxyMjn/Hox80gl35AgKS1irbyjjZ8Z90f+3TXUH9F83pAsKP3PMjn1UhEgp6hOzwEPrxKXqAw== X-Received: by 2002:a05:600c:ca:: with SMTP id u10mr398443wmm.33.1558713705120; Fri, 24 May 2019 09:01:45 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 19:01:11 +0300 Message-Id: <20190524160118.31134-14-arilou@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190524160118.31134-1-arilou@gmail.com> References: <20190524160118.31134-1-arilou@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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::341 Subject: [Qemu-devel] [PATCH v11 13/20] gdbstub: Implement read all registers (g 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) Signed-off-by: Jon Doron Reviewed-by: Alex Benn=C3=A9e --- gdbstub.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 1afad31b49..781f5882ac 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1760,6 +1760,21 @@ static void handle_write_all_regs(GdbCmdContext *gdb= _ctx, void *user_ctx) put_packet(gdb_ctx->s, "OK"); } =20 +static void handle_read_all_regs(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + target_ulong addr, len; + + cpu_synchronize_state(gdb_ctx->s->g_cpu); + len =3D 0; + for (addr =3D 0; addr < gdb_ctx->s->g_cpu->gdb_num_g_regs; addr++) { + len +=3D gdb_read_register(gdb_ctx->s->g_cpu, gdb_ctx->mem_buf + l= en, + addr); + } + + memtohex(gdb_ctx->str_buf, gdb_ctx->mem_buf, len); + put_packet(gdb_ctx->s, gdb_ctx->str_buf); +} + static int gdb_handle_packet(GDBState *s, const char *line_buf) { CPUState *cpu; @@ -1767,7 +1782,7 @@ static int gdb_handle_packet(GDBState *s, const char = *line_buf) CPUClass *cc; const char *p; uint32_t pid, tid; - int ch, reg_size, type, res; + int ch, type, res; uint8_t mem_buf[MAX_PACKET_LENGTH]; char buf[sizeof(mem_buf) + 1 /* trailing NUL */]; char thread_id[16]; @@ -1926,14 +1941,14 @@ static int gdb_handle_packet(GDBState *s, const cha= r *line_buf) } break; case 'g': - cpu_synchronize_state(s->g_cpu); - len =3D 0; - for (addr =3D 0; addr < s->g_cpu->gdb_num_g_regs; addr++) { - reg_size =3D gdb_read_register(s->g_cpu, mem_buf + len, addr); - len +=3D reg_size; + { + static const GdbCmdParseEntry read_all_regs_cmd_desc =3D { + .handler =3D handle_read_all_regs, + .cmd =3D "g", + .cmd_startswith =3D 1 + }; + cmd_parser =3D &read_all_regs_cmd_desc; } - memtohex(buf, mem_buf, len); - put_packet(s, buf); break; case 'G': { --=20 2.21.0