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