import gdb-1999-06-28 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / eval-skip.exp
CommitLineData
c906108c
SS
1# Copyright (C) 1998 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 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
47if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
48 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
49 }
50
085dd6e6
JM
51if [get_compiler_info $binfile] {
52 return -1
53}
c906108c
SS
54
55gdb_exit
56gdb_start
57gdb_reinitialize_dir $srcdir/$subdir
58gdb_load ${binfile}
59
60
61if ![runto_main] then {
62 perror "couldn't run to breakpoint"
63 continue
64}
65
66gdb_test "set variable x=14" "" "set variable x=14"
67gdb_test "set variable y=2" "" "set variable y=2"
68gdb_test "set variable z=2" "" "set variable z=2"
69gdb_test "set variable w=3" "" "set variable w=3"
70
c906108c
SS
71send_gdb "print (0 && (x+y))\n"
72gdb_expect {
085dd6e6 73 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
74 pass "print value of (0 && (x+y))"
75 }
76 -re ".*$gdb_prompt $" { fail "print value of (0 && (x+y))" }
77 timeout { fail "(timeout) print value of (0 && (x+y))" }
78 }
79
80
81send_gdb "print (0 && (x-y))\n"
82gdb_expect {
085dd6e6 83 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
84 pass "print value of (0 && (x-y))"
85 }
86 -re ".*$gdb_prompt $" { fail "print value of (0 && (x-y))" }
87 timeout { fail "(timeout) print value of (0 && (x-y))" }
88 }
89
90
91send_gdb "print (0 && (x*y))\n"
92gdb_expect {
085dd6e6 93 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
94 pass "print value of (0 && (x*y))"
95 }
96 -re ".*$gdb_prompt $" { fail "print value of (0 && (x*y))" }
97 timeout { fail "(timeout) print value of (0 && (x*y))" }
98 }
99
100
101
102send_gdb "print (0 && (x/y))\n"
103gdb_expect {
085dd6e6 104 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
105 pass "print value of (0 && (x/y))"
106 }
107 -re ".*$gdb_prompt $" { fail "print value of (0 && (x/y))" }
108 timeout { fail "(timeout) print value of (0 && (x/y))" }
109 }
110
111
112send_gdb "print (0 && (x%y))\n"
113gdb_expect {
085dd6e6 114 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
115 pass "print value of (0 && (x%y))"
116 }
117 -re ".*$gdb_prompt $" { fail "print value of (0 && (x%y))" }
118 timeout { fail "(timeout) print value of (0 && (x%y))" }
119 }
120
121
122send_gdb "print (0 && (x&&y))\n"
123gdb_expect {
085dd6e6 124 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
125 pass "print value of (0 && (x&&y))"
126 }
127 -re ".*$gdb_prompt $" { fail "print value of (0 && (x&&y))" }
128 timeout { fail "(timeout) print value of (0 && (x&&y))" }
129 }
130
131
132
133send_gdb "print (0 && (x||y))\n"
134gdb_expect {
085dd6e6 135 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
136 pass "print value of (0 && (x||y))"
137 }
138 -re ".*$gdb_prompt $" { fail "print value of (0 && (x||y))" }
139 timeout { fail "(timeout) print value of (0 && (x||y))" }
140 }
141
142
143
144send_gdb "print (0 && (x&y))\n"
145gdb_expect {
085dd6e6 146 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
147 pass "print value of (0 && (x&y))"
148 }
149 -re ".*$gdb_prompt $" { fail "print value of (0 && (x&y))" }
150 timeout { fail "(timeout) print value of (0 && (x&y))" }
151 }
152
153
154send_gdb "print (0 && (x|y))\n"
155gdb_expect {
085dd6e6 156 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
157 pass "print value of (0 && (x|y))"
158 }
159 -re ".*$gdb_prompt $" { fail "print value of (0 && (x|y))" }
160 timeout { fail "(timeout) print value of (0 && (x|y))" }
161 }
162
163
164send_gdb "print (0 && (x^y))\n"
165gdb_expect {
085dd6e6 166 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
167 pass "print value of (0 && (x^y))"
168 }
169 -re ".*$gdb_prompt $" { fail "print value of (0 && (x^y))" }
170 timeout { fail "(timeout) print value of (0 && (x^y))" }
171 }
172
173
174
175send_gdb "print (0 && (x < y))\n"
176gdb_expect {
085dd6e6 177 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
178 pass "print value of (0 && (x < y))"
179 }
180 -re ".*$gdb_prompt $" { fail "print value of (0 && (x < y))" }
181 timeout { fail "(timeout) print value of (0 && (x < y))" }
182 }
183
184
185send_gdb "print (0 && (x <= y))\n"
186gdb_expect {
085dd6e6 187 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
188 pass "print value of (0 && (x <= y))"
189 }
190 -re ".*$gdb_prompt $" { fail "print value of (0 && (x <= y))" }
191 timeout { fail "(timeout) print value of (0 && (x <= y))" }
192 }
193
194
195
196send_gdb "print (0 && (x>y))\n"
197gdb_expect {
085dd6e6 198 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
199 pass "print value of (0 && (x>y))"
200 }
201 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>y))" }
202 timeout { fail "(timeout) print value of (0 && (x>y))" }
203 }
204
205
206send_gdb "print (0 && (x>=y))\n"
207gdb_expect {
085dd6e6 208 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
209 pass "print value of (0 && (x>=y))"
210 }
211 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>=y))" }
212 timeout { fail "(timeout) print value of (0 && (x>=y))" }
213 }
214
215
216
217send_gdb "print (0 && (x==y))\n"
218gdb_expect {
085dd6e6 219 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
220 pass "print value of (0 && (x==y))"
221 }
222 -re ".*$gdb_prompt $" { fail "print value of (0 && (x==y))" }
223 timeout { fail "(timeout) print value of (0 && (x==y))" }
224 }
225
226
227send_gdb "print (0 && (x!=y))\n"
228gdb_expect {
085dd6e6 229 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
230 pass "print value of (0 && (x!=y))"
231 }
232 -re ".*$gdb_prompt $" { fail "print value of (0 && (x!=y))" }
233 timeout { fail "(timeout) print value of (0 && (x!=y))" }
234 }
235
236
237send_gdb "print (0 && (x<<31))\n"
238gdb_expect {
085dd6e6 239 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
240 pass "print value of (0 && (x<<31))"
241 }
242 -re ".*$gdb_prompt $" { fail "print value of (0 && (x<<31))" }
243 timeout { fail "(timeout) print value of (0 && (x<<31))" }
244 }
245
246
247send_gdb "print (0 && (x>>31))\n"
248gdb_expect {
085dd6e6 249 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
250 pass "print value of (0 && (x>>31))"
251 }
252 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>>31))" }
253 timeout { fail "(timeout) print value of (0 && (x>>31))" }
254 }
255
256
257
258send_gdb "print (0 && (!x))\n"
259gdb_expect {
085dd6e6 260 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
261 pass "print value of (0 && (!x))"
262 }
263 -re ".*$gdb_prompt $" { fail "print value of (0 && (!x))" }
264 timeout { fail "(timeout) print value of (0 && (!x))" }
265 }
266
267
268send_gdb "print (0 && (~x))\n"
269gdb_expect {
085dd6e6 270 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
271 pass "print value of (0 && (~x))"
272 }
273 -re ".*$gdb_prompt $" { fail "print value of (0 && (~x))" }
274 timeout { fail "(timeout) print value of (0 && (~x))" }
275 }
276
277send_gdb "print (0 && (-x))\n"
278gdb_expect {
085dd6e6 279 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
280 pass "print value of (0 && (-x))"
281 }
282 -re ".*$gdb_prompt $" { fail "print value of (0 && (-x))" }
283 timeout { fail "(timeout) print value of (0 && (-x))" }
284 }
285
286
287send_gdb "print (0 && (x++))\n"
288gdb_expect {
085dd6e6 289 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
290 pass "print value of (0 && (x++))"
291 }
292 -re ".*$gdb_prompt $" { fail "print value of (0 && (x++))" }
293 timeout { fail "(timeout) print value of (0 && (x++))" }
294 }
295
296
297send_gdb "print (0 && (++x))\n"
298gdb_expect {
085dd6e6 299 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
300 pass "print value of (0 && (++x))"
301 }
302 -re ".*$gdb_prompt $" { fail "print value of (0 && (++x))" }
303 timeout { fail "(timeout) print value of (0 && (++x))" }
304 }
305
306
307send_gdb "print (0 && (x--))\n"
308gdb_expect {
085dd6e6 309 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
310 pass "print value of (0 && (x--))"
311 }
312 -re ".*$gdb_prompt $" { fail "print value of (0 && (x--))" }
313 timeout { fail "(timeout) print value of (0 && (x--))" }
314 }
315
316
317send_gdb "print (0 && (--x))\n"
318gdb_expect {
085dd6e6 319 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
320 pass "print value of (0 && (--x))"
321 }
322 -re ".*$gdb_prompt $" { fail "print value of (0 && (--x))" }
323 timeout { fail "(timeout) print value of (0 && (--x))" }
324 }
325
326send_gdb "print (0 && (x+=7))\n"
327gdb_expect {
085dd6e6 328 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
329 pass "print value of (0 && (x+=7))"
330 }
331 -re ".*$gdb_prompt $" { fail "print value of (0 && (x+=7))" }
332 timeout { fail "(timeout) print value of (0 && (x+=7))" }
333 }
334
335send_gdb "print (0 && (x=y))\n"
336gdb_expect {
085dd6e6 337 -re ".$decimal = $false\r\n$gdb_prompt $" {
c906108c
SS
338 pass "print value of (0 && (x=y))"
339 }
340 -re ".*$gdb_prompt $" { fail "print value of (0 && (x=y))" }
341 timeout { fail "(timeout) print value of (0 && (x=y))" }
342 }
343
344gdb_exit
345return 0
346
347
348
349
350
351
352
This page took 0.043908 seconds and 4 git commands to generate.