gdb_test_no_output "python add_global_disassembler($global_disassembler_name)"
}
- # Disassemble main, and check the disassembler output.
- gdb_test "disassemble main" $expected_pattern
+ # Disassemble test, and check the disassembler output.
+ gdb_test "disassemble test" $expected_pattern
}
}
with_test_prefix "GLOBAL tagging disassembler" {
py_remove_all_disassemblers
gdb_test_no_output "python gdb.disassembler.register_disassembler(TaggingDisassembler(\"GLOBAL\"), None)"
- gdb_test "disassemble main" "${base_pattern}\\s+## tag = GLOBAL\r\n.*"
+ gdb_test "disassemble test" "${base_pattern}\\s+## tag = GLOBAL\r\n.*"
}
# Now register an architecture specific disassembler, and check it
# overrides the global disassembler.
with_test_prefix "LOCAL tagging disassembler" {
gdb_test_no_output "python gdb.disassembler.register_disassembler(TaggingDisassembler(\"LOCAL\"), \"${curr_arch}\")"
- gdb_test "disassemble main" "${base_pattern}\\s+## tag = LOCAL\r\n.*"
+ gdb_test "disassemble test" "${base_pattern}\\s+## tag = LOCAL\r\n.*"
}
# Now remove the architecture specific disassembler, and check that
# the global disassembler kicks back in.
with_test_prefix "GLOBAL tagging disassembler again" {
gdb_test_no_output "python gdb.disassembler.register_disassembler(None, \"${curr_arch}\")"
- gdb_test "disassemble main" "${base_pattern}\\s+## tag = GLOBAL\r\n.*"
+ gdb_test "disassemble test" "${base_pattern}\\s+## tag = GLOBAL\r\n.*"
}
# Check that a DisassembleInfo becomes invalid after the call into the
with_test_prefix "DisassembleInfo becomes invalid" {
py_remove_all_disassemblers
gdb_test_no_output "python add_global_disassembler(GlobalCachingDisassembler)"
- gdb_test "disassemble main" "${base_pattern}\\s+## CACHED\r\n.*"
+ gdb_test "disassemble test" "${base_pattern}\\s+## CACHED\r\n.*"
gdb_test "python GlobalCachingDisassembler.check()" "PASS"
}
with_test_prefix "memory source api" {
py_remove_all_disassemblers
gdb_test_no_output "python analyzing_disassembler = add_global_disassembler(AnalyzingDisassembler)"
- gdb_test "disassemble main" "${base_pattern}\r\n.*"
+ gdb_test "disassemble test" "${base_pattern}\r\n.*"
gdb_test "python analyzing_disassembler.find_replacement_candidate()" \
"Replace from $hex to $hex with NOP"
- gdb_test "disassemble main" "${base_pattern}\r\n.*" \
+ gdb_test "disassemble test" "${base_pattern}\r\n.*" \
"second disassembler pass"
gdb_test "python analyzing_disassembler.check()" \
"PASS"
"\[^\r\n\]+BuiltinDisassembler\\s+\\(Matches current architecture\\)" \
"GLOBAL\\s+BuiltinDisassembler"] \
"list disassemblers, multiple disassemblers registered"
+
+ # Check that disassembling main (with the BuiltinDisassembler in
+ # place) doesn't cause GDB to crash. The hope is that
+ # disassembling main will result in a call to print_address, which
+ # is where the problem was.
+ gdb_test "disassemble main" ".*"
}
# Check the attempt to create a "new" DisassembleInfo object fails.
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.
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")