From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id A92793857B81 for ; Wed, 10 Aug 2022 00:00:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A92793857B81 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 279Mu3Wo021715 for ; Wed, 10 Aug 2022 00:00:20 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hv0tgha0a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Aug 2022 00:00:19 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 279Npswj019929 for ; Wed, 10 Aug 2022 00:00:19 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma04dal.us.ibm.com with ESMTP id 3huwvw1en0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Aug 2022 00:00:19 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27A00I7q38797684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Aug 2022 00:00:18 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5DFEFAC062; Wed, 10 Aug 2022 00:00:18 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C61BDAC067; Wed, 10 Aug 2022 00:00:17 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.44.164]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 10 Aug 2022 00:00:17 +0000 (GMT) Message-ID: <3783e7e44fe188af5ca1f2ddcfa4c7f5cb7a818e.camel@us.ibm.com> Subject: [PATCH] Fix hardware watchpoint check in test gdb.base/watchpoint-reuse-slot.exp From: Carl Love To: "gdb-patches@sourceware.org" , Ulrich Weigand Date: Tue, 09 Aug 2022 17:00:17 -0700 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: VIFqf5rq2Wwj3GTo5MftiGiPbRR3fLT5 X-Proofpoint-ORIG-GUID: VIFqf5rq2Wwj3GTo5MftiGiPbRR3fLT5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-09_05,2022-08-09_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208090087 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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-List-Received-Date: Wed, 10 Aug 2022 00:00:28 -0000 GDB maintainers: The gdb.base/watchpoint-reuse-slot.exp uses the check: if { ![target_info exists gdb,no_hardware_watchpoints]} to determine if the test should be re-run with HW watchpoints. The test is TRUE on Power 9 however Power 9 does not support HW watchpoints. Not all PowerPC processors support HW watchpoints. The test needs to use the skip_hw_watchpoint_access_tests test to correctly determine if the processor supports HW watchpoints. The skip_hw_watchpoint_access_tests starts a small gdb test on the platform to determine if the processor supports HW watchpoints or not. Thus the check must be done before the actual test is run to ensure the HW watchpoint check does not mess up the actual test. This patch replaces the [target_info exists gdb, no_hardware_watchpoints] with the skip_hw_watchpoint_access_tests before starting the watchpoint-reuse-slot.exp test. The fix disables the HW watchpoint tests on Power 9 thus eliminating 48 testsuite failures. The patch has been tested on Power 9, Power 10 and x86-64 Please let me know if this patch is acceptable for mainline. Thanks. Carl Love -------------------------------------------------------- [PATCH] Fix hardware watchpoint check in test gdb.base/watchpoint-reuse-slot.exp This test generates 48 failures on Power 9 when testing with HW watchpoints enabled. Note Power 9 does not support HW watchpoints. Not all PowerPC processors support HW watchpoints. Add the skip_hw_watchpoint_access_tests to determine if the processor supports HW watchpoints. Note this proceedure runs a small test on PowerPC under gdb to determine if the processor supports HW watchpoints. Thus the check must be done before the actual test to prevent disrupting the actual test. This patch was tested on Power 9, Power 10 and X86-64 with no regressions. --- gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp index e2ea137424b..829252a65b4 100644 --- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp +++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp @@ -22,6 +22,18 @@ # operation. (Note that we don't have any of these watchpoints # trigger.) +# The skip_hw_watchpoint_tests checks if watchpoints are supported by the +# processor. Not all PowerPC proceesors support HW watchpoints. The +# skip_hw_watchpoint_access_tests starts GDB on a small test program to +# dynamically check if HW watchpoints are supported. We do not want to +# restart GDB after this test script has itself started GDB, so call +# skip_hw_watchpoint_tests first and save the result for use later. +if {[skip_hw_watchpoint_access_tests]} { + set supports_hw_wp 0 +} else { + set supports_hw_wp 1 +} + standard_testfile if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { @@ -285,7 +297,7 @@ proc setup_and_run_watchpoints_tests { hw_wp_p } { # Run tests with hardware watchpoints disabled, then again with them # enabled (if this target supports hardware watchpoints). -if { ![target_info exists gdb,no_hardware_watchpoints]} { +if { $supports_hw_wp } { # Run test with H/W enabled. setup_and_run_watchpoints_tests 1 } -- 2.31.1