testsuite: i386 regression for funcargs.exp
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / watchpoint.exp
index 7a014f06cbd6f6949725277ca39e90340fc7eafa..e4eab3da19b7a6d9a1c8f37633f60c25becd7985 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1992, 1994-2000, 2007-2012 Free Software Foundation, Inc.
+# Copyright 1992-2016 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # This file was written by Fred Fish. (fnf@cygnus.com)
 
 
-set testfile "watchpoint"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-set wp_set 1
-
-if [get_compiler_info ${binfile}] {
+if [get_compiler_info] {
     return -1
 }
 
@@ -31,6 +27,9 @@ if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
      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.
 #
@@ -52,47 +51,25 @@ proc initialize {} {
     global hex
     global decimal
     global srcfile
-    global wp_set
-
-    # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
-       gdb_test_no_output "set can-use-hw-watchpoints 0" ""
-    }
 
     if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { 
-      return 0
+      return 0
     }
 
 
     if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] { 
-      return 0
+      return 0
     }
 
 
     if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break in watchpoint.exp" ] { 
-      return 0
+      return 0
     }
 
-
-    # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint
-    # before running can cause the inferior to croak on HP-UX 11.0 for
-    # reasons yet unknown, we've disabled the ability to set watches
-    # without a running inferior.  Verify the restriction. 
-    #
-    set test "set watchpoint on ival3"
-    gdb_test_multiple "watch ival3" $test {
-        -re ".*\[Ww\]atchpoint 3: ival3.*$gdb_prompt $" {
-            pass $test
-        }
-        -re "warning: can't do that without a running program; try \"break main\", \"run\" first.*$gdb_prompt $" {
-            pass $test
-            set wp_set 0
-            return 1
-        }
-    }
+    gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3.*" "set watchpoint on ival3"
 
     if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] { 
-      return 0
+      return 0
     }
 
 
@@ -101,7 +78,7 @@ proc initialize {} {
     # we get to the first marker function.
 
     if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] { 
-      return 0
+      return 0
     }
 
 
