]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/watch-cond-infcall.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / watch-cond-infcall.exp
CommitLineData
1d506c26 1# Copyright 2010-2024 Free Software Foundation, Inc.
f431efe5
PA
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# Test for watchpoints with conditions that involve inferior function
17# calls.
18
e379cbb1 19# The allow_hw_watchpoint_tests checks if watchpoints are supported by the
f760c4f2
CL
20# processor. On PowerPC, the check runs a small test program under gdb
21# to determine if the Power processor supports HW watchpoints. The check
22# must be done before starting the test so as to not disrupt the execution
23# of the actual test.
24
e379cbb1 25set allow_hw_watchpoint_tests_p [allow_hw_watchpoint_tests]
f760c4f2 26
62cef515 27standard_testfile
f431efe5 28
450d26c8 29require {!target_info exists gdb,cannot_call_functions}
8e86a419 30
f431efe5 31if { [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
5b362f04 32 untested "failed to compile"
f431efe5
PA
33 return -1
34}
35
6a5870ce 36proc test_watchpoint { hw } {
f431efe5 37 global testfile
f431efe5
PA
38
39 clean_restart ${testfile}
40
65a33d75 41 if {![runto_main]} {
f431efe5
PA
42 return
43 }
44
45 if { ! $hw } {
46 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
47 }
48
49 gdb_test "watch var if return_1 ()" "atchpoint .*: var"
50
51 gdb_breakpoint [gdb_get_line_number "break-at-exit"]
52
53 gdb_test "continue" \
11af934b 54 "atchpoint \[0-9\]+: var\r\n\r\nOld value = 0\r\nNew value = 1\r\n.*watchpoint-stop.*"
f431efe5
PA
55}
56
e379cbb1 57if { $allow_hw_watchpoint_tests_p } {
0f4d39d5 58 with_test_prefix "hw" { test_watchpoint 1 }
f431efe5
PA
59}
60
0f4d39d5 61with_test_prefix "sw" { test_watchpoint 0 }