Fix skip.exp test failure observed with gcc-9.2.0
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / watch-cond.exp
CommitLineData
42a4f53d 1# Copyright 2010-2019 Free Software Foundation, Inc.
60e1c644
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#
17# Tests involving watchpoint conditions with local expressions.
18#
19
62cef515 20standard_testfile .c
60e1c644 21
5b362f04 22if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
60e1c644
PA
23 return -1
24}
25
e0756905
UW
26# Disable hardware watchpoints if necessary.
27if [target_info exists gdb,no_hardware_watchpoints] {
28 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
29}
30
60e1c644 31if ![runto_main] then {
bc6c7af4 32 fail "can't run to main"
60e1c644
PA
33 return
34}
35
36gdb_test "watch global if q > 10" \
37 "atchpoint .*: global" \
38 "set write watchpoint on global variable, local condition"
39
40gdb_test "continue" \
41 "Old value = 10.*New value = 11.*" \
42 "watchpoint with global expression, local condition evaluates in correct frame"
43
44clean_restart ${testfile}
45
e0756905
UW
46# Disable hardware watchpoints if necessary.
47if [target_info exists gdb,no_hardware_watchpoints] {
48 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
49}
50
60e1c644 51if ![runto_main] then {
bc6c7af4 52 fail "can't run to main"
60e1c644
PA
53 return
54}
55
56gdb_test "watch q if q > 10" \
57 "atchpoint .*: q" \
58 "set write watchpoint on local variable, local condition"
59
60gdb_test "continue" \
61 "Old value = 10.*New value = 11.*" \
62 "watchpoint with local expression, local condition evaluates in correct frame"
63
64clean_restart ${testfile}
65
e0756905
UW
66# Disable hardware watchpoints if necessary.
67if [target_info exists gdb,no_hardware_watchpoints] {
68 gdb_test_no_output "set can-use-hw-watchpoints 0" ""
69}
70
60e1c644 71if ![runto_main] then {
bc6c7af4 72 fail "can't run to main"
60e1c644
PA
73 return
74}
75
76gdb_test "watch global2" \
77 "atchpoint.*" \
78 "set write watchpoint on global2 variable"
79
80gdb_test "continue" \
81 "Old value = 0.*New value = 1.*" \
82 "watchpoint on global2 variable triggers"
83
27d3a1a2 84gdb_test_no_output "condition 2 *foo > 10" \
60e1c644
PA
85 "condition of watchpoint 2 changes"
86
87gdb_test "continue" \
88 ".*condition cannot be tested in the current scope.*Old value = 1.*New value = 2.*" \
89 "watchpoint stops with untestable local expression"
This page took 1.117653 seconds and 4 git commands to generate.