public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1] gdb/DAP Fix disassemble bug
@ 2023-06-26 16:16 Simon Farre
  2023-06-26 18:34 ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Farre @ 2023-06-26 16:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Farre

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-27 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26 16:16 [PATCH v1] gdb/DAP Fix disassemble bug Simon Farre
2023-06-26 18:34 ` Tom Tromey
2023-06-26 22:00   ` Simon Farre
2023-06-26 22:11   ` Simon Farre
2023-06-27 15:32     ` Simon Farre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).