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