aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-disasm.py
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2022-07-20 13:57:08 +0100
committerAndrew Burgess <aburgess@redhat.com>2022-07-25 19:26:24 +0100
commit23aa2befce75966acd388b810e139922857533fa (patch)
tree0b53ae068688c12f313eef7065fab9c0b9b33326 /gdb/testsuite/gdb.python/py-disasm.py
parent554128418b4f1328bb956d5926f24bfd56fd45ea (diff)
downloadbinutils-23aa2befce75966acd388b810e139922857533fa.zip
binutils-23aa2befce75966acd388b810e139922857533fa.tar.gz
binutils-23aa2befce75966acd388b810e139922857533fa.tar.bz2
gdb/python: fix invalid use disassemble_info::stream
After this commit: commit 81384924cdcc9eb2676dd9084b76845d7d0e0759 Date: Tue Apr 5 11:06:16 2022 +0100 gdb: have gdb_disassemble_info carry 'this' in its stream pointer The disassemble_info::stream field will no longer be a ui_file*. That commit failed to update one location in py-disasm.c though. While running some tests using the Python disassembler API, I triggered a call to gdbpy_disassembler::print_address_func, and, as I had compiled GDB with the undefined behaviour sanitizer, GDB crashed as the code currently (incorrectly) casts the stream field to be a ui_file*. In this commit I fix this error. In order to test this case I had to tweak the existing test case a little. I also spotted some debug printf statements in py-disasm.py, which I have removed.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-disasm.py')
-rw-r--r--gdb/testsuite/gdb.python/py-disasm.py3
1 files changed, 0 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.python/py-disasm.py b/gdb/testsuite/gdb.python/py-disasm.py
index ff7ffdb..3b9008b 100644
--- a/gdb/testsuite/gdb.python/py-disasm.py
+++ b/gdb/testsuite/gdb.python/py-disasm.py
@@ -584,7 +584,6 @@ class AnalyzingDisassembler(Disassembler):
if self._nop_index is None and result.string == "nop":
self._nop_index = len(self._pass_1_length)
# The offset in the following read_memory call defaults to 0.
- print("APB: Reading nop bytes")
self._nop_bytes = info.read_memory(result.length)
# Record information about each instruction that is disassembled.
@@ -661,8 +660,6 @@ class AnalyzingDisassembler(Disassembler):
def check(self):
"""Call this after the second disassembler pass to validate the output."""
if self._check != self._pass_2_insn:
- print("APB, Check : %s" % self._check)
- print("APB, Result: %s" % self._pass_2_insn)
raise gdb.GdbError("mismatch")
print("PASS")