public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support.
@ 2022-10-18 15:26 Carl Love
  0 siblings, 0 replies; only message in thread
From: Carl Love @ 2022-10-18 15:26 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f760c4f2999946dcc4936873a89cf2c24edc5e9b

commit f760c4f2999946dcc4936873a89cf2c24edc5e9b
Author: Carl Love <cel@us.ibm.com>
Date:   Tue Oct 18 11:25:36 2022 -0400

    Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support.
    
    The hardware watchpoint check has been updated in a couple of recent
    patches.  This patch updates the hardware watchpoint test in the remaining
    gdb tests.
    
    The issue is the PowerPC processors support hardware watchpoints with the
    exception of Power 9. The hardware watchpoint support is disabled on
    Power 9.  The test skip_hw_watchpoint_tests must be used to correctly
    determine if the PowerPC processor supports hardware watchpoints.
    
    This patch fixes 6 test failures in test gdb.threads/watchpoint-fork.exp.
    
    Test gdb.base/watch-vfork.exp runs with can-use-hw-watchpoints set to
    true and false.  When the test is run with can-use-hw-watchpoints set to
    true, gdb just falls back to using software watchpoints.  The
    patch reduces the number of expected passes by 2 since because it now
    only runs once with can-use-hw-watchpoints set to false.
    
    Test gdb.mi/mi-watch.exp runs the test with argument hw and sw.  If the
    argument is hw and hardware watchpoints are not supported the test exits.
    The number of expected passes is cut in half with the patch as it now only
    runs the test using software breakpoints.  Previously the pass to use
    hardware watchpoints was not skipped and the test actually ran using
    software watchpoints.
    
    The following tests run the same with and without the patch.  The tests
    are supposed to execute the gdb command "set can-use-hw-watchpoints 0" if
    the processor does not support hardware bwatchpoints.  However the command
    was not being executed and gdb was falling back to using software
    watchpoints since the Power 9 watchpoint resource check fails.  With the
    patch, the tests now execute the command and the test runs using software
    watchpoints as it did previously.  The tests are:
    
    gdb.base/commands.exp
    gdb.base/cond-eval-mode.exp
    gdb.base/display.exp
    gdb.base/gdb11531.exp
    gdb.base/recurse.exp
    gdb.base/value-double-free.exp
    gdb.base/watch-bitfields.exp
    gdb.base/watch-cond-infcall.exp
    gdb.base/watch-cond.exp
    gdb.base/watchpoint-solib.exp
    gdb.base/watchpoints.exp
    
    The following two tests are not supported on the Power 9 system used to
    test the changes.  The patch does not change the tests results for these
    tests:
    
    gdb.python/py-breakpoint.exp
    gdb.mi/mi-watch-nonstop.exp

Diff:
---
 gdb/testsuite/gdb.base/commands.exp           | 11 ++++++++++-
 gdb/testsuite/gdb.base/cond-eval-mode.exp     | 11 ++++++++++-
 gdb/testsuite/gdb.base/display.exp            | 11 ++++++++++-
 gdb/testsuite/gdb.base/gdb11531.exp           |  9 ++++++++-
 gdb/testsuite/gdb.base/recurse.exp            | 13 +++++++++++--
 gdb/testsuite/gdb.base/value-double-free.exp  | 10 +++++++++-
 gdb/testsuite/gdb.base/watch-bitfields.exp    | 13 +++++++++++--
 gdb/testsuite/gdb.base/watch-cond-infcall.exp | 10 +++++++++-
 gdb/testsuite/gdb.base/watch-cond.exp         | 14 +++++++++++---
 gdb/testsuite/gdb.base/watch-vfork.exp        |  2 +-
 gdb/testsuite/gdb.base/watchpoint-solib.exp   | 11 ++++++++++-
 gdb/testsuite/gdb.base/watchpoints.exp        | 10 +++++++++-
 gdb/testsuite/gdb.mi/mi-watch-nonstop.exp     |  2 +-
 gdb/testsuite/gdb.mi/mi-watch.exp             | 11 ++++++++++-
 gdb/testsuite/gdb.python/py-breakpoint.exp    | 15 ++++++++++++---
 gdb/testsuite/gdb.threads/watchpoint-fork.exp | 13 +++++++++++--
 16 files changed, 143 insertions(+), 23 deletions(-)

diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 3eb4463cd1a..933978c0ea1 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -17,6 +17,14 @@
 # test special commands (if, while, etc)
 #
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 standard_testfile
 
 if { [prepare_for_testing "failed to prepare" commands run.c {debug additional_flags=-DFAKEARGV}] } {
@@ -542,9 +550,10 @@ proc_with_prefix user_defined_command_manyargs_test {} {
 
 proc_with_prefix watchpoint_command_test {} {
     global gdb_prompt
+    global skip_hw_watchpoint_tests_p
 
     # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
+    if {$skip_hw_watchpoint_tests_p} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
diff --git a/gdb/testsuite/gdb.base/cond-eval-mode.exp b/gdb/testsuite/gdb.base/cond-eval-mode.exp
index 2c3779536c6..f6e8b3e71b2 100644
--- a/gdb/testsuite/gdb.base/cond-eval-mode.exp
+++ b/gdb/testsuite/gdb.base/cond-eval-mode.exp
@@ -15,6 +15,14 @@
 
 # Test 'set breakpoint condition-evaluation' settings
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 standard_testfile
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
@@ -111,9 +119,10 @@ proc test_break { break_command } {
 #
 proc test_watch { watch_command } {
     global gdb_prompt
+    global skip_hw_watchpoint_tests_p
 
     with_test_prefix "$watch_command" {
-	if [target_info exists gdb,no_hardware_watchpoints] {
+	if {$skip_hw_watchpoint_tests_p} {
 	    unsupported "no target support"
 	    return
 	}
diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
index f94cd13da5f..b26c08433b8 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -16,6 +16,15 @@
 # display.exp   Test display commands
 #               Also do some printing stuff for coverage's sake.
 #
+
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 standard_testfile
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
@@ -56,7 +65,7 @@ if ![runto_main] then {
 }
 
 # Disable hardware watchpoints if necessary.
-if [target_info exists gdb,no_hardware_watchpoints] {
+if {$skip_hw_watchpoint_tests_p} {
     gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
diff --git a/gdb/testsuite/gdb.base/gdb11531.exp b/gdb/testsuite/gdb.base/gdb11531.exp
index 8ce51c19bdc..4520a0dc125 100644
--- a/gdb/testsuite/gdb.base/gdb11531.exp
+++ b/gdb/testsuite/gdb.base/gdb11531.exp
@@ -19,6 +19,13 @@
 # This is a problem related to CANNOT_STEP_HW_WATCHPOINTS macro.
 # It affects Solaris native targets.
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
 
 standard_testfile
 
@@ -27,7 +34,7 @@ if { [prepare_for_testing "failed to prepare" $testfile $testfile.c {debug}] } {
 }
 
 # Disable hardware watchpoints if necessary.
-if [target_info exists gdb,no_hardware_watchpoints] {
+if {$skip_hw_watchpoint_tests_p} {
    gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
diff --git a/gdb/testsuite/gdb.base/recurse.exp b/gdb/testsuite/gdb.base/recurse.exp
index 4afc61ed12c..681cdb52a84 100644
--- a/gdb/testsuite/gdb.base/recurse.exp
+++ b/gdb/testsuite/gdb.base/recurse.exp
@@ -15,6 +15,13 @@
 
 # This file was written by Jeff Law. (law@cs.utah.edu)
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
 
 standard_testfile
 
@@ -25,8 +32,10 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 proc recurse_tests {} {
 
     # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
-	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
+    global skip_hw_watchpoint_tests_p
+
+    if {$skip_hw_watchpoint_tests_p} {
+	 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
     if [runto recurse] then {
diff --git a/gdb/testsuite/gdb.base/value-double-free.exp b/gdb/testsuite/gdb.base/value-double-free.exp
index 894ceebb2ae..e1b8b2eb9c7 100644
--- a/gdb/testsuite/gdb.base/value-double-free.exp
+++ b/gdb/testsuite/gdb.base/value-double-free.exp
@@ -13,6 +13,14 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 standard_testfile
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
@@ -24,7 +32,7 @@ if ![runto_main] {
 }
 
 # Disable hardware watchpoints if necessary.
-if [target_info exists gdb,no_hardware_watchpoints] {
+if {$skip_hw_watchpoint_tests_p} {
     gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
diff --git a/gdb/testsuite/gdb.base/watch-bitfields.exp b/gdb/testsuite/gdb.base/watch-bitfields.exp
index 91f68ae9ce6..afdfc5a9d89 100644
--- a/gdb/testsuite/gdb.base/watch-bitfields.exp
+++ b/gdb/testsuite/gdb.base/watch-bitfields.exp
@@ -15,6 +15,15 @@
 
 # This file is part of the gdb testsuite
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+# Disable hardware watchpoints if the target does not support them.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 standard_testfile
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
@@ -92,8 +101,8 @@ proc test_regular_watch {} {
 }
 
 # Disable hardware watchpoints if the target does not support them.
-if [target_info exists gdb,no_hardware_watchpoints] {
-    gdb_test_no_output "set can-use-hw-watchpoints 0"
+if {$skip_hw_watchpoint_tests_p} {
+    gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
 test_watch_location
diff --git a/gdb/testsuite/gdb.base/watch-cond-infcall.exp b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
index 42c73d1a504..5dc0ebc2bb4 100644
--- a/gdb/testsuite/gdb.base/watch-cond-infcall.exp
+++ b/gdb/testsuite/gdb.base/watch-cond-infcall.exp
@@ -16,6 +16,14 @@
 # Test for watchpoints with conditions that involve inferior function
 # calls.
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 standard_testfile
 
 if [target_info exists gdb,cannot_call_functions] {
@@ -49,7 +57,7 @@ proc test_watchpoint { hw } {
 	"atchpoint \[0-9\]+: var\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*watchpoint-stop.*"
 }
 
-if { ![target_info exists gdb,no_hardware_watchpoints] } {
+if { !$skip_hw_watchpoint_tests_p } {
     with_test_prefix "hw" { test_watchpoint 1 }
 }
 
diff --git a/gdb/testsuite/gdb.base/watch-cond.exp b/gdb/testsuite/gdb.base/watch-cond.exp
index 3ee94a14416..18fabfc69c9 100644
--- a/gdb/testsuite/gdb.base/watch-cond.exp
+++ b/gdb/testsuite/gdb.base/watch-cond.exp
@@ -17,6 +17,14 @@
 # Tests involving watchpoint conditions with local expressions.
 #
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 standard_testfile .c
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
@@ -24,7 +32,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 }
 
 # Disable hardware watchpoints if necessary.
-if [target_info exists gdb,no_hardware_watchpoints] {
+if {$skip_hw_watchpoint_tests_p} {
     gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
@@ -43,7 +51,7 @@ gdb_test "continue" \
 clean_restart ${testfile}
 
 # Disable hardware watchpoints if necessary.
-if [target_info exists gdb,no_hardware_watchpoints] {
+if {$skip_hw_watchpoint_tests_p} {
     gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
@@ -62,7 +70,7 @@ gdb_test "continue" \
 clean_restart ${testfile}
 
 # Disable hardware watchpoints if necessary.
-if [target_info exists gdb,no_hardware_watchpoints] {
+if {$skip_hw_watchpoint_tests_p} {
     gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
diff --git a/gdb/testsuite/gdb.base/watch-vfork.exp b/gdb/testsuite/gdb.base/watch-vfork.exp
index 38ec4de1eff..0ba5af021a8 100644
--- a/gdb/testsuite/gdb.base/watch-vfork.exp
+++ b/gdb/testsuite/gdb.base/watch-vfork.exp
@@ -44,7 +44,7 @@ proc test_watchpoint_across_vfork { hw teststr } {
 	"Watchpoint triggers after vfork ($teststr)"
 }
 
-if { ![target_info exists gdb,no_hardware_watchpoints] } {
+if { ![skip_hw_watchpoint_tests] } {
     test_watchpoint_across_vfork 1 "hw"
 }
 
diff --git a/gdb/testsuite/gdb.base/watchpoint-solib.exp b/gdb/testsuite/gdb.base/watchpoint-solib.exp
index aa4cf0d7adb..a3fb5041294 100644
--- a/gdb/testsuite/gdb.base/watchpoint-solib.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-solib.exp
@@ -13,10 +13,19 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 #
 # test running programs
 #
 
+
 if {[skip_shlib_tests]} {
     return 0
 }
@@ -53,7 +62,7 @@ gdb_load_shlib $lib_sl
 runto_main
 
 # Disable hardware watchpoints if necessary.
-if [target_info exists gdb,no_hardware_watchpoints] {
+if {$skip_hw_watchpoint_tests_p} {
     gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 }
 
diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp
index 767157ee593..073f6c24c54 100644
--- a/gdb/testsuite/gdb.base/watchpoints.exp
+++ b/gdb/testsuite/gdb.base/watchpoints.exp
@@ -15,6 +15,14 @@
 
 # This file was written by Pierre Muller. (muller@ics.u-strasbg.fr)
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 
 standard_testfile
 
@@ -48,7 +56,7 @@ with_test_prefix "before inferior start" {
     clean_restart ${binfile}
 
     # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
+    if {$skip_hw_watchpoint_tests_p} {
         gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
diff --git a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
index b132d90353d..9648d7ee41c 100644
--- a/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if [target_info exists gdb,no_hardware_watchpoints] {
+if [skip_hw_watchpoint_tests] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index 1f1f9430506..1211fd55f03 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -20,6 +20,14 @@
 # The goal is not to test gdb functionality, which is done by other
 # tests, but to verify the correct output response to MI operations.
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
@@ -138,8 +146,9 @@ proc test_watchpoint_all {mi_mode type} {
     upvar srcdir srcdir
     upvar subdir subdir
     upvar binfile binfile
+    global skip_hw_watchpoint_tests_p
 
-    if {$type == "hw" && [target_info exists gdb,no_hardware_watchpoints] } {
+    if {$type == "hw" && $skip_hw_watchpoint_tests_p } {
 	return
     }
 
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 583408e10af..0451562f09b 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -16,6 +16,14 @@
 # This file is part of the GDB testsuite.  It tests the mechanism
 # exposing breakpoints to Python.
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 load_lib gdb-python.exp
 
 standard_testfile
@@ -275,12 +283,13 @@ proc_with_prefix test_hardware_breakpoints { } {
 
 proc_with_prefix test_watchpoints { } {
     global srcfile testfile hex decimal
+    global skip_hw_watchpoint_tests_p
 
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
     # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
+    if {$skip_hw_watchpoint_tests_p} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
@@ -303,7 +312,7 @@ proc_with_prefix test_bkpt_internal { } {
     clean_restart ${testfile}
 
     # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
+    if {$skip_hw_watchpoint_tests_p} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
     if ![runto_main] then {
@@ -350,7 +359,7 @@ proc_with_prefix test_bkpt_eval_funcs { } {
     clean_restart ${testfile}
 
     # Disable hardware watchpoints if necessary.
-    if [target_info exists gdb,no_hardware_watchpoints] {
+    if {$skip_hw_watchpoint_tests_p} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
     if ![runto_main] then {
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
index 0ee78ae9343..d3547496d1d 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
@@ -15,12 +15,21 @@
 
 # Test case for forgotten hw-watchpoints after fork()-off of a process.
 
+# The skip_hw_watchpoint_tests checks if watchpoints are supported by the
+# processor.  On PowerPC, the check runs a small test program under gdb
+# to determine if the Power processor supports HW watchpoints.  The check
+# must be done before starting the test so as to not disrupt the execution
+# of the actual test.
+
+set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests]
+
 set testfile watchpoint-fork
 
 # Set DEBUG to 0 or 1 in sources
 set debug 0
 
 proc test {type symbol} {
+    global skip_hw_watchpoint_tests_p
     global debug
     with_test_prefix "$type" {
 	global testfile subdir srcdir gdb_prompt
@@ -41,7 +50,7 @@ proc test {type symbol} {
 
 	    clean_restart $executable
 
-	    if [target_info exists gdb,no_hardware_watchpoints] {
+	    if {$skip_hw_watchpoint_tests_p} {
 		# The software watchpoint functionality is in GDB an unrelated test.
 		gdb_test_no_output "set can-use-hw-watchpoints 0"
 		# Software watchpoints can be quite slow on remote targets
@@ -93,7 +102,7 @@ proc test {type symbol} {
 
 	# threads
 
-	if [target_info exists gdb,no_hardware_watchpoints] {
+	if {$skip_hw_watchpoint_tests_p} {
 	    # Watchpoint hits would get detected in unexpected threads.
 	    return
 	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-18 15:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 15:26 [binutils-gdb] Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support Carl Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).