public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix hardware watchpoint check in test gdb.base/watchpoint-reuse-slot.exp
@ 2022-08-10  0:00 Carl Love
  2022-08-10 15:17 ` will schmidt
  2022-08-10 19:46 ` [PATCH ver 2] " Carl Love
  0 siblings, 2 replies; 14+ messages in thread
From: Carl Love @ 2022-08-10  0:00 UTC (permalink / raw)
  To: gdb-patches, Ulrich Weigand

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



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-09-08 14:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10  0:00 [PATCH] Fix hardware watchpoint check in test gdb.base/watchpoint-reuse-slot.exp Carl Love
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

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).