Fix break on Python 2

This changes the return type of "gdb.BtraceInstruction.data ()" from
"memoryview" to "buffer" on Python 2.7 and below, similar to what
"gdb.Inferior.read_memory ()" does.
This commit is contained in:
Tim Wiederhake
2017-03-21 08:19:59 +01:00
parent 09220eae9d
commit cee59b3fea
6 changed files with 27 additions and 2 deletions

View File

@ -85,7 +85,11 @@ with_test_prefix "instruction " {
gdb_test "python print(i.error)" "None"
gdb_test "python print(i.sal)" "symbol and line for .*"
gdb_test "python print(i.pc)" "$decimal"
gdb_test "python print(i.data)" "<memory at $hex>"
if { $gdb_py_is_py3k == 0 } {
gdb_test "python print(repr(i.data))" "<read-only buffer for $hex,.*>"
} else {
gdb_test "python print(repr(i.data))" "<memory at $hex>"
}
gdb_test "python print(i.decoded)" ".*"
gdb_test "python print(i.size)" "$decimal"
gdb_test "python print(i.is_speculative)" "False"