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.
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 all the assignemnt operators
25 # with mixed types and with
int type variables
33 # test running programs
38 set testfile
"all-types"
39 set srcfile $
{testfile
}.c
40 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
42 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
43 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
50 gdb_reinitialize_dir $srcdir
/$subdir
55 #
set it up at a breakpoint so we can play with the
variable values
58 if ![runto_main
] then {
59 perror
"couldn't run to breakpoint"
63 gdb_test
"next" "return 0;" "continuing after dummy()"
65 send_gdb
"print v_int=57\n"
67 -re
".*57.*$gdb_prompt $" {
68 send_gdb
"print v_int\n"
70 -re
".*57.*$gdb_prompt $" {
73 -re
".*$gdb_prompt $" { fail "v_int=57" }
74 timeout
{ fail
"(timeout) v_int=57" }
77 -re
".*$gdb_prompt $" { fail "v_int=57" }
78 timeout
{ fail
"(timeout) v_int=57" }
82 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
85 send_gdb
"print v_int+=57\n"
87 -re
".*63.*$gdb_prompt $" {
88 send_gdb
"print v_int\n"
90 -re
".*63.*$gdb_prompt $" {
93 -re
".*$gdb_prompt $" { fail "v_int+=57" }
94 timeout
{ fail
"(timeout) v_int+=57" }
97 -re
".*$gdb_prompt $" { fail "v_int+=57" }
98 timeout
{ fail
"(timeout) v_int+=57" }
101 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
103 send_gdb
"print v_int-=57\n"
105 -re
".*-51.*$gdb_prompt $" {
106 send_gdb
"print v_int\n"
108 -re
".*-51.*$gdb_prompt $" {
111 -re
".*$gdb_prompt $" { fail "v_int-=57" }
112 timeout
{ fail
"(timeout) v_int-=57" }
115 -re
".*$gdb_prompt $" { fail "v_int-=57" }
116 timeout
{ fail
"(timeout) v_int-=57" }
119 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
121 send_gdb
"print v_int*=5\n"
123 -re
".*30.*$gdb_prompt $" {
124 send_gdb
"print v_int\n"
126 -re
".*30.*$gdb_prompt $" {
129 -re
".*$gdb_prompt $" { fail "v_int*=5" }
130 timeout
{ fail
"(timeout) v_int*=5" }
133 -re
".*$gdb_prompt $" { fail "v_int*=5" }
134 timeout
{ fail
"(timeout) v_int*=5" }
137 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
139 send_gdb
"print v_int/=4\n"
141 -re
".*1.*$gdb_prompt $" {
142 send_gdb
"print v_int\n"
144 -re
".*1.*$gdb_prompt $" {
147 -re
".*$gdb_prompt $" { fail "v_int/=4" }
148 timeout
{ fail
"(timeout) v_int/=4" }
151 -re
".*$gdb_prompt $" { fail "v_int/=4" }
152 timeout
{ fail
"(timeout) v_int/=4" }
157 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
159 send_gdb
"print v_int%=4\n"
161 -re
".*2.*$gdb_prompt $" {
162 send_gdb
"print v_int\n"
164 -re
".*2.*$gdb_prompt $" {
167 -re
".*$gdb_prompt $" { fail "v_int%=4" }
168 timeout
{ fail
"(timeout) v_int%=4" }
171 -re
".*$gdb_prompt $" { fail "v_int%=4" }
172 timeout
{ fail
"(timeout) v_int%=4" }
177 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
181 send_gdb
"print v_int+=v_char\n"
183 -re
".*71.*$gdb_prompt $" {
184 send_gdb
"print v_int\n"
186 -re
".*71.*$gdb_prompt $" {
189 -re
".*$gdb_prompt $" { fail "v_int+=v_char" }
190 timeout
{ fail
"(timeout) v_int+=v_char" }
193 -re
".*$gdb_prompt $" { fail "v_int+=v_char" }
194 timeout
{ fail
"(timeout) v_int+=v_char" }
198 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
202 send_gdb
"print v_int+=v_signed_char\n"
204 -re
".*72.*$gdb_prompt $" {
205 send_gdb
"print v_int\n"
207 -re
".*72.*$gdb_prompt $" {
208 pass
"v_int+=signed_char"
210 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_char" }
211 timeout
{ fail
"(timeout) v_int+=v_signed_char" }
214 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_char" }
215 timeout
{ fail
"(timeout) v_int+=v_signed_char" }
219 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
223 send_gdb
"print v_int+=v_unsigned_char\n"
225 -re
".*73.*$gdb_prompt $" {
226 send_gdb
"print v_int\n"
228 -re
".*73.*$gdb_prompt $" {
229 pass
"v_int+=unsigned_char"
231 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" }
232 timeout
{ fail
"(timeout) v_int+=v_unsigned_char" }
235 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" }
236 timeout
{ fail
"(timeout) v_int+=v_unsigned_char" }
240 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
244 send_gdb
"print v_int+=v_short\n"
246 -re
".*9.*$gdb_prompt $" {
247 send_gdb
"print v_int\n"
249 -re
".*9.*$gdb_prompt $" {
252 -re
".*$gdb_prompt $" { fail "v_int+=v_short" }
253 timeout
{ fail
"(timeout) v_int+=v_short" }
256 -re
".*$gdb_prompt $" { fail "v_int+=v_short" }
257 timeout
{ fail
"(timeout) v_int+=v_short" }
261 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
265 send_gdb
"print v_int+=v_signed_short\n"
267 -re
".*10.*$gdb_prompt $" {
268 send_gdb
"print v_int\n"
270 -re
".*10.*$gdb_prompt $" {
271 pass
"v_int+=signed_short"
273 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_short" }
274 timeout
{ fail
"(timeout) v_int+=v_signed_short" }
277 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_short" }
278 timeout
{ fail
"(timeout) v_int+=v_signed_short" }
282 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
286 send_gdb
"print v_int+=v_unsigned_short\n"
288 -re
".*11.*$gdb_prompt $" {
289 send_gdb
"print v_int\n"
291 -re
".*11.*$gdb_prompt $" {
292 pass
"v_int=+unsigned_short"
294 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" }
295 timeout
{ fail
"(timeout) v_int+=v_unsigned_short" }
298 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" }
299 timeout
{ fail
"(timeout) v_int+=v_unsigned_short" }
303 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
307 send_gdb
"print v_int+=v_signed_int\n"
309 -re
".*13.*$gdb_prompt $" {
310 send_gdb
"print v_int\n"
312 -re
".*13.*$gdb_prompt $" {
313 pass
"v_int+=signed_int"
315 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_int" }
316 timeout
{ fail
"(timeout) v_int+=v_signed_int" }
319 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_int" }
320 timeout
{ fail
"(timeout) v_int+=v_signed_int" }
324 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
328 send_gdb
"print v_int+=v_unsigned_int\n"
330 -re
".*14.*$gdb_prompt $" {
331 send_gdb
"print v_int\n"
333 -re
".*14.*$gdb_prompt $" {
334 pass
"v_int+=unsigned_int"
336 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" }
337 timeout
{ fail
"(timeout) v_int+=v_unsigned_int" }
340 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" }
341 timeout
{ fail
"(timeout) v_int+=v_unsigned_int" }
345 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
349 send_gdb
"print v_int+=v_long\n"
351 -re
".*15.*$gdb_prompt $" {
352 send_gdb
"print v_int\n"
354 -re
".*15.*$gdb_prompt $" {
357 -re
".*$gdb_prompt $" { fail "v_int+=v_long" }
358 timeout
{ fail
"(timeout) v_int+=v_long" }
361 -re
".*$gdb_prompt $" { fail "v_int+=v_long" }
362 timeout
{ fail
"(timeout) v_int+=v_long" }
366 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
370 send_gdb
"print v_int+=v_signed_long\n"
372 -re
".*16.*$gdb_prompt $" {
373 send_gdb
"print v_int\n"
375 -re
".*16.*$gdb_prompt $" {
376 pass
"v_int+=signed_long"
378 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_long" }
379 timeout
{ fail
"(timeout) v_int+=v_signed_long" }
382 -re
".*$gdb_prompt $" { fail "v_int+=v_signed_long" }
383 timeout
{ fail
"(timeout) v_int+=v_signed_long" }
387 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
390 send_gdb
"print v_int+=v_unsigned_long\n"
392 -re
".*17.*$gdb_prompt $" {
393 send_gdb
"print v_int\n"
395 -re
".*17.*$gdb_prompt $" {
396 pass
"v_int+=unsigned_long"
398 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" }
399 timeout
{ fail
"(timeout) v_int+=v_unsigned_long" }
402 -re
".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" }
403 timeout
{ fail
"(timeout) v_int+=v_unsigned_long" }
407 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
410 send_gdb
"print v_int+=v_float\n"
412 -re
".*106\r\n$gdb_prompt $" {
413 send_gdb
"print v_int\n"
415 -re
".*106\r\n$gdb_prompt $" {
416 pass
"v_int+=v_float"
418 -re
".*$gdb_prompt $" { fail "v_int+=v_float" }
419 timeout
{ fail
"(timeout) v_int+=v_float" }
422 -re
".*$gdb_prompt $" { fail "v_int+=v_float" }
423 timeout
{ fail
"(timeout) v_int+=v_float" }
427 gdb_test
"set variable v_int = 6" "" "set v_int to 6"
430 send_gdb
"print v_int+=v_double\n"
432 -re
".*206\r\n$gdb_prompt $" {
433 send_gdb
"print v_int\n"
435 -re
".*206\r\n$gdb_prompt $" {
438 -re
".*$gdb_prompt $" { fail "v_int+=v_double" }
439 timeout
{ fail
"(timeout) v_int+=v_double" }
442 -re
".*$gdb_prompt $" { fail "v_int+=v_double" }
443 timeout
{ fail
"(timeout) v_int+=v_double" }