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