]>
Commit | Line | Data |
---|---|---|
60e1c644 PA |
1 | # Copyright 2010 Free Software Foundation, Inc. |
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 | ||
20 | set testfile "watch-cond" | |
21 | set srcfile ${testfile}.c | |
22 | set binfile ${objdir}/${subdir}/${testfile} | |
23 | ||
24 | if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { | |
25 | untested ${testfile}.exp | |
26 | return -1 | |
27 | } | |
28 | ||
29 | if ![runto_main] then { | |
30 | fail "Can't run to main" | |
31 | return | |
32 | } | |
33 | ||
34 | gdb_test "watch global if q > 10" \ | |
35 | "atchpoint .*: global" \ | |
36 | "set write watchpoint on global variable, local condition" | |
37 | ||
38 | gdb_test "continue" \ | |
39 | "Old value = 10.*New value = 11.*" \ | |
40 | "watchpoint with global expression, local condition evaluates in correct frame" | |
41 | ||
42 | clean_restart ${testfile} | |
43 | ||
44 | if ![runto_main] then { | |
45 | fail "Can't run to main" | |
46 | return | |
47 | } | |
48 | ||
49 | gdb_test "watch q if q > 10" \ | |
50 | "atchpoint .*: q" \ | |
51 | "set write watchpoint on local variable, local condition" | |
52 | ||
53 | gdb_test "continue" \ | |
54 | "Old value = 10.*New value = 11.*" \ | |
55 | "watchpoint with local expression, local condition evaluates in correct frame" | |
56 | ||
57 | clean_restart ${testfile} | |
58 | ||
59 | if ![runto_main] then { | |
60 | fail "Can't run to main" | |
61 | return | |
62 | } | |
63 | ||
64 | gdb_test "watch global2" \ | |
65 | "atchpoint.*" \ | |
66 | "set write watchpoint on global2 variable" | |
67 | ||
68 | gdb_test "continue" \ | |
69 | "Old value = 0.*New value = 1.*" \ | |
70 | "watchpoint on global2 variable triggers" | |
71 | ||
27d3a1a2 | 72 | gdb_test_no_output "condition 2 *foo > 10" \ |
60e1c644 PA |
73 | "condition of watchpoint 2 changes" |
74 | ||
75 | gdb_test "continue" \ | |
76 | ".*condition cannot be tested in the current scope.*Old value = 1.*New value = 2.*" \ | |
77 | "watchpoint stops with untestable local expression" |