@@ -116,17 +93,13 @@ proc test_simple_watchpoint {} {
     global gdb_prompt
     global hex
     global decimal
-    global wp_set
 
     # Ensure that the watchpoint is disabled when we startup.
 
-    if { $wp_set } {
-        if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { 
-           return 0; 
-       }
+    if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { 
+      return 0
     }
 
-
     # Run until we get to the first marker function.
 
     gdb_run_cmd
@@ -142,34 +115,10 @@ proc test_simple_watchpoint {} {
        return
     }
 
-    if { !$wp_set } {
-       # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint
-       # before running can cause the inferior to croak on HP-UX 11.0
-       # for reasons yet unknown, we've disabled the ability to set 
-       # watches without a running inferior.  The following testpoints used
-       # to be in [initialize].
-       #
-       gdb_test "watch ival3" \
-           "\[Ww\]atchpoint 3: ival3" \
-           "set watchpoint on ival3"
-
-        set wp_set 1
-
-       gdb_test "info watch" \
-           "3\[ \]*.*watchpoint.*ival3" \
-           "watchpoint found in watchpoint/breakpoint table"
-
-       # After installing the watchpoint, we disable it until we are ready
-       # to use it.  This allows the test program to run at full speed until
-       # we get to the first marker function.
-
-       gdb_test "disable 3" "disable 3" "disable watchpoint"
-    }
-
     # After reaching the marker function, enable the watchpoint.
 
     if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { 
-      return ; 
+      return
     }
 
 
@@ -236,7 +185,7 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count
     # Disable the watchpoint so we run at full speed until we exit.
 
     if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] { 
-      return ; 
+      return
     }
 
 
@@ -256,13 +205,12 @@ proc test_disabling_watchpoints {} {
     global decimal
     global hex
 
-    # "info watch" is the same as "info break"
-    gdb_test "info watch" "\[0-9]+\[ \]*.*watchpoint.*ival3\r\n\.*\[0-9\]+ times.*" "watchpoints found in watchpoint/breakpoint table"
+    gdb_test "info watch" "\[0-9]+\[ \]*.*watchpoint.*ival3.*" "watchpoints found in watchpoint/breakpoint table"
 
     # Ensure that the watchpoint is disabled when we startup.
 
     if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] { 
-      return 0
+      return 0
     }
 
 
@@ -284,7 +232,7 @@ proc test_disabling_watchpoints {} {
     # After reaching the marker function, enable the watchpoint.
 
     if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] { 
-      return ; 
+      return
     }
 
 
@@ -299,7 +247,7 @@ proc test_disabling_watchpoints {} {
     # Disable the watchpoint but leave breakpoints
 
     if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in test_disabling_watchpoints" ] { 
-      return 0
+      return 0
     }
 
 
@@ -394,7 +342,7 @@ proc test_watchpoint_triggered_in_syscall {} {
 
     # These tests won't work without printf support.
     if [gdb_skip_stdio_test "watchpoints triggered in syscall"] {
-       return;
+       return
     }
     # Run until we get to the first marker function.
     set x 0
@@ -414,14 +362,14 @@ proc test_watchpoint_triggered_in_syscall {} {
        # to gdb, not the inferior, and we lose.  So that is why we have
        # watchpoint.c prompt us, so we can wait for that prompt.
 
-       send_gdb "continue\n";
+       send_gdb "continue\n"
        gdb_expect {
            -re "Continuing\\.\r\ntype stuff for buf now:" {
                pass "continue to read"
            }
            default {
-               fail "continue to read";
-               return ;
+               fail "continue to read"
+               return
            }
        }
 
@@ -500,8 +448,8 @@ proc test_complex_watchpoint {} {
         gdb_test "break marker6" ".*Breakpoint.*"
         gdb_test "cont" "Continuing.*Breakpoint.*marker6 \\(\\).*" \
             "continue to marker6"
-        gdb_test "break func2" ".*Breakpoint.*"
-        gdb_test "cont" "Continuing.*func2.*"
+       gdb_breakpoint [gdb_get_line_number "func2 breakpoint here"]
+       gdb_continue_to_breakpoint "func2 breakpoint here"
 
         # Test a watch of a single stack-based variable, whose scope
         # is the function we're now in.  This should auto-delete when
@@ -509,9 +457,28 @@ proc test_complex_watchpoint {} {
         #
         gdb_test "watch local_a" ".*\[Ww\]atchpoint \[0-9\]*: local_a" "set local watch"
         gdb_test "cont" "\[Ww\]atchpoint.*local_a.*" "trigger local watch"
-        gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" "self-delete local watch"
 
-        gdb_test "cont" "Continuing.*func2.*"
+       set test "self-delete local watch"
+        gdb_test_multiple "cont" $test {
+           -re "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*\r\n$gdb_prompt $" {
+               pass $test
+           }
+           -re "can't compute CFA for this frame.*\r\n$gdb_prompt $" {
+               global no_hw
+
+               # GCC < 4.5.0 does not get LOCATIONS_VALID set by dwarf2read.c.
+               # Therefore epilogue unwinder gets applied which is
+               # incompatible with dwarf2_frame_cfa.
+               if {$no_hw && ([test_compiler_info {gcc-[0-3]-*}]
+                              || [test_compiler_info {gcc-4-[0-4]-*}])} {
+                   xfail "$test (old GCC has broken watchpoints in epilogues)"
+                   return
+               }
+               fail $test
+           }
+       }
+
+       gdb_continue_to_breakpoint "func2 breakpoint here"
         # We should be in "func2" again now.  Test a watch of an
         # expression which includes both a stack-based local and
         # something whose scope is larger than this invocation
@@ -531,7 +498,7 @@ proc test_complex_watchpoint {} {
         # across any invocations of "func2", it should not auto-
         # delete.
         #
-        gdb_test "cont" "Continuing.*func2.*"
+       gdb_continue_to_breakpoint "func2 breakpoint here"
         gdb_test "watch static_b" ".*\[Ww\]atchpoint \[0-9\]*: static_b" \
                  "set static local watch"
         gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: static_b.*" \
@@ -582,21 +549,16 @@ proc test_complex_watchpoint {} {
 proc test_watchpoint_and_breakpoint {} {
     global gdb_prompt
 
-    # This is a test for PR gdb/38, which involves setting a
+    # This is a test for PR breakpoints/7143, which involves setting a
     # watchpoint right after you've reached a breakpoint.
 
     if [runto func3] then {
        gdb_breakpoint [gdb_get_line_number "second x assignment"]
        gdb_continue_to_breakpoint "second x assignment"
        gdb_test "watch x" ".*atchpoint \[0-9\]+: x"
-       gdb_test_multiple "next" "next after watch x" {
-           -re ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*$gdb_prompt $" {
-               pass "next after watch x"
-           }
-           -re "\[0-9\]+\[\t \]+y = 1;\r\n$gdb_prompt $" {
-               kfail "gdb/38" "next after watch x"
-           }
-       }
+       gdb_test "next" \
+           ".*atchpoint \[0-9\]+: x\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*" \
+           "next after watch x"
 
        gdb_test_no_output "delete \$bpnum" "delete watch x"
     }
@@ -604,6 +566,8 @@ proc test_watchpoint_and_breakpoint {} {
 
 proc test_constant_watchpoint {} {
     gdb_test "watch 5" "Cannot watch constant value `5'." "number is constant"
+    gdb_test "watch (int *)5" "Cannot watch constant value `\\(int \\*\\)5'." \
+    "number with cast is constant"
     gdb_test "watch marker1" "Cannot watch constant value `marker1'." \
     "marker1 is constant"
     gdb_test "watch count + 6" ".*atchpoint \[0-9\]+: count \\+ 6"
@@ -630,9 +594,22 @@ proc test_disable_enable_software_watchpoint {} {
 }
 
 proc test_watch_location {} {
+    global gdb_prompt
+
     gdb_breakpoint [gdb_get_line_number "func5 breakpoint here"]
     gdb_continue_to_breakpoint "func5 breakpoint here"
 
+    # Check first if a null pointer can be dereferenced on the target.
+    gdb_test_multiple "p *nullptr" "" {
+       -re "Cannot access memory at address 0x0.*$gdb_prompt $" {
+           gdb_test "watch -location nullptr->p->x" \
+               "Cannot access memory at address 0x0"
+       }
+       -re ".*$gdb_prompt $" {
+           # Null pointer dereference is legitimate.
+       }
+    }
+
     gdb_test "watch -location *x" "atchpoint .*: .*" "watch -location .x"
 
     gdb_test "continue" \
@@ -645,12 +622,17 @@ proc test_watch_location {} {
 # Tests watching areas larger than a word.
 
 proc test_wide_location_1 {} {
+    global no_hw
+    global gdb_prompt
+
     # 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]
+         || [istarget arm*-*-*]
+         || ([istarget powerpc*-*-*] && ![is_lp64_target])} {
        set hw_expected 0
     } else {
        set hw_expected 1
@@ -666,21 +648,38 @@ proc test_wide_location_1 {} {
            "continue with watch foo2"
     } else {
        gdb_test "watch foo2" "atchpoint .*: .*" "watch foo2"
-       gdb_test "continue" \
-           "Continuing.*\[Ww\]atchpoint .*: .*New value = \\\{val = \\\{0, 11\\\}\\\}.*" \
-           "continue with watch foo2"
+       set test "continue with watch foo2"
+       gdb_test_multiple "cont" $test {
+           -re "Continuing.*\[Ww\]atchpoint .*: .*New value = \\\{val = \\\{0, 11\\\}\\\}.*$gdb_prompt $" {
+               pass $test
+           }
+           -re "Could not insert hardware breakpoints:.*You may have requested too many hardware breakpoints/watchpoints.*$gdb_prompt $" {
+               # This may happen with remote targets that support
+               # hardware watchpoints.  We only find out the
+               # watchpoint was too large, for example, at insert
+               # time.  If GDB is ever adjusted to downgrade the
+               # watchpoint automatically in this case, this match
+               # should be removed.
+               pass $test
+           }
+       }
     }
 
     gdb_test_no_output "delete \$bpnum" "delete watch foo2"
 }
 
 proc test_wide_location_2 {} {
+    global no_hw
+    global gdb_prompt
+
     # 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]
+         || [istarget arm*-*-*]
+         || [istarget powerpc*-*-*]} {
        set hw_expected 0
     } else {
        set hw_expected 1
@@ -696,9 +695,21 @@ proc test_wide_location_2 {} {
            "continue with watch foo4"
     } else {
        gdb_test "watch foo4" "atchpoint .*: .*" "watch foo4"
-       gdb_test "continue" \
-           "Continuing.*\[Ww\]atchpoint .*: .*New value = \\\{val = \\\{0, 0, 0, 33\\\}\\\}.*" \
-           "continue with watch foo4"
+       set test "continue with watch foo4"
+       gdb_test_multiple "cont" $test {
+           -re "Continuing.*\[Ww\]atchpoint .*: .*New value = \\\{val = \\\{0, 0, 0, 33\\\}\\\}.*$gdb_prompt $" {
+               pass $test
+           }
+           -re "Could not insert hardware breakpoints:.*You may have requested too many hardware breakpoints/watchpoints.*$gdb_prompt $" {
+               # This may happen with remote targets that support
+               # hardware watchpoints.  We only find out the
+               # watchpoint was too large, for example, at insert
+               # time.  If GDB is ever adjusted to downgrade the
+               # watchpoint automatically in this case, this match
+               # should be removed.
+               pass $test
+           }
+       }
     }
 
     gdb_test_no_output "delete \$bpnum" "delete watch foo4"
@@ -780,91 +791,11 @@ proc test_inaccessible_watchpoint {} {
        gdb_test_no_output "delete \$global_ptr_ptr_breakpoint_number"
     }
 }
-    
-proc test_watchpoint_in_big_blob {} {
-    global gdb_prompt
-
-    gdb_test "watch buf" ".*atchpoint \[0-9\]+: buf"
-    gdb_test "cont" "Continuing.*atchpoint \[0-9\]+: buf\r\n\r\nOld value = .*testte\".*" "watchpoint on buf hit"
-
-    gdb_test_no_output "delete \$bpnum" "delete watch buf"
-}
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
-set prev_timeout $timeout
-set timeout 600        
-verbose "Timeout now 600 sec.\n"
-
-if [initialize] then {
-
-    test_simple_watchpoint
-
-    # The IDT/sim monitor only has 8 (!) open files, of which it uses
-    # 4 (!).  So we have to make sure one program exits before
-    # starting another one.
-    if [istarget "mips-idt-*"] then {
-       gdb_exit
-       gdb_start
-       gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $binfile
-       initialize
-    }
-
-    test_disabling_watchpoints
-
-    # See above.
-    if [istarget "mips-idt-*"] then {
-       gdb_exit
-       gdb_start
-       gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $binfile
-       initialize
-    }
-
-    if ![target_info exists gdb,cannot_call_functions] {
-       test_stepping
 
-       # See above.
-       if [istarget "mips-idt-*"] then {
-           gdb_exit
-           gdb_start
-           gdb_reinitialize_dir $srcdir/$subdir
-           gdb_load $binfile
-           initialize
-       }
-    }
+proc test_no_hw_watchpoints {} {
+    global testfile
 
-    # 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 
-    # breakpoint before stopping for the watchpoint.  I don't know why.
-    if {[istarget "hppa*-*-*"]} then {
-       test_watchpoint_triggered_in_syscall
-    }
-
-    # See above.
-    if [istarget "mips-idt-*"] then {
-       gdb_exit
-       gdb_start
-       gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $binfile
-       initialize
-    }
-
-    # Only enabled for some targets merely because it has not been tested 
-    # elsewhere.
-    if {[istarget "hppa*-*-*"] || \
-           [istarget "sparc*-*-sunos*"] || \
-           [istarget "m32r-*-*"]} then {
-       test_complex_watchpoint
-    }
-
-    test_inaccessible_watchpoint
+    clean_restart $testfile
 
     # Verify that a user can force GDB to use "slow" watchpoints.
     # (This proves rather little on kernels that don't support
@@ -886,60 +817,167 @@ if [initialize] then {
        "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*" \
        "trigger slow conditional watch"
 
+    gdb_test_no_output "delete \$bpnum" "delete watch ival3"
+
+    gdb_test "watch ival3 if  count > 1  thread 1 " \
+         "Watchpoint \[0-9\]*: ival3.*" \
+         "set slow condition watch w/thread"
+
+    gdb_test_no_output "delete \$bpnum" "delete watch w/condition and thread"
+
     # 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..*" \
+       "Can't set read/access watchpoint when hardware watchpoints are disabled." \
        "rwatch disallowed when can-set-hw-watchpoints cleared"
+    gdb_test "awatch ival3" \
+       "Can't set read/access watchpoint when hardware watchpoints are disabled." \
+       "awatch disallowed when can-set-hw-watchpoints cleared"
 
-    # Read- and access watchpoints are unsupported on HP-UX.  Verify
-    # that GDB gracefully responds to requests to create them.
-    #
-    if [istarget "hppa*-*-hpux*"] then {
-       gdb_test_no_output "set can-use-hw-watchpoints 1" \
-           "enable fast watches"
 
-       gdb_test "rwatch ival3" \
-           "Target does not have this type of hardware watchpoint support.*" \
-           "read watches disallowed"
+    # 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
+
+    # On native targets where we do hardware resource accounting, this
+    # may end up as a software watchpoint.
+    set ok 0
+    set test "watch buf"
+    gdb_test_multiple "watch buf" $test {
+       -re "Hardware watchpoint \[0-9\]+: buf.*You may have requested too many hardware breakpoints/watchpoints.*$gdb_prompt $" {
+           # This may happen with remote targets (where we don't do
+           # resource accounting) that support hardware watchpoints,
+           # when breakpoint always-inserted is on.  The watchpoint
+           # was too large, for example.  If GDB is ever adjusted to
+           # downgrade the watchpoint automatically in this case,
+           # this match should be removed.  Note the breakpoint has
+           # been created, and is in the list, so it needs deleting.
+           pass $test
+       }
+       -re ".*atchpoint \[0-9\]+: buf.*$gdb_prompt $" {
+           pass $test
+           set ok 1
+       }
+    }
 
-       gdb_test "awatch ival3" \
-           "Target does not have this type of hardware watchpoint support.*" \
-            "access watches disallowed"
+    if { $ok } {
+       set test "watchpoint on buf hit"
+       gdb_test_multiple "cont" $test {
+           -re "Continuing.*atchpoint \[0-9\]+: buf\r\n\r\nOld value = .*testte\".*$gdb_prompt $" {
+               pass $test
+           }
+           -re "Could not insert hardware breakpoints:.*You may have requested too many hardware breakpoints/watchpoints.*$gdb_prompt $" {
+               # This may happen with remote targets that support
+               # hardware watchpoints.  We only find out the
+               # watchpoint was too large, for example, at insert
+               # time.  If GDB is ever adjusted to downgrade the
+               # watchpoint automatically in this case, this match
+               # should be removed.
+               pass $test
+           }
+       }
     }
 
-    # See above.
-    if [istarget "mips-idt-*"] then {
-       gdb_exit
-       gdb_start
-       gdb_reinitialize_dir $srcdir/$subdir
-       gdb_load $binfile
-       initialize
+    gdb_test_no_output "delete \$bpnum" "delete watch buf"
+}
+
+proc test_watch_register_location {} {
+    global no_hw
+
+    if {!$no_hw && ![target_info exists gdb,no_hardware_watchpoints]} {
+       # Non-memory read/access watchpoints are not supported, they would
+       # require software read/access watchpoint support (which is not
+       # currently available).
+       gdb_test "rwatch \$pc" \
+           "Expression cannot be implemented with read/access watchpoint..*" \
+           "rwatch disallowed for register based expression"
+       gdb_test "awatch \$pc" \
+           "Expression cannot be implemented with read/access watchpoint..*" \
+           "awatch disallowed for register based expression"
     }
+}
 
-    test_watchpoint_and_breakpoint
+# Start with a fresh gdb.
 
-    test_watchpoint_in_big_blob
+set prev_timeout $timeout
+set timeout 600        
+verbose "Timeout now 600 sec.\n"
+
+test_no_hw_watchpoints
+
+proc do_tests {} {
+    global testfile
+    global no_hw
+
+    clean_restart $testfile
+
+    if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} {
+       gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+    }
+
+    if [initialize] then {
+
+       test_simple_watchpoint
+
+       test_disabling_watchpoints
 
-    # See above.
-    if [istarget "mips-idt-*"] then {
-       clean_restart
+       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 || [target_info exists gdb,no_hardware_watchpoints]} {
+       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 
+    # breakpoint before stopping for the watchpoint.  I don't know why.
+    if {[istarget "hppa*-*-*"]} then {
+       test_watchpoint_triggered_in_syscall
     }
 
+    test_complex_watchpoint
+
+    test_inaccessible_watchpoint
+
+    test_watchpoint_and_breakpoint
+
+    test_watchpoint_in_big_blob
+
     test_constant_watchpoint
 
     test_disable_enable_software_watchpoint
 
     test_watch_location
 
-    # 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_wide_location_1
     test_wide_location_2
+
+    test_watch_register_location
+}
+
+# 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] {
+    with_test_prefix "no-hw" {
+       set no_hw 1
+       do_tests
+    }
 }
 
 # Restore old timeout
This page took 0.033294 seconds and 4 git commands to generate.