+2012-01-27 Pedro Alves <palves@redhat.com>
+
+ * gdb.base/watchpoint.exp (no_hw): New global.
+ (maybe_clean_restart, maybe_reinitialize): If no_hw is set,
+ disable hw watchpoints.
+ (test_wide_location_1, test_wide_location_2): If no_hw is set,
+ don't expect hw watchpoints.
+ (no_hw_watchpoints): Always clean restart.
+ (do_tests): New procedure, factored out from the top level.
+ (top level): Run tests twice. Once with hw watchpoints enabled,
+ another time with hw watchpoints disabled.
+
2012-01-27 Pedro Alves <palves@redhat.com>
* gdb.base/watchpoint.exp (test_no_hw_watchpoints): New, factored
return -1
}
+# True if we're forcing no hardware watchpoints.
+set no_hw 0
+
# Prepare for watchpoint tests by setting up two breakpoints and one
# watchpoint.
#
# starting another one.
if [istarget "mips-idt-*"] then {
global testfile
+ global no_hw
clean_restart $testfile
+
+ if {$no_hw} {
+ gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+ }
}
}
# starting another one.
if [istarget "mips-idt-*"] then {
global testfile
+ global no_hw
clean_restart $testfile
+
+ if {$no_hw} {
+ gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+ }
+
initialize
}
}
# Tests watching areas larger than a word.
proc test_wide_location_1 {} {
+ global no_hw
+
# This test watches two words on most 32-bit ABIs, and one word on
# most 64-bit ABIs.
# Platforms where the target can't watch such a large region
# should clear hw_expected below.
- if [target_info exists gdb,no_hardware_watchpoints] {
+ if { $no_hw || [target_info exists gdb,no_hardware_watchpoints] } {
set hw_expected 0
} else {
set hw_expected 1
}
proc test_wide_location_2 {} {
+ global no_hw
+
# This test watches four words on most 32-bit ABIs, and two words
# on 64-bit ABIs.
# Platforms where the target can't watch such a large region
# should clear hw_expected below.
- if [target_info exists gdb,no_hardware_watchpoints] {
+ if { $no_hw || [target_info exists gdb,no_hardware_watchpoints] } {
set hw_expected 0
} else {
set hw_expected 1
}
proc test_no_hw_watchpoints {} {
- maybe_clean_restart
+ global testfile
+
+ clean_restart $testfile
# Verify that a user can force GDB to use "slow" watchpoints.
# (This proves rather little on kernels that don't support
# Start with a fresh gdb.
-clean_restart $testfile
set prev_timeout $timeout
set timeout 600
verbose "Timeout now 600 sec.\n"
-if [initialize] then {
+test_no_hw_watchpoints
- test_simple_watchpoint
+proc do_tests {} {
+ global testfile
+ global no_hw
- test_disabling_watchpoints
+ clean_restart $testfile
- if ![target_info exists gdb,cannot_call_functions] {
- test_stepping
+ if {$no_hw} {
+ gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+ }
+
+ if [initialize] then {
+
+ test_simple_watchpoint
+
+ test_disabling_watchpoints
+
+ if ![target_info exists gdb,cannot_call_functions] {
+ test_stepping
+ }
}
# Tests below don't rely on the markers and watchpoint set by
# `initialize' anymore.
clean_restart $testfile
+ if {$no_hw} {
+ gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+ }
+
# Only enabled for some targets merely because it has not been tested
# elsewhere.
# On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
test_inaccessible_watchpoint
- test_no_hw_watchpoints
-
test_watchpoint_and_breakpoint
test_watchpoint_in_big_blob
test_wide_location_2
}
+# On targets that can do hardware watchpoints, run the tests twice:
+# once with hardware watchpoints enabled; another with hardware
+# watchpoints force-disabled.
+
+do_tests
+if ![target_info exists gdb,no_hardware_watchpoints] {
+ set save_pf_prefix $pf_prefix
+ lappend pf_prefix "no-hw:"
+
+ set no_hw 1
+ do_tests
+ set pf_prefix $save_pf_prefix
+}
+
# Restore old timeout
set timeout $prev_timeout
verbose "Timeout now $timeout sec.\n"