public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Carl Love <cel@us.ibm.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Subject: [PATCH] Fix hardware watchpoint check in test gdb.base/watchpoint-reuse-slot.exp
Date: Tue, 09 Aug 2022 17:00:17 -0700	[thread overview]
Message-ID: <3783e7e44fe188af5ca1f2ddcfa4c7f5cb7a818e.camel@us.ibm.com> (raw)

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



             reply	other threads:[~2022-08-10  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  0:00 Carl Love [this message]
2022-08-10 15:17 ` will schmidt
2022-08-10 17:54   ` Carl Love
2022-08-10 19:17     ` Carl Love
2022-08-11 14:16       ` will schmidt
2022-08-11 15:22         ` Carl Love
2022-08-10 19:46 ` [PATCH ver 2] " Carl Love
2022-08-12 12:23   ` Ulrich Weigand
2022-08-12 15:44     ` Carl Love
2022-08-12 16:06     ` [PATCH ver 3] " Carl Love
2022-08-18 14:31       ` Ulrich Weigand
2022-08-18 23:09         ` Carl Love
2022-09-07 22:54       ` [PATCH ver 4] " Carl Love
2022-09-08 14:11         ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3783e7e44fe188af5ca1f2ddcfa4c7f5cb7a818e.camel@us.ibm.com \
    --to=cel@us.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).