From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1983) id BE40A3858C55; Thu, 13 Oct 2022 21:06:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE40A3858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665695181; bh=Ir2bRhs+IyCFs5Y7jTjOg6hyvXveZAw5akRObbMnkqw=; h=From:To:Subject:Date:From; b=x76HF+LpsOVMXsF6u97jS/dtJRosgg1pcKoAlxJZA6bKa8867BaKWPYBEzySMbkmr Liiv8qoZ9Vfz1gwe4pikeX5Umu21ubTKgxHZ43JZYmHPxU1OuN+6B6s9EWH9Rzc6/p NudXOKu9S8aMtrLDs3IGTPfPiNZiDds/IGS/WrYw= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Carl Love To: gdb-cvs@sourceware.org Subject: [binutils-gdb] PowerPC, fix gdb.base/watchpoint.exp on Power 9 X-Act-Checkin: binutils-gdb X-Git-Author: Carl Love X-Git-Refname: refs/heads/master X-Git-Oldrev: 5be49e265d617f91d78d2d87fa8166e5cf6f83a2 X-Git-Newrev: 01a32ee0b8c5096bdcddec89b16b66811ca91968 Message-Id: <20221013210621.BE40A3858C55@sourceware.org> Date: Thu, 13 Oct 2022 21:06:21 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D01a32ee0b8c5= 096bdcddec89b16b66811ca91968 commit 01a32ee0b8c5096bdcddec89b16b66811ca91968 Author: Carl Love Date: Thu Oct 13 17:05:55 2022 -0400 PowerPC, fix gdb.base/watchpoint.exp on Power 9 =20 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. =20 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. =20 This patch replaces the [target_info exists gdb,no_hardware_watchpoints] with the skip_hw_watchpoint_tests_p check. With the patch, the test ru= ns on Power 9 with hardware watchpoint force-disabled. The test runs on all other PowerPC processors with and without hardware watchpoints enabled. =20 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 10 due to an internal = GDB error due to resource management. The resource management issue will be addressed in another patch. Diff: --- 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 @@ =20 # This file was written by Fred Fish. (fnf@cygnus.com) =20 +# 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] =20 standard_testfile =20 @@ -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 =20 # This test watches two words on most 32-bit ABIs, and one word on # most 64-bit ABIs. =20 # 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 =20 # This test watches four words on most 32-bit ABIs, and two words # on 64-bit ABIs. =20 # 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 {} { =20 proc test_no_hw_watchpoints {} { global testfile + global skip_hw_watchpoint_tests_p =20 clean_restart $testfile =20 @@ -839,7 +849,7 @@ proc test_no_hw_watchpoints {} { =20 =20 # 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 {} { =20 proc test_watch_register_location {} { global no_hw + global skip_hw_watchpoint_tests_p =20 - 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 =20 clean_restart $testfile =20 - 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 =20 - 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. =20 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