Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support.
authorCarl Love <cel@us.ibm.com>
Tue, 18 Oct 2022 15:25:36 +0000 (11:25 -0400)
committerCarl Love <cel@us.ibm.com>
Tue, 18 Oct 2022 15:25:36 +0000 (11:25 -0400)
commitf760c4f2999946dcc4936873a89cf2c24edc5e9b
treebb2a27bdd8e6662ac7b823cdb5ad4de0a184735b
parent0df940ee00806ce1e4d443eac27bddc2662d1897
Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support.

The hardware watchpoint check has been updated in a couple of recent
patches.  This patch updates the hardware watchpoint test in the remaining
gdb tests.

The issue is 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 fixes 6 test failures in test gdb.threads/watchpoint-fork.exp.

Test gdb.base/watch-vfork.exp runs with can-use-hw-watchpoints set to
true and false.  When the test is run with can-use-hw-watchpoints set to
true, gdb just falls back to using software watchpoints.  The
patch reduces the number of expected passes by 2 since because it now
only runs once with can-use-hw-watchpoints set to false.

Test gdb.mi/mi-watch.exp runs the test with argument hw and sw.  If the
argument is hw and hardware watchpoints are not supported the test exits.
The number of expected passes is cut in half with the patch as it now only
runs the test using software breakpoints.  Previously the pass to use
hardware watchpoints was not skipped and the test actually ran using
software watchpoints.

The following tests run the same with and without the patch.  The tests
are supposed to execute the gdb command "set can-use-hw-watchpoints 0" if
the processor does not support hardware bwatchpoints.  However the command
was not being executed and gdb was falling back to using software
watchpoints since the Power 9 watchpoint resource check fails.  With the
patch, the tests now execute the command and the test runs using software
watchpoints as it did previously.  The tests are:

gdb.base/commands.exp
gdb.base/cond-eval-mode.exp
gdb.base/display.exp
gdb.base/gdb11531.exp
gdb.base/recurse.exp
gdb.base/value-double-free.exp
gdb.base/watch-bitfields.exp
gdb.base/watch-cond-infcall.exp
gdb.base/watch-cond.exp
gdb.base/watchpoint-solib.exp
gdb.base/watchpoints.exp

The following two tests are not supported on the Power 9 system used to
test the changes.  The patch does not change the tests results for these
tests:

gdb.python/py-breakpoint.exp
gdb.mi/mi-watch-nonstop.exp
16 files changed:
gdb/testsuite/gdb.base/commands.exp
gdb/testsuite/gdb.base/cond-eval-mode.exp
gdb/testsuite/gdb.base/display.exp
gdb/testsuite/gdb.base/gdb11531.exp
gdb/testsuite/gdb.base/recurse.exp
gdb/testsuite/gdb.base/value-double-free.exp
gdb/testsuite/gdb.base/watch-bitfields.exp
gdb/testsuite/gdb.base/watch-cond-infcall.exp
gdb/testsuite/gdb.base/watch-cond.exp
gdb/testsuite/gdb.base/watch-vfork.exp
gdb/testsuite/gdb.base/watchpoint-solib.exp
gdb/testsuite/gdb.base/watchpoints.exp
gdb/testsuite/gdb.mi/mi-watch-nonstop.exp
gdb/testsuite/gdb.mi/mi-watch.exp
gdb/testsuite/gdb.python/py-breakpoint.exp
gdb/testsuite/gdb.threads/watchpoint-fork.exp