Commit | Line | Data |
---|---|---|
b6ba6518 | 1 | # Copyright 1998, 1999 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 | ||
35 | if $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 | ||
43 | set testfile "int-type" | |
44 | set srcfile ${testfile}.c | |
45 | set binfile ${objdir}/${subdir}/${testfile} | |
46 | ||
fc91c6c2 | 47 | if { [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 |
52 | if [get_compiler_info $binfile] { |
53 | return -1 | |
54 | } | |
c906108c SS |
55 | |
56 | gdb_exit | |
57 | gdb_start | |
58 | gdb_reinitialize_dir $srcdir/$subdir | |
59 | gdb_load ${binfile} | |
60 | ||
61 | ||
62 | if ![runto_main] then { | |
63 | perror "couldn't run to breakpoint" | |
64 | continue | |
65 | } | |
66 | ||
67 | gdb_test "set variable x=14" "" "set variable x=14" | |
68 | gdb_test "set variable y=2" "" "set variable y=2" | |
69 | gdb_test "set variable z=2" "" "set variable z=2" | |
70 | gdb_test "set variable w=3" "" "set variable w=3" | |
71 | ||
c906108c SS |
72 | send_gdb "print (0 && (x+y))\n" |
73 | gdb_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 | ||
82 | send_gdb "print (0 && (x-y))\n" | |
83 | gdb_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 | ||
92 | send_gdb "print (0 && (x*y))\n" | |
93 | gdb_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 | ||
103 | send_gdb "print (0 && (x/y))\n" | |
104 | gdb_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 | ||
113 | send_gdb "print (0 && (x%y))\n" | |
114 | gdb_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 | ||
123 | send_gdb "print (0 && (x&&y))\n" | |
124 | gdb_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 | ||
134 | send_gdb "print (0 && (x||y))\n" | |
135 | gdb_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 | ||
145 | send_gdb "print (0 && (x&y))\n" | |
146 | gdb_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 | ||
155 | send_gdb "print (0 && (x|y))\n" | |
156 | gdb_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 | ||
165 | send_gdb "print (0 && (x^y))\n" | |
166 | gdb_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 | ||
176 | send_gdb "print (0 && (x < y))\n" | |
177 | gdb_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 | ||
186 | send_gdb "print (0 && (x <= y))\n" | |
187 | gdb_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 | ||
197 | send_gdb "print (0 && (x>y))\n" | |
198 | gdb_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 | ||
207 | send_gdb "print (0 && (x>=y))\n" | |
208 | gdb_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 | ||
218 | send_gdb "print (0 && (x==y))\n" | |
219 | gdb_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 | ||
228 | send_gdb "print (0 && (x!=y))\n" | |
229 | gdb_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 | ||
238 | send_gdb "print (0 && (x<<31))\n" | |
239 | gdb_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 | ||
248 | send_gdb "print (0 && (x>>31))\n" | |
249 | gdb_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 | ||
259 | send_gdb "print (0 && (!x))\n" | |
260 | gdb_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 | ||
269 | send_gdb "print (0 && (~x))\n" | |
270 | gdb_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 | ||
278 | send_gdb "print (0 && (-x))\n" | |
279 | gdb_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 | ||
288 | send_gdb "print (0 && (x++))\n" | |
289 | gdb_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 | ||
298 | send_gdb "print (0 && (++x))\n" | |
299 | gdb_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 | ||
308 | send_gdb "print (0 && (x--))\n" | |
309 | gdb_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 | ||
318 | send_gdb "print (0 && (--x))\n" | |
319 | gdb_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 | ||
327 | send_gdb "print (0 && (x+=7))\n" | |
328 | gdb_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 | ||
336 | send_gdb "print (0 && (x=y))\n" | |
337 | gdb_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 | ||
345 | gdb_exit | |
346 | return 0 | |
347 | ||
348 | ||
349 | ||
350 | ||
351 | ||
352 | ||
353 |