From patchwork Fri Oct 14 16:12:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 58843 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9488638582A0 for ; Fri, 14 Oct 2022 16:13:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9488638582A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665764008; bh=XtPcWmBj+p/ZRCUWaaomrE+VAkp0XHGKJSc2cFrT0Vw=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=UKfC7osG4AevWFWVv6Q1qGQvk1htJL6MPfOybEhLRkGg17Zh7PYaXanIWKpJgEnXt CQpCCM5de1VjfOXG0K9PBCGPC+w0/PNbB4YVOkUA0hw90RfaD9X0+HQnXYV++XY2v0 O8OeUh9AFQJiFPM3lOCu8XmZciTELthzvR0X2qg4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 93CBF3858C53 for ; Fri, 14 Oct 2022 16:13:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 93CBF3858C53 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29EFI5nK017131 for ; Fri, 14 Oct 2022 16:13:02 GMT Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3k78xxcryv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 14 Oct 2022 16:13:01 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29EG5RcK008057 for ; Fri, 14 Oct 2022 16:13:01 GMT Received: from b01cxnp22033.gho.pok.ibm.com (b01cxnp22033.gho.pok.ibm.com [9.57.198.23]) by ppma02wdc.us.ibm.com with ESMTP id 3k30uaq3u5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 14 Oct 2022 16:13:01 +0000 Received: from smtpav03.wdc07v.mail.ibm.com ([9.208.128.112]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29EGD0v86226644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 16:13:00 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2094C58058; Fri, 14 Oct 2022 16:13:00 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CF4958062; Fri, 14 Oct 2022 16:12:59 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.71.228]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 14 Oct 2022 16:12:59 +0000 (GMT) Message-ID: Subject: [PATCH] Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support. To: "gdb-patches@sourceware.org" , Ulrich Weigand Date: Fri, 14 Oct 2022 09:12:58 -0700 X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3ar2kp3G7J_sHIw-1X-a0TB7nli1iw4B X-Proofpoint-GUID: 3ar2kp3G7J_sHIw-1X-a0TB7nli1iw4B X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_08,2022-10-14_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 impostorscore=0 bulkscore=0 phishscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140086 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Carl Love via Gdb-patches From: Carl Love Reply-To: Carl Love Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" GDB maintainers: The following patch changes the hardware watchpoint check from [target_info exists gdb,no_hardware_watchpoints] to the check [skip_hw_watchpoint_tests] in all of the gdb tests that have not already been updated. The skip_hw_watchpoint_tests does additional checking on PowerPC to verify if the PowerPC processor supports hardware watchpoints. The issue is hardware watchpoints are disabled on Power 9 but not on the other processor versions. The patch has been tested on Power 9. The patch fixes failures in a few tests while other tests still run similarly. Some of the tests where checking if the the processor supported hardware watchpoints, if not the test was supposed to execute the command "set can-use-hw- watchpoints 0". However since the hardware watchpoint test failed the command was not executed. In these tests, gdb was using software watchpoints anyway because the processor hardware resource checking for Power 9 indicated that there were no resources available. Thus this patch only results in the command being executed but the rest of the test executes the same as before. The patch has also been tested on Power 10 and X86-64 to verify no additional regression test failures are introduced. Please let me know if this patch is acceptable for mainline. Thanks. Carl Love ----------------------------------- 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 --- 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 . +# 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 . +# 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 . -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 }