aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-06-28 06:57:16 -0600
committerTom Tromey <tromey@adacore.com>2023-07-21 09:30:12 -0600
commit812e7caf60b11c1b9ed09f7d5eda47c2178005dc (patch)
tree83624516f3de4d3dfd0fe3be0504ce177275e696 /gdb/python
parent83f362cf8f9539cefdd5df709a347a5396d23c76 (diff)
downloadgdb-812e7caf60b11c1b9ed09f7d5eda47c2178005dc.zip
gdb-812e7caf60b11c1b9ed09f7d5eda47c2178005dc.tar.gz
gdb-812e7caf60b11c1b9ed09f7d5eda47c2178005dc.tar.bz2
Add instruction bytes to DAP disassembly response
The DAP disassemble command lets the client return the underlying bytes of the instruction in an implementation-defined format. This patch updates gdb to return this, and simply uses a hex string of the bytes as the format. Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/lib/gdb/dap/disassemble.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/python/lib/gdb/dap/disassemble.py b/gdb/python/lib/gdb/dap/disassemble.py
index bc091eb..dda2f43 100644
--- a/gdb/python/lib/gdb/dap/disassemble.py
+++ b/gdb/python/lib/gdb/dap/disassemble.py
@@ -21,18 +21,21 @@ from .startup import send_gdb_with_response, in_gdb_thread
@in_gdb_thread
def _disassemble(pc, skip_insns, count):
+ inf = gdb.selected_inferior()
try:
arch = gdb.selected_frame().architecture()
except gdb.error:
# Maybe there was no frame.
- arch = gdb.selected_inferior().architecture()
+ arch = inf.architecture()
result = []
total_count = skip_insns + count
for elt in arch.disassemble(pc, count=total_count)[skip_insns:]:
+ mem = inf.read_memory(elt["addr"], elt["length"])
result.append(
{
"address": hex(elt["addr"]),
"instruction": elt["asm"],
+ "instructionBytes": mem.hex(),
}
)
return {