2012-01-27 Pedro Alves <palves@redhat.com>
authorPedro Alves <palves@redhat.com>
Fri, 27 Jan 2012 14:00:41 +0000 (14:00 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 27 Jan 2012 14:00:41 +0000 (14:00 +0000)
* gdb.base/watchpoint.exp (test_no_hw_watchpoints): New, factored
out from the top level.
(top level): Call it instead.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/watchpoint.exp

index 7f1776e5384c320ca66739eec988cfe80d897e0a..218cfe0c9ace60ff0d0e7b8b8127ca67be4c19ec 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-27  Pedro Alves  <palves@redhat.com>
+
+       * gdb.base/watchpoint.exp (test_no_hw_watchpoints): New, factored
+       out from the top level.
+       (top level): Call it instead.
+
 2012-01-27  Pedro Alves  <palves@redhat.com>
 
        * gdb.base/watchpoint.exp (top level): Re-enable hardware
index a3d5234b05e4144f8d4514bcfc5b58aceac3fd76..54e21c34dafe33347be40be2dfcddd38d5a3bec8 100644 (file)
@@ -765,7 +765,45 @@ proc test_inaccessible_watchpoint {} {
        gdb_test_no_output "delete \$global_ptr_ptr_breakpoint_number"
     }
 }
-    
+
+proc test_no_hw_watchpoints {} {
+    maybe_clean_restart
+
+    # Verify that a user can force GDB to use "slow" watchpoints.
+    # (This proves rather little on kernels that don't support
+    # fast watchpoints, but still...)
+    #
+    if ![runto_main] then { fail "watch tests suppressed" }
+
+    gdb_test_no_output "set can-use-hw-watchpoints 0" "disable fast watches"
+
+    gdb_test "show can-use-hw-watchpoints" \
+       "Debugger's willingness to use watchpoint hardware is 0." \
+       "show disable fast watches"
+
+    gdb_test "watch ival3 if  count > 1" \
+       "Watchpoint \[0-9\]*: ival3.*" \
+       "set slow conditional watch"
+
+    gdb_test "continue" \
+       "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*" \
+       "trigger slow conditional watch"
+
+    gdb_test_no_output "delete \$bpnum" "delete watch ival3"
+
+    # We've explicitly disabled hardware watches.  Verify that GDB
+    # refrains from using them.
+    #
+    gdb_test "rwatch ival3" \
+       "Expression cannot be implemented with read/access watchpoint..*" \
+       "rwatch disallowed when can-set-hw-watchpoints cleared"
+
+    # Re-enable hardware watchpoints if necessary.
+    if ![target_info exists gdb,no_hardware_watchpoints] {
+        gdb_test_no_output "set can-use-hw-watchpoints 1" ""
+    }
+}
+
 proc test_watchpoint_in_big_blob {} {
     global gdb_prompt
 
@@ -844,41 +882,7 @@ if [initialize] then {
 
     test_inaccessible_watchpoint
 
-    maybe_clean_restart
-
-    # Verify that a user can force GDB to use "slow" watchpoints.
-    # (This proves rather little on kernels that don't support
-    # fast watchpoints, but still...)
-    #
-    if ![runto_main] then { fail "watch tests suppressed" }
-
-    gdb_test_no_output "set can-use-hw-watchpoints 0" "disable fast watches"
-
-    gdb_test "show can-use-hw-watchpoints" \
-       "Debugger's willingness to use watchpoint hardware is 0." \
-       "show disable fast watches"
-
-    gdb_test "watch ival3 if  count > 1" \
-       "Watchpoint \[0-9\]*: ival3.*" \
-       "set slow conditional watch"
-
-    gdb_test "continue" \
-       "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*" \
-       "trigger slow conditional watch"
-
-    gdb_test_no_output "delete \$bpnum" "delete watch ival3"
-
-    # We've explicitly disabled hardware watches.  Verify that GDB
-    # refrains from using them.
-    #
-    gdb_test "rwatch ival3" \
-       "Expression cannot be implemented with read/access watchpoint..*" \
-       "rwatch disallowed when can-set-hw-watchpoints cleared"
-
-    # Re-enable hardware watchpoints if necessary.
-    if ![target_info exists gdb,no_hardware_watchpoints] {
-        gdb_test_no_output "set can-use-hw-watchpoints 1" ""
-    }
+    test_no_hw_watchpoints
 
     test_watchpoint_and_breakpoint