Copyright updates for 2007.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / all-bin.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# tests for arithmetic, logical and relational operators
25# with mixed types
26#
27
28
29
30if $tracelevel then {
31 strace $tracelevel
32 }
33
34#
35# test running programs
36#
37set prms_id 0
38set bug_id 0
39
40set testfile "all-types"
41set srcfile ${testfile}.c
42set binfile ${objdir}/${subdir}/${testfile}
43
fc91c6c2 44if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
45 untested all-bin.exp
46 return -1
c906108c
SS
47 }
48
085dd6e6
JM
49if [get_compiler_info ${binfile}] {
50 return -1
51}
52
c906108c
SS
53gdb_exit
54gdb_start
55gdb_reinitialize_dir $srcdir/$subdir
56gdb_load ${binfile}
57
58
59#
60# set it up at a breakpoint so we can play with the variable values
61#
62
63if ![runto_main] then {
64 perror "couldn't run to breakpoint"
65 continue
66}
67
68gdb_test "next" "return 0;" "continuing after dummy()"
69
70send_gdb "print v_int+v_char\n"
71gdb_expect {
72 -re ".*71.*$gdb_prompt $" {
73 pass "print value of v_int+v_char"
74 }
75 -re ".*$gdb_prompt $" { fail "print value of v_int+v_char" }
76 timeout { fail "(timeout) print value of v_int+v_char" }
77 }
78
79send_gdb "print v_int+v_short\n"
80gdb_expect {
81 -re ".*9.*$gdb_prompt $" {
82 pass "print value of v_int+v_short"
83 }
84 -re ".*$gdb_prompt $" { fail "print value of v_int+v_short" }
85 timeout { fail "(timeout) print value of v_int+v_short" }
86 }
87
88
89send_gdb "print v_int+v_signed_char\n"
90gdb_expect {
91 -re ".*72.*$gdb_prompt $" {
92 pass "print value of v_int+v_signed_char"
93 }
94 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_char" }
95 timeout { fail "(timeout) print value of v_int+v_signed_char" }
96 }
97
98
99send_gdb "print v_int+v_unsigned_char\n"
100gdb_expect {
101 -re ".*73.*$gdb_prompt $" {
102 pass "print value of v_int+v_unsigned_char"
103 }
104 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_char" }
105 timeout { fail "(timeout) print value of v_int+v_unsigned_char" }
106 }
107
108
109send_gdb "print v_int+v_signed_short\n"
110gdb_expect {
111 -re ".*10.*$gdb_prompt $" {
112 pass "print value of v_int+v_signed_short"
113 }
114 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_short" }
115 timeout { fail "(timeout) print value of v_int+v_signed_short" }
116 }
117
118
119send_gdb "print v_int+v_unsigned_short\n"
120gdb_expect {
121 -re ".*11.*$gdb_prompt $" {
122 pass "print value of v_int+v_unsigned_short"
123 }
124 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_short" }
125 timeout { fail "(timeout) print value of v_int+v_unsigned_short" }
126 }
127
128
129send_gdb "print v_int+v_signed_int\n"
130gdb_expect {
131 -re ".*13.*$gdb_prompt $" {
132 pass "print value of v_int+v_signed_int"
133 }
134 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_int" }
135 timeout { fail "(timeout) print value of v_int+v_signed_int" }
136 }
137
138
139send_gdb "print v_int+v_unsigned_int\n"
140gdb_expect {
141 -re ".*14.*$gdb_prompt $" {
142 pass "print value of v_int+v_unsigned_int"
143 }
144 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_int" }
145 timeout { fail "(timeout) print value of v_int+v_unsigned_int" }
146 }
147
148
149send_gdb "print v_int+v_long\n"
150gdb_expect {
151 -re ".*15.*$gdb_prompt $" {
152 pass "print value of v_int+v_long"
153 }
154 -re ".*$gdb_prompt $" { fail "print value of v_int+v_long" }
155 timeout { fail "(timeout) print value of v_int+v_long" }
156 }
157
158
159send_gdb "print v_int+v_signed_long\n"
160gdb_expect {
161 -re ".*16.*$gdb_prompt $" {
162 pass "print value of v_int+v_signed_long"
163 }
164 -re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_long" }
165 timeout { fail "(timeout) print value of v_int+v_signed_long" }
166 }
167
168
169send_gdb "print v_int+v_unsigned_long\n"
170gdb_expect {
171 -re ".*17.*$gdb_prompt $" {
172 pass "print value of v_int+v_unsigned_long"
173 }
174 -re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_long" }
175 timeout { fail "(timeout) print value of v_int+v_unsigned_long" }
176 }
177
178
179send_gdb "print v_int+v_float\n"
180gdb_expect {
181 -re ".*106.34343.*$gdb_prompt $" {
182 pass "print value of v_int+v_float"
183 }
184 -re ".*$gdb_prompt $" { fail "print value of v_int+v_float" }
185 timeout { fail "(timeout) print value of v_int+v_float" }
186 }
187
188
189send_gdb "print v_int+v_double\n"
190gdb_expect {
5bdb6d01 191 -re ".*206.565.*$gdb_prompt $" {
c906108c 192 pass "print value of v_int+v_double"
b61a8733 193 }
c906108c 194 -re ".*$gdb_prompt $" { fail "print value of v_int+v_double" }
b61a8733
MS
195 timeout { fail "(timeout) print value of v_int+v_double" }
196}
c906108c
SS
197
198
199#
200# test the relational operators with mixed types
201#
202
203send_gdb "print v_int <= v_char\n"
204gdb_expect {
205 -re ".*1.*$gdb_prompt $" {
206 pass "print value of v_int<=v_char"
207 }
208 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_char" }
209 timeout { fail "(timeout) print value of v_int<=v_char" }
210 }
211
212send_gdb "print v_int <= v_short\n"
213gdb_expect {
085dd6e6 214 -re ".*$false.*$gdb_prompt $" {
c906108c
SS
215 pass "print value of v_int<=v_short"
216 }
217 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_short" }
218 timeout { fail "(timeout) print value of v_int<=v_short" }
219 }
220
221
222send_gdb "print v_int <= v_signed_char\n"
223gdb_expect {
224 -re ".*1.*$gdb_prompt $" {
225 pass "print value of v_int<=v_signed_char"
226 }
227 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_char" }
228 timeout { fail "(timeout) print value of v_int<=v_signed_char" }
229 }
230
231
232send_gdb "print v_int <= v_unsigned_char\n"
233gdb_expect {
234 -re ".*1.*$gdb_prompt $" {
235 pass "print value of v_int<=v_unsigned_char"
236 }
237 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_char" }
238 timeout { fail "(timeout) print value of v_int<=v_unsigned_char" }
239 }
240
241
242send_gdb "print v_int <= v_signed_short\n"
243gdb_expect {
085dd6e6 244 -re ".*$false.*$gdb_prompt $" {
c906108c
SS
245 pass "print value of v_int<=v_signed_short"
246 }
247 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_short" }
248 timeout { fail "(timeout) print value of v_int<=v_signed_short" }
249 }
250
251
252send_gdb "print v_int <= v_unsigned_short\n"
253gdb_expect {
085dd6e6 254 -re ".*$false.*$gdb_prompt $" {
c906108c
SS
255 pass "print value of v_int<=v_unsigned_short"
256 }
257 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_short" }
258 timeout { fail "(timeout) print value of v_int<=v_unsigned_short" }
259 }
260
261
262send_gdb "print v_int <= v_signed_int\n"
263gdb_expect {
085dd6e6 264 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
265 pass "print value of v_int<=v_signed_int"
266 }
267 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_int" }
268 timeout { fail "(timeout) print value of v_int<=v_signed_int" }
269 }
270
271
272send_gdb "print v_int <= v_unsigned_int\n"
273gdb_expect {
085dd6e6 274 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
275 pass "print value of v_int<=v_unsigned_int"
276 }
277 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_int" }
278 timeout { fail "(timeout) print value of v_int<=v_unsigned_int" }
279 }
280
281
282send_gdb "print v_int <= v_long\n"
283gdb_expect {
085dd6e6 284 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
285 pass "print value of v_int<=v_long"
286 }
287 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_long" }
288 timeout { fail "(timeout) print value of v_int<=v_long" }
289 }
290
291
292send_gdb "print v_int <= v_signed_long\n"
293gdb_expect {
085dd6e6 294 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
295 pass "print value of v_int<=v_signed_long"
296 }
297 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_long" }
298 timeout { fail "(timeout) print value of v_int<=v_signed_long" }
299 }
300
301
302send_gdb "print v_int <= v_unsigned_long\n"
303gdb_expect {
085dd6e6 304 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
305 pass "print value of v_int<=v_unsigned_long"
306 }
307 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_long" }
308 timeout { fail "(timeout) print value of v_int<=v_unsigned_long" }
309 }
310
311
312send_gdb "print v_int <= v_float\n"
313gdb_expect {
085dd6e6 314 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
315 pass "print value of v_int<=v_float"
316 }
317 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_float" }
318 timeout { fail "(timeout) print value of v_int<=v_float" }
319 }
320
321
322send_gdb "print v_int <= v_double\n"
323gdb_expect {
085dd6e6 324 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
325 pass "print value of v_int<=v_double"
326 }
327 -re ".*$gdb_prompt $" { fail "print value of v_int<=v_double" }
328 timeout { fail "(timeout) print value of v_int<=v_double" }
329 }
330
331
332
333#
334# test the logical operators with mixed types
335#
336
337gdb_test "set variable v_char=0" "" "set v_char=0"
338gdb_test "set variable v_double=0.0" "" "set v_double=0"
339gdb_test "set variable v_unsigned_long=0" "" "set v_unsigned_long=0"
340
341send_gdb "print v_int && v_char\n"
342gdb_expect {
085dd6e6 343 -re ".*$false.*$gdb_prompt $" {
c906108c
SS
344 pass "print value of v_int&&v_char"
345 }
346 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_char" }
347 timeout { fail "(timeout) print value of v_int&&v_char" }
348 }
349
350send_gdb "print v_int && v_short\n"
351gdb_expect {
085dd6e6 352 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
353 pass "print value of v_int&&v_short"
354 }
355 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_short" }
356 timeout { fail "(timeout) print value of v_int&&v_short" }
357 }
358
359
360send_gdb "print v_int && v_signed_char\n"
361gdb_expect {
085dd6e6 362 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
363 pass "print value of v_int&&v_signed_char"
364 }
365 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_char" }
366 timeout { fail "(timeout) print value of v_int&&v_signed_char" }
367 }
368
369
370send_gdb "print v_int && v_unsigned_char\n"
371gdb_expect {
085dd6e6 372 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
373 pass "print value of v_int&&v_unsigned_char"
374 }
375 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_char" }
376 timeout { fail "(timeout) print value of v_int&&v_unsigned_char" }
377 }
378
379
380send_gdb "print v_int && v_signed_short\n"
381gdb_expect {
085dd6e6 382 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
383 pass "print value of v_int&&v_signed_short"
384 }
385 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_short" }
386 timeout { fail "(timeout) print value of v_int&&v_signed_short" }
387 }
388
389
390send_gdb "print v_int && v_unsigned_short\n"
391gdb_expect {
085dd6e6 392 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
393 pass "print value of v_int&&v_unsigned_short"
394 }
395 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_short" }
396 timeout { fail "(timeout) print value of v_int&&v_unsigned_short" }
397 }
398
399
400send_gdb "print v_int && v_signed_int\n"
401gdb_expect {
085dd6e6 402 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
403 pass "print value of v_int&&v_signed_int"
404 }
405 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_int" }
406 timeout { fail "(timeout) print value of v_int&&v_signed_int" }
407 }
408
409
410send_gdb "print v_int && v_unsigned_int\n"
411gdb_expect {
085dd6e6 412 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
413 pass "print value of v_int&&v_unsigned_int"
414 }
415 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_int" }
416 timeout { fail "(timeout) print value of v_int&&v_unsigned_int" }
417 }
418
419
420send_gdb "print v_int && v_long\n"
421gdb_expect {
085dd6e6 422 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
423 pass "print value of v_int&&v_long"
424 }
425 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_long" }
426 timeout { fail "(timeout) print value of v_int&&v_long" }
427 }
428
429
430send_gdb "print v_int && v_signed_long\n"
431gdb_expect {
085dd6e6 432 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
433 pass "print value of v_int&&v_signed_long"
434 }
435 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_long" }
436 timeout { fail "(timeout) print value of v_int&&v_signed_long" }
437 }
438
439
440send_gdb "print v_int && v_unsigned_long\n"
441gdb_expect {
085dd6e6 442 -re ".*$false.*$gdb_prompt $" {
c906108c
SS
443 pass "print value of v_int&&v_unsigned_long"
444 }
445 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_long" }
446 timeout { fail "(timeout) print value of v_int&&v_unsigned_long" }
447 }
448
449
450send_gdb "print v_int && v_float\n"
451gdb_expect {
085dd6e6 452 -re ".*$true.*$gdb_prompt $" {
c906108c
SS
453 pass "print value of v_int&&v_float"
454 }
455 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_float" }
456 timeout { fail "(timeout) print value of v_int&&v_float" }
457 }
458
459
460send_gdb "print v_int && v_double\n"
461gdb_expect {
085dd6e6 462 -re ".*$false.*$gdb_prompt $" {
c906108c
SS
463 pass "print value of v_int&&v_double"
464 }
465 -re ".*$gdb_prompt $" { fail "print value of v_int&&v_double" }
466 timeout { fail "(timeout) print value of v_int&&v_double" }
467 }
468
469
470
471
472
This page took 0.675889 seconds and 4 git commands to generate.