ChangeLog:
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / eval-skip.exp
CommitLineData
0fb0cc75 1# Copyright 1998, 1999, 2007, 2008, 2009 Free Software Foundation, Inc.
c906108c
SS
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
c906108c 6# (at your option) any later version.
e22f8b7c 7#
c906108c
SS
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.
e22f8b7c 12#
c906108c 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 15
c906108c
SS
16# This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
18# This file is part of the gdb testsuite
19
20#
21# tests to cover evaluate_subexp_standard with the EVAL_SKIP flag set.
22# this happens for instance when there is short circuit evaluation in the && and ||
23# operators, or in the non returned part of a (x ? y: z) expression.
24# the part that is not evaluated is parsed and evaluated anyway, but with
25# the EVAL_SKIP flag set
26#
27# source file "int-type.c"
28#
29
30
31if $tracelevel then {
32 strace $tracelevel
33}
34
35# Check to see if we have an executable to test. If not, then either we
36# haven't tried to compile one, or the compilation failed for some reason.
37# In either case, just notify the user and skip the tests in this file.
38
39set testfile "int-type"
40set srcfile ${testfile}.c
41set binfile ${objdir}/${subdir}/${testfile}
42
fc91c6c2 43if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
44 untested eval-skip.exp
45 return -1
c906108c
SS
46 }
47
085dd6e6
JM
48if [get_compiler_info $binfile] {
49 return -1
50}
c906108c
SS
51
52gdb_exit
53gdb_start
54gdb_reinitialize_dir $srcdir/$subdir
55gdb_load ${binfile}
56
57
58if ![runto_main] then {
59 perror "couldn't run to breakpoint"
60 continue
61}
62
63gdb_test "set variable x=14" "" "set variable x=14"
64gdb_test "set variable y=2" "" "set variable y=2"
65gdb_test "set variable z=2" "" "set variable z=2"
66gdb_test "set variable w=3" "" "set variable w=3"
67
c906108c
SS
68send_gdb "print (0 && (x+y))\n"
69gdb_expect {
085dd6e6 70 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
71 pass "print value of (0 && (x+y))"
72 }
73 -re ".*$gdb_prompt $" { fail "print value of (0 && (x+y))" }
74 timeout { fail "(timeout) print value of (0 && (x+y))" }
75 }
76
77
78send_gdb "print (0 && (x-y))\n"
79gdb_expect {
085dd6e6 80 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
81 pass "print value of (0 && (x-y))"
82 }
83 -re ".*$gdb_prompt $" { fail "print value of (0 && (x-y))" }
84 timeout { fail "(timeout) print value of (0 && (x-y))" }
85 }
86
87
88send_gdb "print (0 && (x*y))\n"
89gdb_expect {
085dd6e6 90 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
91 pass "print value of (0 && (x*y))"
92 }
93 -re ".*$gdb_prompt $" { fail "print value of (0 && (x*y))" }
94 timeout { fail "(timeout) print value of (0 && (x*y))" }
95 }
96
97
98
99send_gdb "print (0 && (x/y))\n"
100gdb_expect {
085dd6e6 101 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
102 pass "print value of (0 && (x/y))"
103 }
104 -re ".*$gdb_prompt $" { fail "print value of (0 && (x/y))" }
105 timeout { fail "(timeout) print value of (0 && (x/y))" }
106 }
107
108
109send_gdb "print (0 && (x%y))\n"
110gdb_expect {
085dd6e6 111 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
112 pass "print value of (0 && (x%y))"
113 }
114 -re ".*$gdb_prompt $" { fail "print value of (0 && (x%y))" }
115 timeout { fail "(timeout) print value of (0 && (x%y))" }
116 }
117
118
119send_gdb "print (0 && (x&&y))\n"
120gdb_expect {
085dd6e6 121 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
122 pass "print value of (0 && (x&&y))"
123 }
124 -re ".*$gdb_prompt $" { fail "print value of (0 && (x&&y))" }
125 timeout { fail "(timeout) print value of (0 && (x&&y))" }
126 }
127
128
129
130send_gdb "print (0 && (x||y))\n"
131gdb_expect {
085dd6e6 132 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
133 pass "print value of (0 && (x||y))"
134 }
135 -re ".*$gdb_prompt $" { fail "print value of (0 && (x||y))" }
136 timeout { fail "(timeout) print value of (0 && (x||y))" }
137 }
138
139
140
141send_gdb "print (0 && (x&y))\n"
142gdb_expect {
085dd6e6 143 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
144 pass "print value of (0 && (x&y))"
145 }
146 -re ".*$gdb_prompt $" { fail "print value of (0 && (x&y))" }
147 timeout { fail "(timeout) print value of (0 && (x&y))" }
148 }
149
150
151send_gdb "print (0 && (x|y))\n"
152gdb_expect {
085dd6e6 153 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
154 pass "print value of (0 && (x|y))"
155 }
156 -re ".*$gdb_prompt $" { fail "print value of (0 && (x|y))" }
157 timeout { fail "(timeout) print value of (0 && (x|y))" }
158 }
159
160
161send_gdb "print (0 && (x^y))\n"
162gdb_expect {
085dd6e6 163 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
164 pass "print value of (0 && (x^y))"
165 }
166 -re ".*$gdb_prompt $" { fail "print value of (0 && (x^y))" }
167 timeout { fail "(timeout) print value of (0 && (x^y))" }
168 }
169
170
171
172send_gdb "print (0 && (x < y))\n"
173gdb_expect {
085dd6e6 174 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
175 pass "print value of (0 && (x < y))"
176 }
177 -re ".*$gdb_prompt $" { fail "print value of (0 && (x < y))" }
178 timeout { fail "(timeout) print value of (0 && (x < y))" }
179 }
180
181
182send_gdb "print (0 && (x <= y))\n"
183gdb_expect {
085dd6e6 184 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
185 pass "print value of (0 && (x <= y))"
186 }
187 -re ".*$gdb_prompt $" { fail "print value of (0 && (x <= y))" }
188 timeout { fail "(timeout) print value of (0 && (x <= y))" }
189 }
190
191
192
193send_gdb "print (0 && (x>y))\n"
194gdb_expect {
085dd6e6 195 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
196 pass "print value of (0 && (x>y))"
197 }
198 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>y))" }
199 timeout { fail "(timeout) print value of (0 && (x>y))" }
200 }
201
202
203send_gdb "print (0 && (x>=y))\n"
204gdb_expect {
085dd6e6 205 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
206 pass "print value of (0 && (x>=y))"
207 }
208 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>=y))" }
209 timeout { fail "(timeout) print value of (0 && (x>=y))" }
210 }
211
212
213
214send_gdb "print (0 && (x==y))\n"
215gdb_expect {
085dd6e6 216 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
217 pass "print value of (0 && (x==y))"
218 }
219 -re ".*$gdb_prompt $" { fail "print value of (0 && (x==y))" }
220 timeout { fail "(timeout) print value of (0 && (x==y))" }
221 }
222
223
224send_gdb "print (0 && (x!=y))\n"
225gdb_expect {
085dd6e6 226 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
227 pass "print value of (0 && (x!=y))"
228 }
229 -re ".*$gdb_prompt $" { fail "print value of (0 && (x!=y))" }
230 timeout { fail "(timeout) print value of (0 && (x!=y))" }
231 }
232
233
234send_gdb "print (0 && (x<<31))\n"
235gdb_expect {
085dd6e6 236 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
237 pass "print value of (0 && (x<<31))"
238 }
239 -re ".*$gdb_prompt $" { fail "print value of (0 && (x<<31))" }
240 timeout { fail "(timeout) print value of (0 && (x<<31))" }
241 }
242
243
244send_gdb "print (0 && (x>>31))\n"
245gdb_expect {
085dd6e6 246 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
247 pass "print value of (0 && (x>>31))"
248 }
249 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>>31))" }
250 timeout { fail "(timeout) print value of (0 && (x>>31))" }
251 }
252
253
254
255send_gdb "print (0 && (!x))\n"
256gdb_expect {
085dd6e6 257 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
258 pass "print value of (0 && (!x))"
259 }
260 -re ".*$gdb_prompt $" { fail "print value of (0 && (!x))" }
261 timeout { fail "(timeout) print value of (0 && (!x))" }
262 }
263
264
265send_gdb "print (0 && (~x))\n"
266gdb_expect {
085dd6e6 267 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
268 pass "print value of (0 && (~x))"
269 }
270 -re ".*$gdb_prompt $" { fail "print value of (0 && (~x))" }
271 timeout { fail "(timeout) print value of (0 && (~x))" }
272 }
273
274send_gdb "print (0 && (-x))\n"
275gdb_expect {
085dd6e6 276 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
277 pass "print value of (0 && (-x))"
278 }
279 -re ".*$gdb_prompt $" { fail "print value of (0 && (-x))" }
280 timeout { fail "(timeout) print value of (0 && (-x))" }
281 }
282
283
284send_gdb "print (0 && (x++))\n"
285gdb_expect {
085dd6e6 286 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
287 pass "print value of (0 && (x++))"
288 }
289 -re ".*$gdb_prompt $" { fail "print value of (0 && (x++))" }
290 timeout { fail "(timeout) print value of (0 && (x++))" }
291 }
292
293
294send_gdb "print (0 && (++x))\n"
295gdb_expect {
085dd6e6 296 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
297 pass "print value of (0 && (++x))"
298 }
299 -re ".*$gdb_prompt $" { fail "print value of (0 && (++x))" }
300 timeout { fail "(timeout) print value of (0 && (++x))" }
301 }
302
303
304send_gdb "print (0 && (x--))\n"
305gdb_expect {
085dd6e6 306 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
307 pass "print value of (0 && (x--))"
308 }
309 -re ".*$gdb_prompt $" { fail "print value of (0 && (x--))" }
310 timeout { fail "(timeout) print value of (0 && (x--))" }
311 }
312
313
314send_gdb "print (0 && (--x))\n"
315gdb_expect {
085dd6e6 316 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
317 pass "print value of (0 && (--x))"
318 }
319 -re ".*$gdb_prompt $" { fail "print value of (0 && (--x))" }
320 timeout { fail "(timeout) print value of (0 && (--x))" }
321 }
322
323send_gdb "print (0 && (x+=7))\n"
324gdb_expect {
085dd6e6 325 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
326 pass "print value of (0 && (x+=7))"
327 }
328 -re ".*$gdb_prompt $" { fail "print value of (0 && (x+=7))" }
329 timeout { fail "(timeout) print value of (0 && (x+=7))" }
330 }
331
332send_gdb "print (0 && (x=y))\n"
333gdb_expect {
085dd6e6 334 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
335 pass "print value of (0 && (x=y))"
336 }
337 -re ".*$gdb_prompt $" { fail "print value of (0 && (x=y))" }
338 timeout { fail "(timeout) print value of (0 && (x=y))" }
339 }
340
341gdb_exit
342return 0
343
344
345
346
347
348
349
This page took 0.866865 seconds and 4 git commands to generate.