summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-disasm.py
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.python/py-disasm.py')
-rw-r--r--gdb/testsuite/gdb.python/py-disasm.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-disasm.py b/gdb/testsuite/gdb.python/py-disasm.py
index 977cdbf3c37..435a3bf5339 100644
--- a/gdb/testsuite/gdb.python/py-disasm.py
+++ b/gdb/testsuite/gdb.python/py-disasm.py
@@ -113,6 +113,18 @@ class ShowResultRepr(TestDisassembler):
return DisassemblerResult(length=length, string=string)
+class ShowResultStr(TestDisassembler):
+ """Call the __str__ method on a DisassemblerResult object, incude the
+ resulting string in a comment within the disassembler output."""
+
+ def disassemble(self, info):
+ result = gdb.disassembler.builtin_disassemble(info)
+ comment = "\t## " + str(result)
+ string = result.string + comment
+ length = result.length
+ return DisassemblerResult(length=length, string=string)
+
+
class GlobalPreInfoDisassembler(TestDisassembler):
"""Check the attributes of DisassembleInfo before disassembly has occurred."""