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