Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / testsuite / gdb.base / all-bin.exp
blobbc717710ba07cdea50b0e8ab7a2d9d2a49b08765
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
24 # tests for arithmetic, logical and relational operators
25 # with mixed types
30 if $tracelevel then {
31 strace $tracelevel
35 # test running programs
37 set prms_id 0
38 set bug_id 0
40 set testfile "all-types"
41 set srcfile ${testfile}.c
42 set binfile ${objdir}/${subdir}/${testfile}
44 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
45 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
48 if [get_compiler_info ${binfile}] {
49 return -1
52 gdb_exit
53 gdb_start
54 gdb_reinitialize_dir $srcdir/$subdir
55 gdb_load ${binfile}
59 # set it up at a breakpoint so we can play with the variable values
62 if ![runto_main] then {
63 perror "couldn't run to breakpoint"
64 continue
67 gdb_test "next" "return 0;" "continuing after dummy()"
69 send_gdb "print v_int+v_char\n"
70 gdb_expect {
71 -re ".*71.*$gdb_prompt $" {
72 pass "print value of v_int+v_char"
74 -re ".*$gdb_prompt $" { fail "print value of v_int+v_char" }
75 timeout { fail "(timeout) print value of v_int+v_char" }
78 send_gdb "print v_int+v_short\n"
79 gdb_expect {
80 -re ".*9.*$gdb_prompt $" {
81 pass "print value of v_int+v_short"
83 -re ".*$gdb_prompt $" { fail "print value of v_int+v_short" }
84 timeout { fail "(timeout) print value of v_int+v_short" }
88 send_gdb "print v_int+v_signed_char\n"
89 gdb_expect {
90 -re ".*72.*$gdb_prompt $" {
91 pass "print value of v_int+v_signed_char"
93 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_char" }
94 timeout { fail "(timeout) print value of v_int+v_signed_char" }
98 send_gdb "print v_int+v_unsigned_char\n"
99 gdb_expect {
100 -re ".*73.*$gdb_prompt $" {
101 pass "print value of v_int+v_unsigned_char"
103 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_char" }
104 timeout { fail "(timeout) print value of v_int+v_unsigned_char" }
108 send_gdb "print v_int+v_signed_short\n"
109 gdb_expect {
110 -re ".*10.*$gdb_prompt $" {
111 pass "print value of v_int+v_signed_short"
113 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_short" }
114 timeout { fail "(timeout) print value of v_int+v_signed_short" }
118 send_gdb "print v_int+v_unsigned_short\n"
119 gdb_expect {
120 -re ".*11.*$gdb_prompt $" {
121 pass "print value of v_int+v_unsigned_short"
123 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_short" }
124 timeout { fail "(timeout) print value of v_int+v_unsigned_short" }
128 send_gdb "print v_int+v_signed_int\n"
129 gdb_expect {
130 -re ".*13.*$gdb_prompt $" {
131 pass "print value of v_int+v_signed_int"
133 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_int" }
134 timeout { fail "(timeout) print value of v_int+v_signed_int" }
138 send_gdb "print v_int+v_unsigned_int\n"
139 gdb_expect {
140 -re ".*14.*$gdb_prompt $" {
141 pass "print value of v_int+v_unsigned_int"
143 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_int" }
144 timeout { fail "(timeout) print value of v_int+v_unsigned_int" }
148 send_gdb "print v_int+v_long\n"
149 gdb_expect {
150 -re ".*15.*$gdb_prompt $" {
151 pass "print value of v_int+v_long"
153 -re ".*$gdb_prompt $" { fail "print value of v_int+v_long" }
154 timeout { fail "(timeout) print value of v_int+v_long" }
158 send_gdb "print v_int+v_signed_long\n"
159 gdb_expect {
160 -re ".*16.*$gdb_prompt $" {
161 pass "print value of v_int+v_signed_long"
163 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_long" }
164 timeout { fail "(timeout) print value of v_int+v_signed_long" }
168 send_gdb "print v_int+v_unsigned_long\n"
169 gdb_expect {
170 -re ".*17.*$gdb_prompt $" {
171 pass "print value of v_int+v_unsigned_long"
173 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_long" }
174 timeout { fail "(timeout) print value of v_int+v_unsigned_long" }
178 send_gdb "print v_int+v_float\n"
179 gdb_expect {
180 -re ".*106.34343.*$gdb_prompt $" {
181 pass "print value of v_int+v_float"
183 -re ".*$gdb_prompt $" { fail "print value of v_int+v_float" }
184 timeout { fail "(timeout) print value of v_int+v_float" }
188 send_gdb "print v_int+v_double\n"
189 gdb_expect {
190 -re ".*206.565.*$gdb_prompt $" {
191 pass "print value of v_int+v_double"
193 -re ".*$gdb_prompt $" { fail "print value of v_int+v_double" }
194 timeout { fail "(timeout) print value of v_int+v_double" }
199 # test the relational operators with mixed types
202 send_gdb "print v_int <= v_char\n"
203 gdb_expect {
204 -re ".*1.*$gdb_prompt $" {
205 pass "print value of v_int<=v_char"
207 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_char" }
208 timeout { fail "(timeout) print value of v_int<=v_char" }
211 send_gdb "print v_int <= v_short\n"
212 gdb_expect {
213 -re ".*$false.*$gdb_prompt $" {
214 pass "print value of v_int<=v_short"
216 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_short" }
217 timeout { fail "(timeout) print value of v_int<=v_short" }
221 send_gdb "print v_int <= v_signed_char\n"
222 gdb_expect {
223 -re ".*1.*$gdb_prompt $" {
224 pass "print value of v_int<=v_signed_char"
226 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_char" }
227 timeout { fail "(timeout) print value of v_int<=v_signed_char" }
231 send_gdb "print v_int <= v_unsigned_char\n"
232 gdb_expect {
233 -re ".*1.*$gdb_prompt $" {
234 pass "print value of v_int<=v_unsigned_char"
236 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_char" }
237 timeout { fail "(timeout) print value of v_int<=v_unsigned_char" }
241 send_gdb "print v_int <= v_signed_short\n"
242 gdb_expect {
243 -re ".*$false.*$gdb_prompt $" {
244 pass "print value of v_int<=v_signed_short"
246 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_short" }
247 timeout { fail "(timeout) print value of v_int<=v_signed_short" }
251 send_gdb "print v_int <= v_unsigned_short\n"
252 gdb_expect {
253 -re ".*$false.*$gdb_prompt $" {
254 pass "print value of v_int<=v_unsigned_short"
256 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_short" }
257 timeout { fail "(timeout) print value of v_int<=v_unsigned_short" }
261 send_gdb "print v_int <= v_signed_int\n"
262 gdb_expect {
263 -re ".*$true.*$gdb_prompt $" {
264 pass "print value of v_int<=v_signed_int"
266 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_int" }
267 timeout { fail "(timeout) print value of v_int<=v_signed_int" }
271 send_gdb "print v_int <= v_unsigned_int\n"
272 gdb_expect {
273 -re ".*$true.*$gdb_prompt $" {
274 pass "print value of v_int<=v_unsigned_int"
276 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_int" }
277 timeout { fail "(timeout) print value of v_int<=v_unsigned_int" }
281 send_gdb "print v_int <= v_long\n"
282 gdb_expect {
283 -re ".*$true.*$gdb_prompt $" {
284 pass "print value of v_int<=v_long"
286 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_long" }
287 timeout { fail "(timeout) print value of v_int<=v_long" }
291 send_gdb "print v_int <= v_signed_long\n"
292 gdb_expect {
293 -re ".*$true.*$gdb_prompt $" {
294 pass "print value of v_int<=v_signed_long"
296 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_long" }
297 timeout { fail "(timeout) print value of v_int<=v_signed_long" }
301 send_gdb "print v_int <= v_unsigned_long\n"
302 gdb_expect {
303 -re ".*$true.*$gdb_prompt $" {
304 pass "print value of v_int<=v_unsigned_long"
306 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_long" }
307 timeout { fail "(timeout) print value of v_int<=v_unsigned_long" }
311 send_gdb "print v_int <= v_float\n"
312 gdb_expect {
313 -re ".*$true.*$gdb_prompt $" {
314 pass "print value of v_int<=v_float"
316 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_float" }
317 timeout { fail "(timeout) print value of v_int<=v_float" }
321 send_gdb "print v_int <= v_double\n"
322 gdb_expect {
323 -re ".*$true.*$gdb_prompt $" {
324 pass "print value of v_int<=v_double"
326 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_double" }
327 timeout { fail "(timeout) print value of v_int<=v_double" }
333 # test the logical operators with mixed types
336 gdb_test "set variable v_char=0" "" "set v_char=0"
337 gdb_test "set variable v_double=0.0" "" "set v_double=0"
338 gdb_test "set variable v_unsigned_long=0" "" "set v_unsigned_long=0"
340 send_gdb "print v_int && v_char\n"
341 gdb_expect {
342 -re ".*$false.*$gdb_prompt $" {
343 pass "print value of v_int&&v_char"
345 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_char" }
346 timeout { fail "(timeout) print value of v_int&&v_char" }
349 send_gdb "print v_int && v_short\n"
350 gdb_expect {
351 -re ".*$true.*$gdb_prompt $" {
352 pass "print value of v_int&&v_short"
354 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_short" }
355 timeout { fail "(timeout) print value of v_int&&v_short" }
359 send_gdb "print v_int && v_signed_char\n"
360 gdb_expect {
361 -re ".*$true.*$gdb_prompt $" {
362 pass "print value of v_int&&v_signed_char"
364 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_char" }
365 timeout { fail "(timeout) print value of v_int&&v_signed_char" }
369 send_gdb "print v_int && v_unsigned_char\n"
370 gdb_expect {
371 -re ".*$true.*$gdb_prompt $" {
372 pass "print value of v_int&&v_unsigned_char"
374 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_char" }
375 timeout { fail "(timeout) print value of v_int&&v_unsigned_char" }
379 send_gdb "print v_int && v_signed_short\n"
380 gdb_expect {
381 -re ".*$true.*$gdb_prompt $" {
382 pass "print value of v_int&&v_signed_short"
384 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_short" }
385 timeout { fail "(timeout) print value of v_int&&v_signed_short" }
389 send_gdb "print v_int && v_unsigned_short\n"
390 gdb_expect {
391 -re ".*$true.*$gdb_prompt $" {
392 pass "print value of v_int&&v_unsigned_short"
394 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_short" }
395 timeout { fail "(timeout) print value of v_int&&v_unsigned_short" }
399 send_gdb "print v_int && v_signed_int\n"
400 gdb_expect {
401 -re ".*$true.*$gdb_prompt $" {
402 pass "print value of v_int&&v_signed_int"
404 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_int" }
405 timeout { fail "(timeout) print value of v_int&&v_signed_int" }
409 send_gdb "print v_int && v_unsigned_int\n"
410 gdb_expect {
411 -re ".*$true.*$gdb_prompt $" {
412 pass "print value of v_int&&v_unsigned_int"
414 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_int" }
415 timeout { fail "(timeout) print value of v_int&&v_unsigned_int" }
419 send_gdb "print v_int && v_long\n"
420 gdb_expect {
421 -re ".*$true.*$gdb_prompt $" {
422 pass "print value of v_int&&v_long"
424 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_long" }
425 timeout { fail "(timeout) print value of v_int&&v_long" }
429 send_gdb "print v_int && v_signed_long\n"
430 gdb_expect {
431 -re ".*$true.*$gdb_prompt $" {
432 pass "print value of v_int&&v_signed_long"
434 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_long" }
435 timeout { fail "(timeout) print value of v_int&&v_signed_long" }
439 send_gdb "print v_int && v_unsigned_long\n"
440 gdb_expect {
441 -re ".*$false.*$gdb_prompt $" {
442 pass "print value of v_int&&v_unsigned_long"
444 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_long" }
445 timeout { fail "(timeout) print value of v_int&&v_unsigned_long" }
449 send_gdb "print v_int && v_float\n"
450 gdb_expect {
451 -re ".*$true.*$gdb_prompt $" {
452 pass "print value of v_int&&v_float"
454 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_float" }
455 timeout { fail "(timeout) print value of v_int&&v_float" }
459 send_gdb "print v_int && v_double\n"
460 gdb_expect {
461 -re ".*$false.*$gdb_prompt $" {
462 pass "print value of v_int&&v_double"
464 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_double" }
465 timeout { fail "(timeout) print value of v_int&&v_double" }