diff options
author | Pedro Alves <palves@redhat.com> | 2011-12-06 20:03:14 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-12-06 20:03:14 +0000 |
commit | f0ba3972e968a8f328d2d465bbd1218e228fbf2a (patch) | |
tree | daeb62e5fc8f74947ee31f0f14a3bcccd14f2006 /gdb/testsuite/gdb.base | |
parent | 31aba06f31d348be54adb50195af858baff6256f (diff) | |
download | gdb-f0ba3972e968a8f328d2d465bbd1218e228fbf2a.zip gdb-f0ba3972e968a8f328d2d465bbd1218e228fbf2a.tar.gz gdb-f0ba3972e968a8f328d2d465bbd1218e228fbf2a.tar.bz2 |
2011-12-06 Pedro Alves <pedro@codesourcery.com>
gdb/
* breakpoint.c (breakpoint_restore_shadows): Rename to ...
(breakpoint_xfer_memory): ... this. Change prototype. Handle
memory writes too.
* breakpoint.h (breakpoint_restore_shadows): Delete.
(breakpoint_xfer_memory): Declare.
* mem-break.c (default_memory_insert_breakpoint)
(default_memory_remove_breakpoint): Use target_write_raw_memory.
(memory_xfer_partial): Rename to ...
(memory_xfer_partial_1): ... this. Don't mask out breakpoints
here.
(memory_xfer_partial): New.
(target_write_raw_memory): New.
* target.h (target_write_raw_memory): New.
gdb/testsuite/
* gdb.base/break-always.exp: Test changing memory at addresses
with breakpoints inserted.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/break-always.exp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/break-always.exp b/gdb/testsuite/gdb.base/break-always.exp index ce76af7c..e20794e 100644 --- a/gdb/testsuite/gdb.base/break-always.exp +++ b/gdb/testsuite/gdb.base/break-always.exp @@ -49,7 +49,42 @@ gdb_test_no_output "enable 2" "enable 2.H" gdb_test_no_output "disable 2" "disable 2.I" gdb_test "info breakpoints" "keep n.*keep n.*keep y.*keep n.*keep n.*" "before re-enable check breakpoint state" gdb_test_no_output "enable" "re-enable all breakpoints" -gdb_continue_to_breakpoint "bar" ".*break-always.c:$bar_location.*" +set bp_address 0 +set test "set breakpoint on bar 2" +gdb_test_multiple "break bar" $test { + -re "Breakpoint 6 at ($hex).*$gdb_prompt $" { + set bp_address $expect_out(1,string) + pass $test + } +} + +# Save the original INSN under the breakpoint. +gdb_test "p /x \$shadow = *(char *) $bp_address" \ + " = $hex" \ + "save shadow" +# Overwrite memory where the breakpoint is planted. GDB should update +# its memory breakpoint's shadows, to account for the new contents, +# and still leave the breakpoint insn planted. Try twice with +# different values, in case we happen to be writting exactly what was +# there already. +gdb_test "p /x *(char *) $bp_address = 0" \ + " = 0x0" \ + "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" \ + " = 0x1" \ + "write 1 to breakpoint's address" +gdb_test "p /x *(char *) $bp_address" \ + " = 0x1" \ + "read back 1 from the breakpoint's address" + +# Restore the original contents. +gdb_test "p /x *(char *) $bp_address = \$shadow" "" + +# Run to breakpoint. +gdb_continue_to_breakpoint "bar" ".*break-always.c:$bar_location.*" |