From nobody Sat Feb 7 04:40:48 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=1556200614; cv=none; d=zoho.com; s=zohoarc; b=bjFd+pPnkMgsN3N8CsFdWQrRPtUSpb53knYIQytKzun+uu0RMoptbZL2XPUSPIywEI/oRMYNgPY1NHCm51YLywdqJPx4UdgL6PMok0p9iZ4GGBeaGK9PMsC781uYgEpuPnyhsgaoXYeTM1sPrT63d/W3pR8cOOPCwB8aKwkQuxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556200614; 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=3i2BqbPIZu3pJ1q7oaT6KMUZ5ADbICItlHWHixBftQQ=; b=K2ucxe8hWdSm/2AX5XknNx+RCi8Cs5rraT9FxqmfCzCjv+t4weyn04RhrSyjVIJNMI/YVO1DsU9UBpj2b69wQQrGcuXDVOxfQ7hFThAwZfNnm/NV8isbvyIqOCdUMOJTvkV9D0+rIhJFUngu1Yk6VEwvkr9cbh5+YEp9E4d/SHQ= 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 1556200614121146.8781946518667; Thu, 25 Apr 2019 06:56:54 -0700 (PDT) Received: from localhost ([127.0.0.1]:57657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJerq-00084l-5F for importer@patchew.org; Thu, 25 Apr 2019 09:56:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJePy-00008x-6Z for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:28:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJePw-0001Sf-82 for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:28:02 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:52191) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJePv-0001Qh-4V for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:28:00 -0400 Received: by mail-wm1-x341.google.com with SMTP id 4so9299713wmf.1 for ; Thu, 25 Apr 2019 06:27:59 -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 y4sm2316540wrt.34.2019.04.25.06.27.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2019 06:27:54 -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=3i2BqbPIZu3pJ1q7oaT6KMUZ5ADbICItlHWHixBftQQ=; b=B73MlehlyXJdcFaBz8Qj5G60CH3pQObavR3NCyld7o95j2UGUXoU66rntXtWC0VqHa ml+QVKLBxSq8XnCc00SZWJuOnU6ON49hQ05eN+UzPjjAokRAkOEFqW3VBlFagrwm9eTe p4/Ph89Ioq+xR/zF3LJ1PrG69ntVlxk6ADRdVDhnxOivNIz2Qx7iw5v4Pwl3TLLehqSU hnFBZA9Bs/dHitJwzbMozD6XD7b9HAaWHQ//5Q0QJad3vLPm6N6YAZde9Fnuhf8A9RpF JjsQjPYmiuevc8DnVI3Q9X7Tl0FN67Kp7MZj0KvzoYdiEuX6282jzq7iJ8rQIqasKBz0 ZPNg== 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=3i2BqbPIZu3pJ1q7oaT6KMUZ5ADbICItlHWHixBftQQ=; b=rBiwGuD0/DNuqO7kH2ZOxiWHt5QgCQa5rG1ChFDTJw8DqWcqSrSZ18Vu3ljYpCrDEL InMhT36yS4/3dCQox/ajpyfJcrTIwnitSOlsowZf5n6pA53LDVI6Yyu6vsZbN+eDxnJs jOTZdBK0tQ9txoar3mRqoKOlH3hqmMHXjzuXvud1Hh9g6fV3OpYVlT4tbwNL3IHfCJSM I3RYGI45zulZFPVG32iDPXJq2lRXnueMfswpWW3nf6ORzEGQoZTTdiZ99NvbB8OvidU4 f9M0GRZYbC2nvIsdD7eDsm9iSkwboP8nP2i5slJO6WOgpx5X2AKv7RehNWiBlv/Sxt77 qLCA== X-Gm-Message-State: APjAAAVFXN7xIznNjU/07MOpDUWoCV9u39W38G9j1D2HYXGhtrkqLad0 TadKvEs8u0GlvJ3FIia/R0bIpp38 X-Google-Smtp-Source: APXvYqz36xK5R7XhBeH+Go/q++uO99iewu/qxhupHOtZYeGcYxhzuy4IxAu5xCjTO+Iq/Zpf4fAgHg== X-Received: by 2002:a7b:cb16:: with SMTP id u22mr3582662wmj.60.1556198876841; Thu, 25 Apr 2019 06:27:56 -0700 (PDT) From: Jon Doron To: qemu-devel@nongnu.org Date: Thu, 25 Apr 2019 16:26:29 +0300 Message-Id: <20190425132636.31636-15-arilou@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190425132636.31636-1-arilou@gmail.com> References: <20190425132636.31636-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::341 Subject: [Qemu-devel] [PATCH v6 14/21] 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: 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 | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index acf0e75908..3a7ef5eea6 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1758,6 +1758,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; @@ -1765,7 +1780,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]; @@ -1924,14 +1939,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.20.1