Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Farre via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Simon Farre <simon.farre.cx@gmail.com>
Subject: [PATCH v1] gdb/DAP Fix disassemble bug
Date: Mon, 26 Jun 2023 18:16:54 +0200	[thread overview]
Message-ID: <20230626161654.207687-1-simon.farre.cx@gmail.com> (raw)

Fixes disassembleRequest

The field instructionOffset can be negative. Previous patch made it so
that sometimes the request got calculated to 0 instructions, when it
meant to retrieve disasm for -50 to 0 (current position).
---
 gdb/python/lib/gdb/dap/disassemble.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/python/lib/gdb/dap/disassemble.py b/gdb/python/lib/gdb/dap/disassemble.py
index bc091eb2c89..1ee6cf2ff48 100644
--- a/gdb/python/lib/gdb/dap/disassemble.py
+++ b/gdb/python/lib/gdb/dap/disassemble.py
@@ -27,8 +27,8 @@ def _disassemble(pc, skip_insns, count):
         # Maybe there was no frame.
         arch = gdb.selected_inferior().architecture()
     result = []
-    total_count = skip_insns + count
-    for elt in arch.disassemble(pc, count=total_count)[skip_insns:]:
+
+    for elt in arch.disassemble(pc + skip_insns, count=count):
         result.append(
             {
                 "address": hex(elt["addr"]),
-- 
2.41.0


             reply	other threads:[~2023-06-26 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 16:16 Simon Farre via Gdb-patches [this message]
2023-06-26 18:34 ` Tom Tromey
2023-06-26 22:00   ` Simon Farre via Gdb-patches
2023-06-26 22:11   ` Simon Farre via Gdb-patches
2023-06-27 15:32     ` Simon Farre via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230626161654.207687-1-simon.farre.cx@gmail.com \
    --to=gdb-patches@sourceware.org \
    --cc=simon.farre.cx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox