mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-05 12:53:16 +08:00
Handle memory write errors on gdb.base/break-always.exp
This is another case of the testcase not handling memory write errors that happen on some targets (QEMU) when GDB attempts to modify an address that should contain a breakpoint, for example. The following patch handles this and prevents spurious failures from happening. It also adds a foreach loop to avoid duplication of code and hardcoded patterns. gdb/testsuite/ChangeLog: 2015-04-29 Luis Machado <lgustavo@codesourcery.com> * gdb.base/break-always.exp: Abort testing if writing to memory causes an error.
This commit is contained in:
parent
0a13382c8e
commit
ecbf2b3c4f
@ -1,3 +1,8 @@
|
|||||||
|
2015-04-29 Luis Machado <lgustavo@codesourcery.com>
|
||||||
|
|
||||||
|
* gdb.base/break-always.exp: Abort testing if writing to memory
|
||||||
|
causes an error.
|
||||||
|
|
||||||
2015-04-28 Doug Evans <dje@google.com>
|
2015-04-28 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
* gdb.python/py-pp-maint.py: Move "replace" testing to ...
|
* gdb.python/py-pp-maint.py: Move "replace" testing to ...
|
||||||
|
@ -69,19 +69,25 @@ gdb_test "p /x \$shadow = *(char *) $bp_address" \
|
|||||||
# and still leave the breakpoint insn planted. Try twice with
|
# and still leave the breakpoint insn planted. Try twice with
|
||||||
# different values, in case we happen to be writting exactly what was
|
# different values, in case we happen to be writting exactly what was
|
||||||
# there already.
|
# there already.
|
||||||
gdb_test "p /x *(char *) $bp_address = 0" \
|
foreach test_value {0 1} {
|
||||||
" = 0x0" \
|
set write_test "write $test_value to breakpoint's address"
|
||||||
"write 0 to breakpoint's address"
|
|
||||||
gdb_test "p /x *(char *) $bp_address" \
|
|
||||||
" = 0x0" \
|
|
||||||
"read back 0 from the breakpoint's address"
|
|
||||||
|
|
||||||
gdb_test "p /x *(char *) $bp_address = 1" \
|
gdb_test_multiple "p /x *(char *) $bp_address = $test_value" $write_test {
|
||||||
" = 0x1" \
|
-re "Cannot access memory at address $hex.*$gdb_prompt $" {
|
||||||
"write 1 to breakpoint's address"
|
|
||||||
gdb_test "p /x *(char *) $bp_address" \
|
# Some targets do not allow manually writing a breakpoint to a
|
||||||
" = 0x1" \
|
# certain memory address, like QEMU. In that case, just bail out.
|
||||||
"read back 1 from the breakpoint's address"
|
unsupported "Cannot write to address $bp_address"
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
-re " = .*$gdb_prompt $" {
|
||||||
|
pass $write_test
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set read_test "read back $test_value from the breakpoint's address"
|
||||||
|
gdb_test "p /x *(char *) $bp_address" " = 0x$test_value" $read_test
|
||||||
|
}
|
||||||
|
|
||||||
# Restore the original contents.
|
# Restore the original contents.
|
||||||
gdb_test "p /x *(char *) $bp_address = \$shadow" "" \
|
gdb_test "p /x *(char *) $bp_address = \$shadow" "" \
|
||||||
|
Loading…
Reference in New Issue
Block a user