Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.base / eval-skip.exp
blob91ae6b9370d7eb7cb61ba1cf2af220a915ada895
1 # Copyright 1998, 1999 Free Software Foundation, Inc.
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.
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.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Elena Zannoni (ezannoni@cygnus.com)
22 # This file is part of the gdb testsuite
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
31 # source file "int-type.c"
35 if $tracelevel then {
36 strace $tracelevel
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.
43 set testfile "int-type"
44 set srcfile ${testfile}.c
45 set binfile ${objdir}/${subdir}/${testfile}
47 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
48 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
51 if [get_compiler_info $binfile] {
52 return -1
55 gdb_exit
56 gdb_start
57 gdb_reinitialize_dir $srcdir/$subdir
58 gdb_load ${binfile}
61 if ![runto_main] then {
62 perror "couldn't run to breakpoint"
63 continue
66 gdb_test "set variable x=14" "" "set variable x=14"
67 gdb_test "set variable y=2" "" "set variable y=2"
68 gdb_test "set variable z=2" "" "set variable z=2"
69 gdb_test "set variable w=3" "" "set variable w=3"
71 send_gdb "print (0 && (x+y))\n"
72 gdb_expect {
73 -re ".$decimal = $false\r\n$gdb_prompt $" {
74 pass "print value of (0 && (x+y))"
76 -re ".*$gdb_prompt $" { fail "print value of (0 && (x+y))" }
77 timeout { fail "(timeout) print value of (0 && (x+y))" }
81 send_gdb "print (0 && (x-y))\n"
82 gdb_expect {
83 -re ".$decimal = $false\r\n$gdb_prompt $" {
84 pass "print value of (0 && (x-y))"
86 -re ".*$gdb_prompt $" { fail "print value of (0 && (x-y))" }
87 timeout { fail "(timeout) print value of (0 && (x-y))" }
91 send_gdb "print (0 && (x*y))\n"
92 gdb_expect {
93 -re ".$decimal = $false\r\n$gdb_prompt $" {
94 pass "print value of (0 && (x*y))"
96 -re ".*$gdb_prompt $" { fail "print value of (0 && (x*y))" }
97 timeout { fail "(timeout) print value of (0 && (x*y))" }
102 send_gdb "print (0 && (x/y))\n"
103 gdb_expect {
104 -re ".$decimal = $false\r\n$gdb_prompt $" {
105 pass "print value of (0 && (x/y))"
107 -re ".*$gdb_prompt $" { fail "print value of (0 && (x/y))" }
108 timeout { fail "(timeout) print value of (0 && (x/y))" }
112 send_gdb "print (0 && (x%y))\n"
113 gdb_expect {
114 -re ".$decimal = $false\r\n$gdb_prompt $" {
115 pass "print value of (0 && (x%y))"
117 -re ".*$gdb_prompt $" { fail "print value of (0 && (x%y))" }
118 timeout { fail "(timeout) print value of (0 && (x%y))" }
122 send_gdb "print (0 && (x&&y))\n"
123 gdb_expect {
124 -re ".$decimal = $false\r\n$gdb_prompt $" {
125 pass "print value of (0 && (x&&y))"
127 -re ".*$gdb_prompt $" { fail "print value of (0 && (x&&y))" }
128 timeout { fail "(timeout) print value of (0 && (x&&y))" }
133 send_gdb "print (0 && (x||y))\n"
134 gdb_expect {
135 -re ".$decimal = $false\r\n$gdb_prompt $" {
136 pass "print value of (0 && (x||y))"
138 -re ".*$gdb_prompt $" { fail "print value of (0 && (x||y))" }
139 timeout { fail "(timeout) print value of (0 && (x||y))" }
144 send_gdb "print (0 && (x&y))\n"
145 gdb_expect {
146 -re ".$decimal = $false\r\n$gdb_prompt $" {
147 pass "print value of (0 && (x&y))"
149 -re ".*$gdb_prompt $" { fail "print value of (0 && (x&y))" }
150 timeout { fail "(timeout) print value of (0 && (x&y))" }
154 send_gdb "print (0 && (x|y))\n"
155 gdb_expect {
156 -re ".$decimal = $false\r\n$gdb_prompt $" {
157 pass "print value of (0 && (x|y))"
159 -re ".*$gdb_prompt $" { fail "print value of (0 && (x|y))" }
160 timeout { fail "(timeout) print value of (0 && (x|y))" }
164 send_gdb "print (0 && (x^y))\n"
165 gdb_expect {
166 -re ".$decimal = $false\r\n$gdb_prompt $" {
167 pass "print value of (0 && (x^y))"
169 -re ".*$gdb_prompt $" { fail "print value of (0 && (x^y))" }
170 timeout { fail "(timeout) print value of (0 && (x^y))" }
175 send_gdb "print (0 && (x < y))\n"
176 gdb_expect {
177 -re ".$decimal = $false\r\n$gdb_prompt $" {
178 pass "print value of (0 && (x < y))"
180 -re ".*$gdb_prompt $" { fail "print value of (0 && (x < y))" }
181 timeout { fail "(timeout) print value of (0 && (x < y))" }
185 send_gdb "print (0 && (x <= y))\n"
186 gdb_expect {
187 -re ".$decimal = $false\r\n$gdb_prompt $" {
188 pass "print value of (0 && (x <= y))"
190 -re ".*$gdb_prompt $" { fail "print value of (0 && (x <= y))" }
191 timeout { fail "(timeout) print value of (0 && (x <= y))" }
196 send_gdb "print (0 && (x>y))\n"
197 gdb_expect {
198 -re ".$decimal = $false\r\n$gdb_prompt $" {
199 pass "print value of (0 && (x>y))"
201 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>y))" }
202 timeout { fail "(timeout) print value of (0 && (x>y))" }
206 send_gdb "print (0 && (x>=y))\n"
207 gdb_expect {
208 -re ".$decimal = $false\r\n$gdb_prompt $" {
209 pass "print value of (0 && (x>=y))"
211 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>=y))" }
212 timeout { fail "(timeout) print value of (0 && (x>=y))" }
217 send_gdb "print (0 && (x==y))\n"
218 gdb_expect {
219 -re ".$decimal = $false\r\n$gdb_prompt $" {
220 pass "print value of (0 && (x==y))"
222 -re ".*$gdb_prompt $" { fail "print value of (0 && (x==y))" }
223 timeout { fail "(timeout) print value of (0 && (x==y))" }
227 send_gdb "print (0 && (x!=y))\n"
228 gdb_expect {
229 -re ".$decimal = $false\r\n$gdb_prompt $" {
230 pass "print value of (0 && (x!=y))"
232 -re ".*$gdb_prompt $" { fail "print value of (0 && (x!=y))" }
233 timeout { fail "(timeout) print value of (0 && (x!=y))" }
237 send_gdb "print (0 && (x<<31))\n"
238 gdb_expect {
239 -re ".$decimal = $false\r\n$gdb_prompt $" {
240 pass "print value of (0 && (x<<31))"
242 -re ".*$gdb_prompt $" { fail "print value of (0 && (x<<31))" }
243 timeout { fail "(timeout) print value of (0 && (x<<31))" }
247 send_gdb "print (0 && (x>>31))\n"
248 gdb_expect {
249 -re ".$decimal = $false\r\n$gdb_prompt $" {
250 pass "print value of (0 && (x>>31))"
252 -re ".*$gdb_prompt $" { fail "print value of (0 && (x>>31))" }
253 timeout { fail "(timeout) print value of (0 && (x>>31))" }
258 send_gdb "print (0 && (!x))\n"
259 gdb_expect {
260 -re ".$decimal = $false\r\n$gdb_prompt $" {
261 pass "print value of (0 && (!x))"
263 -re ".*$gdb_prompt $" { fail "print value of (0 && (!x))" }
264 timeout { fail "(timeout) print value of (0 && (!x))" }
268 send_gdb "print (0 && (~x))\n"
269 gdb_expect {
270 -re ".$decimal = $false\r\n$gdb_prompt $" {
271 pass "print value of (0 && (~x))"
273 -re ".*$gdb_prompt $" { fail "print value of (0 && (~x))" }
274 timeout { fail "(timeout) print value of (0 && (~x))" }
277 send_gdb "print (0 && (-x))\n"
278 gdb_expect {
279 -re ".$decimal = $false\r\n$gdb_prompt $" {
280 pass "print value of (0 && (-x))"
282 -re ".*$gdb_prompt $" { fail "print value of (0 && (-x))" }
283 timeout { fail "(timeout) print value of (0 && (-x))" }
287 send_gdb "print (0 && (x++))\n"
288 gdb_expect {
289 -re ".$decimal = $false\r\n$gdb_prompt $" {
290 pass "print value of (0 && (x++))"
292 -re ".*$gdb_prompt $" { fail "print value of (0 && (x++))" }
293 timeout { fail "(timeout) print value of (0 && (x++))" }
297 send_gdb "print (0 && (++x))\n"
298 gdb_expect {
299 -re ".$decimal = $false\r\n$gdb_prompt $" {
300 pass "print value of (0 && (++x))"
302 -re ".*$gdb_prompt $" { fail "print value of (0 && (++x))" }
303 timeout { fail "(timeout) print value of (0 && (++x))" }
307 send_gdb "print (0 && (x--))\n"
308 gdb_expect {
309 -re ".$decimal = $false\r\n$gdb_prompt $" {
310 pass "print value of (0 && (x--))"
312 -re ".*$gdb_prompt $" { fail "print value of (0 && (x--))" }
313 timeout { fail "(timeout) print value of (0 && (x--))" }
317 send_gdb "print (0 && (--x))\n"
318 gdb_expect {
319 -re ".$decimal = $false\r\n$gdb_prompt $" {
320 pass "print value of (0 && (--x))"
322 -re ".*$gdb_prompt $" { fail "print value of (0 && (--x))" }
323 timeout { fail "(timeout) print value of (0 && (--x))" }
326 send_gdb "print (0 && (x+=7))\n"
327 gdb_expect {
328 -re ".$decimal = $false\r\n$gdb_prompt $" {
329 pass "print value of (0 && (x+=7))"
331 -re ".*$gdb_prompt $" { fail "print value of (0 && (x+=7))" }
332 timeout { fail "(timeout) print value of (0 && (x+=7))" }
335 send_gdb "print (0 && (x=y))\n"
336 gdb_expect {
337 -re ".$decimal = $false\r\n$gdb_prompt $" {
338 pass "print value of (0 && (x=y))"
340 -re ".*$gdb_prompt $" { fail "print value of (0 && (x=y))" }
341 timeout { fail "(timeout) print value of (0 && (x=y))" }
344 gdb_exit
345 return 0