1 # This testcase is part of GDB
, the GNU debugger.
3 # Copyright
2010-2023 Free Software Foundation
, Inc.
5 # This
program is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
3 of the License
, or
8 #
(at your option
) any later version.
10 # This
program is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
18 # Test GDB bug
report 11531.
19 # This is a problem related to CANNOT_STEP_HW_WATCHPOINTS macro.
20 # It affects Solaris native targets.
22 # The allow_hw_watchpoint_tests checks
if watchpoints are supported by the
23 # processor.
On PowerPC
, the check runs a small test
program under gdb
24 # to determine
if the Power processor supports HW watchpoints. The check
25 # must be done before starting the test so as to not disrupt the execution
28 set allow_hw_watchpoint_tests_p
[allow_hw_watchpoint_tests
]
32 if { [prepare_for_testing
"failed to prepare" $testfile $testfile.c {debug}] } {
36 # Disable hardware watchpoints
if necessary.
37 if {!$allow_hw_watchpoint_tests_p
} {
38 gdb_test_no_output
"set can-use-hw-watchpoints 0" ""
45 # The breakpoint is probably at the instruction where the value being
46 # watched
(myrec.x
) gets updated. This is the instruction where we
47 # expect to receive a watchpoint notification when we
do the
"stepi"
48 # below. However
, having the breakpoint at the same location as this
49 # intruction can possibly interfere with our testcase
, as stepping
50 # over the breakpoint in order to
get past it may incorrectly
lead
51 # to the debugger missing the watchpoint hit. This would be a bug
52 # in GDB
, but this is not the bug that we are trying to test here.
53 # So
, we remove all breakpoints first.
59 gdb_test
"watch myrec.x" ".*atchpoint \[0-9\]+: myrec\.x" "set watchpoint"
62 ".*${nl}.*atchpoint \[0-9\]+: myrec\.x${nl}Old value = 0${nl}New value = 5${nl}.*" \
63 "watchpoint variable triggers at next"
66 ".*${nl}.*atchpoint \[0-9\]+: myrec\.x${nl}Old value = 5${nl}New value = 78${nl}.*" \
67 "watchpoint variable triggers at continue"