From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 6BB2138560A4 for ; Wed, 12 Oct 2022 18:54:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6BB2138560A4 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29CIgjb5015688 for ; Wed, 12 Oct 2022 18:54:20 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3k633rg8r6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Oct 2022 18:54:20 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 29CIpYCA004369 for ; Wed, 12 Oct 2022 18:54:19 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma03wdc.us.ibm.com with ESMTP id 3k30ua326a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Oct 2022 18:54:19 +0000 Received: from smtpav01.dal12v.mail.ibm.com ([9.208.128.133]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 29CIsJcx49611034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Oct 2022 18:54:19 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A47358058; Wed, 12 Oct 2022 18:54:18 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B80958057; Wed, 12 Oct 2022 18:54:17 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.71.228]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 12 Oct 2022 18:54:17 +0000 (GMT) Message-ID: <24077e89ec5074e3cac48b1d99d17102f23136c6.camel@us.ibm.com> Subject: [PATCH] PowerPC, fix gdb.base/watchpoint.exp on Power 9 From: Carl Love To: "gdb-patches@sourceware.org" , Ulrich Weigand Date: Wed, 12 Oct 2022 11:54: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-ORIG-GUID: QdYYau1rold1fsuph6uM9BWU-l5JlNgy X-Proofpoint-GUID: QdYYau1rold1fsuph6uM9BWU-l5JlNgy 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-12_09,2022-10-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxlogscore=367 impostorscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210120119 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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-List-Received-Date: Wed, 12 Oct 2022 18:54:23 -0000 GDB maintainers: The gdb.base/watchpoint.exp test uses the check [target_info exists gdb,no_hardware_watchpoints] to determine if the processor supports hardware watchpoints or not. The various PowerPC processors support hardware watchpoints except on Power 9 where they are disabled. The test skip_hw_watchpoint_tests must be used to correctly determine if the PowerPC processor supports hardware watchpoints or not. This patch updates the test to determine if the processor supports hardware breakpoints or not. The patch has been tested on X86-64 with no regressions. The patch was tested on Power 9 to ensure the test only runs without hardware watchpoints enabled. On Power 8 and 10, the test runs but still reports errors due to an internal GDB issue that is not properly checking the resource availability. This issue will be addressed in a future patch. Please let me know if this patch is acceptable for GDB mainline. Thanks. Carl Love ----------------------------------------- PowerPC, fix gdb.base/watchpoint.exp on Power 9 Test gdb.base/watchpoint.exp generates 4 test errors on Power 9. The test uses the test [target_info exists gdb,no_hardware_watchpoints] to determine if the processor supports hardware watchpoints. The check only examines the processor type to determine if it supports hardware watchpoints. 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 replaces the [target_info exists gdb,no_hardware_watchpoints] with the skip_hw_watchpoint_tests_p check. With the patch, the test runs on Power 9 with hardware watchpoint force-disabled. The test runs on all other PowerPC processors with and without hardware watchpoints enabled. The patch has been tested on Power 9 to verify the test only runs with hardware breakpoints disabled. The patch has been tested on X86-64 with no regression failures. The test fails on Power 8 and Power 10 due to an internal GDB error due to resource management. The resource management issue will be addressed in another patch. --- gdb/testsuite/gdb.base/watchpoint.exp | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 01abff5336a..736a0f905e5 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -15,6 +15,13 @@ # This file was written by Fred Fish. (fnf@cygnus.com) +# 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 @@ -624,13 +631,14 @@ proc test_watch_location {} { proc test_wide_location_1 {} { global no_hw global gdb_prompt + global skip_hw_watchpoint_tests_p # 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 { $no_hw || [target_info exists gdb,no_hardware_watchpoints] + if { $no_hw || $skip_hw_watchpoint_tests_p || [istarget arm*-*-*] || ([istarget powerpc*-*-*] && ![is_lp64_target])} { set hw_expected 0 @@ -671,13 +679,14 @@ proc test_wide_location_1 {} { proc test_wide_location_2 {} { global no_hw global gdb_prompt + global skip_hw_watchpoint_tests_p # 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 { $no_hw || [target_info exists gdb,no_hardware_watchpoints] + if { $no_hw || $skip_hw_watchpoint_tests_p || [istarget arm*-*-*] || [istarget powerpc*-*-*]} { set hw_expected 0 @@ -794,6 +803,7 @@ proc test_inaccessible_watchpoint {} { proc test_no_hw_watchpoints {} { global testfile + global skip_hw_watchpoint_tests_p clean_restart $testfile @@ -839,7 +849,7 @@ proc test_no_hw_watchpoints {} { # Re-enable 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 1" "" } } @@ -891,8 +901,9 @@ proc test_watchpoint_in_big_blob {} { proc test_watch_register_location {} { global no_hw + global skip_hw_watchpoint_tests_p - if {!$no_hw && ![target_info exists gdb,no_hardware_watchpoints]} { + if {!$no_hw && !$skip_hw_watchpoint_tests_p} { # Non-memory read/access watchpoints are not supported, they would # require software read/access watchpoint support (which is not # currently available). @@ -916,10 +927,11 @@ test_no_hw_watchpoints proc do_tests {} { global testfile global no_hw + global skip_hw_watchpoint_tests_p clean_restart $testfile - if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { + if {$no_hw || $skip_hw_watchpoint_tests_p} { gdb_test_no_output "set can-use-hw-watchpoints 0"\ "disable fast watches, 1" } @@ -939,7 +951,7 @@ proc do_tests {} { # `initialize' anymore. clean_restart $testfile - if {$no_hw || [target_info exists gdb,no_hardware_watchpoints]} { + if {$no_hw || $skip_hw_watchpoint_tests_p} { gdb_test_no_output "set can-use-hw-watchpoints 0" \ "disable fast watches, 2" } @@ -977,7 +989,7 @@ proc do_tests {} { # watchpoints force-disabled. do_tests -if ![target_info exists gdb,no_hardware_watchpoints] { +if {!$skip_hw_watchpoint_tests_p} { with_test_prefix "no-hw" { set no_hw 1 do_tests -- 2.37.2