]>
Commit | Line | Data |
---|---|---|
3c88a10a PS |
1 | # Copyright (C) 1988, 1990, 1991, 1992, 1994, 1995 |
2 | # Free Software Foundation, Inc. | |
ef44eed1 SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
3c88a10a | 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
ef44eed1 SS |
17 | |
18 | # Please email any bugs, comments, and/or additions to this file to: | |
19 | # [email protected] | |
20 | ||
21 | # This file was written by Rob Savoye. ([email protected]) | |
22 | ||
23 | if $tracelevel then { | |
24 | strace $tracelevel | |
25 | } | |
26 | ||
27 | # | |
28 | # test running programs | |
29 | # | |
30 | set prms_id 0 | |
31 | set bug_id 0 | |
32 | ||
33 | set binfile "setvar" | |
34 | ||
35 | if ![file exists $objdir/$subdir/$binfile] then { | |
36 | perror "$objdir/$subdir/$binfile does not exist." | |
37 | return 0 | |
38 | } | |
39 | ||
40 | gdb_exit | |
41 | gdb_start | |
42 | gdb_reinitialize_dir $srcdir/$subdir | |
43 | gdb_load $objdir/$subdir/$binfile | |
44 | ||
3c88a10a PS |
45 | source gdb.base/setvar.ci |
46 | ||
ef44eed1 SS |
47 | # |
48 | # set it up at a breakpoint so we canplay with the variable values | |
49 | # | |
50 | send "set print sevenbit-strings\n" ; expect -re "$prompt $" | |
51 | ||
3c88a10a | 52 | if ![runto_main] then { |
ef44eed1 SS |
53 | perror "couldn't run to breakpoint" |
54 | continue | |
55 | } | |
56 | ||
57 | # Determine expected output for unsigned long variables, | |
58 | # the output varies with sizeof (unsigned long). | |
59 | ||
60 | set ulong_minus_1 4294967295 | |
61 | set ulong_minus_456 4294966840 | |
62 | send "print sizeof (unsigned long)\n" | |
63 | expect { | |
64 | -re ".\[0-9\]* = 4.*$prompt $" {} | |
65 | -re ".\[0-9\]* = 8.*$prompt $" { | |
66 | set ulong_minus_1 18446744073709551615 | |
67 | set ulong_minus_456 18446744073709551160 | |
68 | } | |
69 | -re ".*$prompt $" { | |
70 | fail "getting sizeof unsigned long" | |
71 | } | |
72 | default { fail "(timeout) getting sizeof unsigned long" } | |
73 | } | |
74 | ||
75 | # | |
76 | # test "set variable" for type "char" | |
77 | # | |
78 | # Because bare char types can be either signed or unsigned, we just test the | |
79 | # range of values that are common to both (0-127). | |
80 | # | |
81 | send "set variable v_char=0\n" | |
82 | expect { | |
83 | -re "$prompt $"\ | |
84 | { | |
85 | send "print v_char\n" | |
86 | expect { | |
87 | -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable char=0" } | |
88 | -re "$prompt $" { fail "set variable char=0" } | |
89 | timeout { fail "(timeout) set variable char=0" } | |
90 | } | |
91 | } | |
92 | -re "$prompt $" { fail "set variable char=0" } | |
93 | timeout { fail "(timeout) set variable char=0" } | |
94 | } | |
95 | ||
96 | ||
97 | send "set variable v_char=1\n" | |
98 | expect { | |
99 | -re "$prompt $"\ | |
100 | { | |
101 | send "print v_char\n" | |
102 | expect { | |
103 | -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable char=1" } | |
104 | -re "$prompt $" { fail "set variable char=1" } | |
105 | timeout { fail "(timeout) set variable char=1" } | |
106 | } | |
107 | } | |
108 | -re "$prompt $" { fail "set variable char=1" } | |
109 | timeout { fail "(timeout) set variable char=1" } | |
110 | } | |
111 | ||
112 | ||
113 | send "set variable v_char=27\n" | |
114 | expect { | |
115 | -re "$prompt $"\ | |
116 | { | |
117 | send "print v_char\n" | |
118 | expect { | |
119 | -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable char=27 (Esc)" } | |
120 | -re "$prompt $" { fail "set variable char=27 (Esc)" } | |
121 | timeout { fail "(timeout) set variable char=27 (Esc)" } | |
122 | } | |
123 | } | |
124 | -re "$prompt $" { fail "set variable char=27 (Esc)" } | |
125 | timeout { fail "(timeout) set variable char=27 (Esc)" } | |
126 | } | |
127 | ||
128 | ||
129 | send "set variable v_char=32\n" | |
130 | expect { | |
131 | -re "$prompt $"\ | |
132 | { | |
133 | send "print v_char\n" | |
134 | expect { | |
135 | -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable char=32 (SPC)" } | |
136 | -re "$prompt $" { fail "set variable char=32 (SPC)" } | |
137 | timeout { fail "(timeout) set variable char=32 (SPC)" } | |
138 | } | |
139 | } | |
140 | -re "$prompt $" { fail "set variable char=32 (SPC)" } | |
141 | timeout { fail "(timeout) set variable char=32 (SPC)" } | |
142 | } | |
143 | ||
144 | ||
145 | send "set variable v_char=65\n" | |
146 | expect { | |
147 | -re "$prompt $"\ | |
148 | { | |
149 | send "print v_char\n" | |
150 | expect { | |
151 | -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable char=65 ('A')" } | |
152 | -re "$prompt $" { fail "set variable char=65 ('A')" } | |
153 | timeout { fail "(timeout) set variable char=65 ('A')" } | |
154 | } | |
155 | } | |
156 | -re "$prompt $" { fail "set variable char=65 ('A')" } | |
157 | timeout { fail "(timeout) set variable char=65 ('A')" } | |
158 | } | |
159 | ||
160 | ||
161 | send "set variable v_char=97\n" | |
162 | expect { | |
163 | -re "$prompt $"\ | |
164 | { | |
165 | send "print v_char\n" | |
166 | expect { | |
167 | -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable char=97 ('a')" } | |
168 | -re "$prompt $" { fail "set variable char=97 ('a')" } | |
169 | timeout { fail "(timeout) set variable char=97 ('a')" } | |
170 | } | |
171 | } | |
172 | -re "$prompt $" { fail "set variable char=97 ('a')" } | |
173 | timeout { fail "(timeout) set variable char=97 ('a')" } | |
174 | } | |
175 | ||
176 | ||
177 | send "set variable v_char=126\n" | |
178 | expect { | |
179 | -re "$prompt $"\ | |
180 | { | |
181 | send "print v_char\n" | |
182 | expect { | |
183 | -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable char=126 ('~')" } | |
184 | -re "$prompt $" { fail "set variable char=126 ('~')" } | |
185 | timeout { fail "(timeout) set variable char=126 ('~')" } | |
186 | } | |
187 | } | |
188 | -re "$prompt $" { fail "set variable char=126 ('~')" } | |
189 | timeout { fail "(timeout) set variable char=126 ('~')" } | |
190 | } | |
191 | ||
192 | ||
193 | send "set variable v_char=127\n" | |
194 | expect { | |
195 | -re "$prompt $"\ | |
196 | { | |
197 | send "print v_char\n" | |
198 | expect { | |
199 | -re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable char=127 (8-bit)" } | |
200 | -re "$prompt $" { fail "set variable char=127 (8-bit)" } | |
201 | timeout { fail "(timeout) set variable char=127 (8-bit)" } | |
202 | } | |
203 | } | |
204 | -re "$prompt $" { fail "set variable char=127 (8-bit)" } | |
205 | timeout { fail "(timeout) set variable char=127 (8-bit)" } | |
206 | } | |
207 | ||
208 | ||
209 | # | |
210 | # test "set variable" for type "signed char" | |
211 | # | |
212 | send "set variable v_char=0\n" | |
213 | expect { | |
214 | -re "$prompt $"\ | |
215 | { | |
216 | send "print v_signed_char\n" | |
217 | expect { | |
218 | -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable signed char=0" } | |
219 | -re "$prompt $" { fail "set variable signed char=0" } | |
220 | timeout { fail "(timeout) set variable signed char=0" } | |
221 | } | |
222 | } | |
223 | -re "$prompt $" { fail "set variable signed char=0" } | |
224 | timeout { fail "(timeout) set variable signed char=0" } | |
225 | } | |
226 | ||
227 | ||
228 | send "set variable v_signed_char=1\n" | |
229 | expect { | |
230 | -re "$prompt $"\ | |
231 | { | |
232 | send "print v_signed_char\n" | |
233 | expect { | |
234 | -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable signed char=1" } | |
235 | -re "$prompt $" { fail "set variable signed char=1" } | |
236 | timeout { fail "(timeout) set variable signed char=1" } | |
237 | } | |
238 | } | |
239 | -re "$prompt $" { fail "set variable signed char=1" } | |
240 | timeout { fail "(timeout) set variable signed char=1" } | |
241 | } | |
242 | ||
243 | ||
244 | send "set variable v_signed_char=27\n" | |
245 | expect { | |
246 | -re "$prompt $"\ | |
247 | { | |
248 | send "print v_signed_char\n" | |
249 | expect { | |
250 | -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable signed char=27 (Esc)" } | |
251 | -re "$prompt $" { fail "set variable signed char=27 (Esc)" } | |
252 | timeout { fail "(timeout) set variable signed char=27 (Esc)" } | |
253 | } | |
254 | } | |
255 | -re "$prompt $" { fail "set variable signed char=27 (Esc)" } | |
256 | timeout { fail "(timeout) set variable signed char=27 (Esc)" } | |
257 | } | |
258 | ||
259 | ||
260 | send "set variable v_signed_char=32\n" | |
261 | expect { | |
262 | -re "$prompt $"\ | |
263 | { | |
264 | send "print v_signed_char\n" | |
265 | expect { | |
266 | -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable signed char=32 (SPC)" } | |
267 | -re "$prompt $" { fail "set variable signed char=32 (SPC)" } | |
268 | timeout { fail "(timeout) set variable signed char=32 (SPC)" } | |
269 | } | |
270 | } | |
271 | -re "$prompt $" { fail "set variable signed char=32 (SPC)" } | |
272 | timeout { fail "(timeout) set variable signed char=32 (SPC)" } | |
273 | } | |
274 | ||
275 | ||
276 | send "set variable v_signed_char=65\n" | |
277 | expect { | |
278 | -re "$prompt $"\ | |
279 | { | |
280 | send "print v_signed_char\n" | |
281 | expect { | |
282 | -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable signed char=65 ('A')" } | |
283 | -re "$prompt $" { fail "set variable signed char=65 ('A')" } | |
284 | timeout { fail "(timeout) set variable signed char=65 ('A')" } | |
285 | } | |
286 | } | |
287 | -re "$prompt $" { fail "set variable signed char=65 ('A')" } | |
288 | timeout { fail "(timeout) set variable signed char=65 ('A')" } | |
289 | } | |
290 | ||
291 | ||
292 | send "set variable v_signed_char=97\n" | |
293 | expect { | |
294 | -re "$prompt $"\ | |
295 | { | |
296 | send "print v_signed_char\n" | |
297 | expect { | |
298 | -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable signed char=97 ('a')" } | |
299 | -re "$prompt $" { fail "set variable signed char=97 ('a')" } | |
300 | timeout { fail "(timeout) set variable signed char=97 ('a')" } | |
301 | } | |
302 | } | |
303 | -re "$prompt $" { fail "set variable signed char=97 ('a')" } | |
304 | timeout { fail "(timeout) set variable signed char=97 ('a')" } | |
305 | } | |
306 | ||
307 | ||
308 | send "set variable v_signed_char=126\n" | |
309 | expect { | |
310 | -re "$prompt $"\ | |
311 | { | |
312 | send "print v_signed_char\n" | |
313 | expect { | |
314 | -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable signed char=126 ('~')" } | |
315 | -re "$prompt $" { fail "set variable signed char=126 ('~')" } | |
316 | timeout { fail "(timeout) set variable signed char=126 ('~')" } | |
317 | } | |
318 | } | |
319 | -re "$prompt $" { fail "set variable signed char=126 ('~')" } | |
320 | timeout { fail "(timeout) set variable signed char=126 ('~')" } | |
321 | } | |
322 | ||
323 | ||
324 | send "set variable v_signed_char=127\n" | |
325 | expect { | |
326 | -re "$prompt $"\ | |
327 | { | |
328 | send "print v_signed_char\n" | |
329 | expect { | |
330 | -re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable signed char=127 (8-bit)" } | |
331 | -re "$prompt $" { fail "set variable signed char=127 (8-bit)" } | |
332 | timeout { fail "(timeout) set variable signed char=127 (8-bit)" } | |
333 | } | |
334 | } | |
335 | -re "$prompt $" { fail "set variable signed char=127 (8-bit)" } | |
336 | timeout { fail "(timeout) set variable signed char=127 (8-bit)" } | |
337 | } | |
338 | ||
339 | ||
3c88a10a | 340 | gdb_test "set variable v_signed_char=-1" "" |
5762d8c6 | 341 | if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" } |
3c88a10a PS |
342 | gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \ |
343 | "set variable signed char=-1 (-1)" | |
ef44eed1 | 344 | |
3c88a10a | 345 | gdb_test "set variable v_signed_char=0xFF" "" |
5762d8c6 | 346 | if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" } |
3c88a10a PS |
347 | gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \ |
348 | "set variable signed char=0xFF (0xFF)" | |
ef44eed1 SS |
349 | |
350 | ||
351 | # | |
352 | # test "set variable" for type "unsigned char" | |
353 | # | |
354 | send "set variable v_unsigned_char=0\n" | |
355 | expect { | |
356 | -re "$prompt $"\ | |
357 | { | |
358 | send "print v_unsigned_char\n" | |
359 | expect { | |
360 | -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable unsigned char=0" } | |
361 | -re "$prompt $" { fail "set variable unsigned char=0" } | |
362 | timeout { fail "(timeout) set variable unsigned char=0" } | |
363 | } | |
364 | } | |
365 | -re "$prompt $" { fail "set variable unsigned char=0" } | |
366 | timeout { fail "(timeout) set variable unsigned char=0" } | |
367 | } | |
368 | ||
369 | ||
370 | send "set variable v_unsigned_char=1\n" | |
371 | expect { | |
372 | -re "$prompt $"\ | |
373 | { | |
374 | send "print v_unsigned_char\n" | |
375 | expect { | |
376 | -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable unsigned char=1" } | |
377 | -re "$prompt $" { fail "set variable unsigned char=1" } | |
378 | timeout { fail "(timeout) set variable unsigned char=1" } | |
379 | } | |
380 | } | |
381 | -re "$prompt $" { fail "set variable unsigned char=1" } | |
382 | timeout { fail "(timeout) set variable unsigned char=1" } | |
383 | } | |
384 | ||
385 | ||
386 | send "set variable v_unsigned_char=27\n" | |
387 | expect { | |
388 | -re "$prompt $"\ | |
389 | { | |
390 | send "print v_unsigned_char\n" | |
391 | expect { | |
392 | -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable unsigned char=27 (Esc)" } | |
393 | -re "$prompt $" { fail "set variable unsigned char=27 (Esc)" } | |
394 | timeout { fail "(timeout) set variable unsigned char=27 (Esc)" } | |
395 | } | |
396 | } | |
397 | -re "$prompt $" { fail "set variable unsigned char=27 (Esc)" } | |
398 | timeout { fail "(timeout) set variable unsigned char=27 (Esc)" } | |
399 | } | |
400 | ||
401 | ||
402 | send "set variable v_unsigned_char=32\n" | |
403 | expect { | |
404 | -re "$prompt $"\ | |
405 | { | |
406 | send "print v_unsigned_char\n" | |
407 | expect { | |
408 | -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable unsigned char=32 (SPC)" } | |
409 | -re "$prompt $" { fail "set variable unsigned char=32 (SPC)" } | |
410 | timeout { fail "(timeout) set variable unsigned char=32 (SPC)" } | |
411 | } | |
412 | } | |
413 | -re "$prompt $" { fail "set variable unsigned char=32 (SPC)" } | |
414 | timeout { fail "(timeout) set variable unsigned char=32 (SPC)" } | |
415 | } | |
416 | ||
417 | ||
418 | send "set variable v_unsigned_char=65\n" | |
419 | expect { | |
420 | -re "$prompt $"\ | |
421 | { | |
422 | send "print v_unsigned_char\n" | |
423 | expect { | |
424 | -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable unsigned char=65 ('A')" } | |
425 | -re "$prompt $" { fail "set variable unsigned char=65 ('A')" } | |
426 | timeout { fail "(timeout) set variable unsigned char=65 ('A')" } | |
427 | } | |
428 | } | |
429 | -re "$prompt $" { fail "set variable unsigned char=65 ('A')" } | |
430 | timeout { fail "(timeout) set variable unsigned char=65 ('A')" } | |
431 | } | |
432 | ||
433 | ||
434 | send "set variable v_unsigned_char=97\n" | |
435 | expect { | |
436 | -re "$prompt $"\ | |
437 | { | |
438 | send "print v_unsigned_char\n" | |
439 | expect { | |
440 | -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable unsigned char=97 ('a')" } | |
441 | -re "$prompt $" { fail "set variable unsigned char=97 ('a')" } | |
442 | timeout { fail "(timeout) set variable unsigned char=97 ('a')" } | |
443 | } | |
444 | } | |
445 | -re "$prompt $" { fail "set variable unsigned char=97 ('a')" } | |
446 | timeout { fail "(timeout) set variable unsigned char=97 ('a')" } | |
447 | } | |
448 | ||
449 | ||
450 | send "set variable v_unsigned_char=126\n" | |
451 | expect { | |
452 | -re "$prompt $"\ | |
453 | { | |
454 | send "print v_unsigned_char\n" | |
455 | expect { | |
456 | -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable unsigned char=126 ('~')" } | |
457 | -re "$prompt $" { fail "set variable unsigned char=126 ('~')" } | |
458 | timeout { fail "(timeout) set variable unsigned char=126 ('~')" } | |
459 | } | |
460 | } | |
461 | -re "$prompt $" { fail "set variable unsigned char=126 ('~')" } | |
462 | timeout { fail "(timeout) set variable unsigned char=126 ('~')" } | |
463 | } | |
464 | ||
465 | ||
466 | send "set variable v_unsigned_char=~0\n" | |
467 | expect { | |
468 | -re "$prompt $"\ | |
469 | { | |
470 | send "print v_unsigned_char\n" | |
471 | expect { | |
472 | -re ".\[0-9\]* = 255 \'.377\'.*$prompt $" { pass "set variable unsigned char=255 (8-bit)" } | |
473 | -re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" } | |
474 | timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" } | |
475 | } | |
476 | } | |
477 | -re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" } | |
478 | timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" } | |
479 | } | |
480 | ||
481 | ||
482 | # | |
483 | # test "set variable" for type "short" | |
484 | # | |
485 | send "set variable v_short=0\n" | |
486 | expect { | |
487 | -re "$prompt $"\ | |
488 | { | |
489 | send "print v_short\n" | |
490 | expect { | |
491 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable short=0" } | |
492 | -re "$prompt $" { fail "set variable short=0" } | |
493 | timeout { fail "(timeout) set variable short=0" } | |
494 | } | |
495 | } | |
496 | -re "$prompt $" { fail "set variable short=0" } | |
497 | timeout { fail "(timeout) set variable short=0" } | |
498 | } | |
499 | ||
500 | ||
501 | send "set variable v_short=1\n" | |
502 | expect { | |
503 | -re "$prompt $"\ | |
504 | { | |
505 | send "print v_short\n" | |
506 | expect { | |
507 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable short=1" } | |
508 | -re "$prompt $" { fail "set variable short=1" } | |
509 | timeout { fail "(timeout) set variable short=1" } | |
510 | } | |
511 | } | |
512 | -re "$prompt $" { fail "set variable short=1" } | |
513 | timeout { fail "(timeout) set variable short=1" } | |
514 | } | |
515 | ||
516 | ||
517 | send "set variable v_short=-1\n" | |
518 | expect { | |
519 | -re "$prompt $"\ | |
520 | { | |
521 | send "print v_short\n" | |
522 | expect { | |
523 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable short=-1 (minus)" } | |
524 | -re "$prompt $" { fail "set variable short=-1 (minus)" } | |
525 | timeout { fail "(timeout) set variable signed short=-1 (minus)" } | |
526 | } | |
527 | } | |
528 | -re "$prompt $" { fail "set variable short=-1 (minus)" } | |
529 | timeout { fail "(timeout) set variable short=-1 (minus)" } | |
530 | } | |
531 | ||
532 | ||
533 | # | |
534 | # test "set variable" for type "signed short" | |
535 | # | |
536 | send "set variable v_signed_short=0\n" | |
537 | expect { | |
538 | -re "$prompt $"\ | |
539 | { | |
540 | send "print v_signed_short\n" | |
541 | expect { | |
542 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed short=0" } | |
543 | -re "$prompt $" { fail "set variable signed short=0" } | |
544 | timeout { fail "(timeout) set variable signed short=0" } | |
545 | } | |
546 | } | |
547 | -re "$prompt $" { fail "set variable signed short=0" } | |
548 | timeout { fail "(timeout) set variable signed short=0" } | |
549 | } | |
550 | ||
551 | ||
552 | send "set variable v_signed_short=1\n" | |
553 | expect { | |
554 | -re "$prompt $"\ | |
555 | { | |
556 | send "print v_signed_short\n" | |
557 | expect { | |
558 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed short=1" } | |
559 | -re "$prompt $" { fail "set variable signed short=1" } | |
560 | timeout { fail "(timeout) set variable signed short=1" } | |
561 | } | |
562 | } | |
563 | -re "$prompt $" { fail "set variable signed short=1" } | |
564 | timeout { fail "(timeout) set variable signed short=1" } | |
565 | } | |
566 | ||
567 | ||
568 | send "set variable v_signed_short=-1\n" | |
569 | expect { | |
570 | -re "$prompt $"\ | |
571 | { | |
572 | send "print v_signed_short\n" | |
573 | expect { | |
574 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed short=-1 (minus)" } | |
575 | -re "$prompt $" { fail "set variable signed short=-1 (minus)" } | |
576 | timeout { fail "(timeout) set variable signed short=-1 (minus)" } | |
577 | } | |
578 | } | |
579 | -re "$prompt $" { fail "set variable signed short=-1 (minus)" } | |
580 | timeout { fail "(timeout) set variable signed short=-1 (minus)" } | |
581 | } | |
582 | ||
583 | ||
584 | # | |
585 | # test "set variable" for type "unsigned short" | |
586 | # | |
587 | send "set variable v_unsigned_short=0\n" | |
588 | expect { | |
589 | -re "$prompt $"\ | |
590 | { | |
591 | send "print v_unsigned_short\n" | |
592 | expect { | |
593 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned short=0" } | |
594 | -re "$prompt $" { fail "set variable unsigned short=0" } | |
595 | timeout { fail "(timeout) set variable unsigned short=0" } | |
596 | } | |
597 | } | |
598 | -re "$prompt $" { fail "set variable unsigned short=0" } | |
599 | timeout { fail "(timeout) set variable unsigned short=0" } | |
600 | } | |
601 | ||
602 | ||
603 | send "set variable v_unsigned_short=1\n" | |
604 | expect { | |
605 | -re "$prompt $"\ | |
606 | { | |
607 | send "print v_unsigned_short\n" | |
608 | expect { | |
609 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned short=1" } | |
610 | -re "$prompt $" { fail "set variable unsigned short=1" } | |
611 | timeout { fail "(timeout) set variable unsigned short=1" } | |
612 | } | |
613 | } | |
614 | -re "$prompt $" { fail "set variable unsigned short=1" } | |
615 | timeout { fail "(timeout) set variable unsigned short=1" } | |
616 | } | |
617 | ||
618 | ||
619 | send "set variable v_unsigned_short=~0\n" | |
620 | expect { | |
621 | -re "$prompt $"\ | |
622 | { | |
623 | send "print v_unsigned_short\n" | |
624 | expect { | |
625 | -re ".\[0-9\]* = 65535.*$prompt $" { pass "set variable unsigned short=~0 (minus)" } | |
626 | -re "$prompt $" { fail "set variable unsigned short=~0 (minus)" } | |
627 | timeout { fail "(timeout) set variable unsigned short=~0 (minus)" } | |
628 | } | |
629 | } | |
630 | -re "$prompt $" { fail "set variable unsigned short=~0 (minus)" } | |
631 | timeout { fail "(timeout) set variable unsigned short=~0 (minus)" } | |
632 | } | |
633 | ||
634 | ||
635 | # | |
636 | # test "set variable" for type "int" | |
637 | # | |
638 | send "set variable v_int=0\n" | |
639 | expect { | |
640 | -re "$prompt $"\ | |
641 | { | |
642 | send "print v_int\n" | |
643 | expect { | |
644 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable int=0" } | |
645 | -re "$prompt $" { fail "set variable int=0" } | |
646 | timeout { fail "(timeout) set variable int=0" } | |
647 | } | |
648 | } | |
649 | -re "$prompt $" { fail "set variable int=0" } | |
650 | timeout { fail "(timeout) set variable int=0" } | |
651 | } | |
652 | ||
653 | ||
654 | send "set variable v_int=1\n" | |
655 | expect { | |
656 | -re "$prompt $"\ | |
657 | { | |
658 | send "print v_int\n" | |
659 | expect { | |
660 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable int=1" } | |
661 | -re "$prompt $" { fail "set variable int=1" } | |
662 | timeout { fail "(timeout) set variable int=1" } | |
663 | } | |
664 | } | |
665 | -re "$prompt $" { fail "set variable int=1" } | |
666 | timeout { fail "(timeout) set variable int=1" } | |
667 | } | |
668 | ||
669 | ||
670 | send "set variable v_int=-1\n" | |
671 | expect { | |
672 | -re "$prompt $"\ | |
673 | { | |
674 | send "print v_int\n" | |
675 | expect { | |
676 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable int=-1 (minus)" } | |
677 | -re "$prompt $" { fail "set variable int=-1 (minus)" } | |
678 | timeout { fail "(timeout) set variable signed int=-1 (minus)" } | |
679 | } | |
680 | } | |
681 | -re "$prompt $" { fail "set variable int=-1 (minus)" } | |
682 | timeout { fail "(timeout) set variable int=-1 (minus)" } | |
683 | } | |
684 | ||
685 | ||
686 | # | |
687 | # test "set variable" for type "signed int" | |
688 | # | |
689 | send "set variable v_signed_int=0\n" | |
690 | expect { | |
691 | -re "$prompt $"\ | |
692 | { | |
693 | send "print v_signed_int\n" | |
694 | expect { | |
695 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed int=0" } | |
696 | -re "$prompt $" { fail "set variable signed int=0" } | |
697 | timeout { fail "(timeout) set variable signed int=0" } | |
698 | } | |
699 | } | |
700 | -re "$prompt $" { fail "set variable signed int=0" } | |
701 | timeout { fail "(timeout) set variable signed int=0" } | |
702 | } | |
703 | ||
704 | ||
705 | send "set variable v_signed_int=1\n" | |
706 | expect { | |
707 | -re "$prompt $"\ | |
708 | { | |
709 | send "print v_signed_int\n" | |
710 | expect { | |
711 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed int=1" } | |
712 | -re "$prompt $" { fail "set variable signed int=1" } | |
713 | timeout { fail "(timeout) set variable signed int=1" } | |
714 | } | |
715 | } | |
716 | -re "$prompt $" { fail "set variable signed int=1" } | |
717 | timeout { fail "(timeout) set variable signed int=1" } | |
718 | } | |
719 | ||
720 | ||
721 | send "set variable v_signed_int=-1\n" | |
722 | expect { | |
723 | -re "$prompt $"\ | |
724 | { | |
725 | send "print v_signed_int\n" | |
726 | expect { | |
727 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed int=-1 (minus)" } | |
728 | -re "$prompt $" { fail "set variable signed int=-1 (minus)" } | |
729 | timeout { fail "(timeout) set variable signed int=-1 (minus)" } | |
730 | } | |
731 | } | |
732 | -re "$prompt $" { fail "set variable signed int=-1 (minus)" } | |
733 | timeout { fail "(timeout) set variable signed int=-1 (minus)" } | |
734 | } | |
735 | ||
736 | ||
737 | # | |
738 | # test "set variable" for type "unsigned int" | |
739 | # | |
740 | send "set variable v_unsigned_int=0\n" | |
741 | expect { | |
742 | -re "$prompt $"\ | |
743 | { | |
744 | send "print v_unsigned_int\n" | |
745 | expect { | |
746 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned int=0" } | |
747 | -re "$prompt $" { fail "set variable unsigned int=0" } | |
748 | timeout { fail "(timeout) set variable unsigned int=0" } | |
749 | } | |
750 | } | |
751 | -re "$prompt $" { fail "set variable unsigned int=0" } | |
752 | timeout { fail "(timeout) set variable unsigned int=0" } | |
753 | } | |
754 | ||
755 | ||
756 | send "set variable v_unsigned_int=1\n" | |
757 | expect { | |
758 | -re "$prompt $"\ | |
759 | { | |
760 | send "print v_unsigned_int\n" | |
761 | expect { | |
762 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned int=1" } | |
763 | -re "$prompt $" { fail "set variable unsigned int=1" } | |
764 | timeout { fail "(timeout) set variable unsigned int=1" } | |
765 | } | |
766 | } | |
767 | -re "$prompt $" { fail "set variable unsigned int=1" } | |
768 | timeout { fail "(timeout) set variable unsigned int=1" } | |
769 | } | |
770 | ||
771 | ||
772 | send "set variable v_unsigned_int=~0\n" | |
773 | expect { | |
774 | -re "$prompt $"\ | |
775 | { | |
776 | send "print v_unsigned_int\n" | |
777 | expect { | |
778 | -re ".\[0-9\]* = 4294967295.*$prompt $" { pass "set variable unsigned int=~0 (minus)" } | |
779 | -re "$prompt $" { fail "set variable unsigned int=~0 (minus)" } | |
780 | timeout { fail "(timeout) set variable unsigned int=~0 (minus)" } | |
781 | } | |
782 | } | |
783 | -re "$prompt $" { fail "set variable unsigned int=~0 (minus)" } | |
784 | timeout { fail "(timeout) set variable unsigned int=~0 (minus)" } | |
785 | } | |
786 | ||
787 | ||
788 | # | |
789 | # test "set variable" for type "long" | |
790 | # | |
791 | send "set variable v_long=0\n" | |
792 | expect { | |
793 | -re "$prompt $"\ | |
794 | { | |
795 | send "print v_long\n" | |
796 | expect { | |
797 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable long=0" } | |
798 | -re "$prompt $" { fail "set variable long=0" } | |
799 | timeout { fail "(timeout) set variable long=0" } | |
800 | } | |
801 | } | |
802 | -re "$prompt $" { fail "set variable long=0" } | |
803 | timeout { fail "(timeout) set variable long=0" } | |
804 | } | |
805 | ||
806 | ||
807 | send "set variable v_long=1\n" | |
808 | expect { | |
809 | -re "$prompt $"\ | |
810 | { | |
811 | send "print v_long\n" | |
812 | expect { | |
813 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable long=1" } | |
814 | -re "$prompt $" { fail "set variable long=1" } | |
815 | timeout { fail "(timeout) set variable long=1" } | |
816 | } | |
817 | } | |
818 | -re "$prompt $" { fail "set variable long=1" } | |
819 | timeout { fail "(timeout) set variable long=1" } | |
820 | } | |
821 | ||
822 | ||
823 | send "set variable v_long=-1\n" | |
824 | expect { | |
825 | -re "$prompt $"\ | |
826 | { | |
827 | send "print v_long\n" | |
828 | expect { | |
829 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable long=-1 (minus)" } | |
830 | -re "$prompt $" { fail "set variable long=-1 (minus)" } | |
831 | timeout { fail "(timeout) set variable signed long=-1 (minus)" } | |
832 | } | |
833 | } | |
834 | -re "$prompt $" { fail "set variable long=-1 (minus)" } | |
835 | timeout { fail "(timeout) set variable long=-1 (minus)" } | |
836 | } | |
837 | ||
838 | ||
839 | # | |
840 | # test "set variable" for type "signed long" | |
841 | # | |
842 | send "set variable v_signed_long=0\n" | |
843 | expect { | |
844 | -re "$prompt $"\ | |
845 | { | |
846 | send "print v_signed_long\n" | |
847 | expect { | |
848 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed long=0" } | |
849 | -re "$prompt $" { fail "set variable signed long=0" } | |
850 | timeout { fail "(timeout) set variable signed long=0" } | |
851 | } | |
852 | } | |
853 | -re "$prompt $" { fail "set variable signed long=0" } | |
854 | timeout { fail "(timeout) set variable signed long=0" } | |
855 | } | |
856 | ||
857 | ||
858 | send "set variable v_signed_long=1\n" | |
859 | expect { | |
860 | -re "$prompt $"\ | |
861 | { | |
862 | send "print v_signed_long\n" | |
863 | expect { | |
864 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed long=1" } | |
865 | -re "$prompt $" { fail "set variable signed long=1" } | |
866 | timeout { fail "(timeout) set variable signed long=1" } | |
867 | } | |
868 | } | |
869 | -re "$prompt $" { fail "set variable signed long=1" } | |
870 | timeout { fail "(timeout) set variable signed long=1" } | |
871 | } | |
872 | ||
873 | ||
874 | send "set variable v_signed_long=-1\n" | |
875 | expect { | |
876 | -re "$prompt $"\ | |
877 | { | |
878 | send "print v_signed_long\n" | |
879 | expect { | |
880 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed long=-1 (minus)" } | |
881 | -re "$prompt $" { fail "set variable signed long=-1 (minus)" } | |
882 | timeout { fail "(timeout) set variable signed long=-1 (minus)" } | |
883 | } | |
884 | } | |
885 | -re "$prompt $" { fail "set variable signed long=-1 (minus)" } | |
886 | timeout { fail "(timeout) set variable signed long=-1 (minus)" } | |
887 | } | |
888 | ||
889 | ||
890 | # | |
891 | # test "set variable" for type "unsigned long" | |
892 | # | |
893 | send "set variable v_unsigned_long=0\n" | |
894 | expect { | |
895 | -re "$prompt $"\ | |
896 | { | |
897 | send "print v_unsigned_long\n" | |
898 | expect { | |
899 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned long=0" } | |
900 | -re "$prompt $" { fail "set variable unsigned long=0" } | |
901 | timeout { fail "(timeout) set variable unsigned long=0" } | |
902 | } | |
903 | } | |
904 | -re "$prompt $" { fail "set variable unsigned long=0" } | |
905 | timeout { fail "(timeout) set variable unsigned long=0" } | |
906 | } | |
907 | ||
908 | ||
909 | send "set variable v_unsigned_long=1\n" | |
910 | expect { | |
911 | -re "$prompt $"\ | |
912 | { | |
913 | send "print v_unsigned_long\n" | |
914 | expect { | |
915 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned long=1" } | |
916 | -re "$prompt $" { fail "set variable unsigned long=1" } | |
917 | timeout { fail "(timeout) set variable unsigned long=1" } | |
918 | } | |
919 | } | |
920 | -re "$prompt $" { fail "set variable unsigned long=1" } | |
921 | timeout { fail "(timeout) set variable unsigned long=1" } | |
922 | } | |
923 | ||
924 | ||
925 | send "set variable v_unsigned_long=~0\n" | |
926 | expect { | |
927 | -re "$prompt $"\ | |
928 | { | |
929 | send "print v_unsigned_long\n" | |
930 | expect { | |
931 | -re ".\[0-9\]* = $ulong_minus_1.*$prompt $" { pass "set variable unsigned long=~0 (minus)" } | |
932 | -re "$prompt $" { fail "set variable unsigned long=~0 (minus)" } | |
933 | timeout { fail "(timeout) set variable unsigned long=~0 (minus)" } | |
934 | } | |
935 | } | |
936 | -re "$prompt $" { fail "set variable unsigned long=~0 (minus)" } | |
937 | timeout { fail "(timeout) set variable unsigned long=~0 (minus)" } | |
938 | } | |
939 | ||
940 | ||
941 | # | |
942 | # test "set variable" for type "float" | |
943 | # | |
944 | send "set variable v_float=0.0\n" | |
945 | expect { | |
946 | -re "$prompt $"\ | |
947 | { | |
948 | send "print v_float\n" | |
949 | expect { | |
950 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable float=0" } | |
951 | -re "$prompt $" { fail "set variable float=0" } | |
952 | timeout { fail "(timeout) set variable float=0" } | |
953 | } | |
954 | } | |
955 | -re "$prompt $" { fail "set variable float=0" } | |
956 | timeout { fail "(timeout) set variable float=0" } | |
957 | } | |
958 | ||
959 | ||
960 | send "set variable v_float=1.0\n" | |
961 | expect { | |
962 | -re "$prompt $"\ | |
963 | { | |
964 | send "print v_float\n" | |
965 | expect { | |
966 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable float=1" } | |
967 | -re "$prompt $" { fail "set variable float=1" } | |
968 | timeout { fail "(timeout) set variable float=1" } | |
969 | } | |
970 | } | |
971 | -re "$prompt $" { fail "set variable float=1" } | |
972 | timeout { fail "(timeout) set variable float=1" } | |
973 | } | |
974 | ||
975 | ||
976 | send "set variable v_float=-1.0\n" | |
977 | expect { | |
978 | -re "$prompt $"\ | |
979 | { | |
980 | send "print v_float\n" | |
981 | expect { | |
982 | -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable float=-1 (minus)" } | |
983 | -re "$prompt $" { fail "set variable float=-1 (minus)" } | |
984 | timeout { fail "(timeout) set variable signed float=-1 (minus)" } | |
985 | } | |
986 | } | |
987 | -re "$prompt $" { fail "set variable float=-1 (minus)" } | |
988 | timeout { fail "(timeout) set variable float=-1 (minus)" } | |
989 | } | |
990 | ||
991 | ||
992 | # | |
993 | # test "set variable" for type "double" | |
994 | # | |
995 | send "set variable v_double=0.0\n" | |
996 | expect { | |
997 | -re "$prompt $"\ | |
998 | { | |
999 | send "print v_double\n" | |
1000 | expect { | |
1001 | -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable double=0" } | |
1002 | -re "$prompt $" { fail "set variable double=0" } | |
1003 | timeout { fail "(timeout) set variable double=0" } | |
1004 | } | |
1005 | } | |
1006 | -re "$prompt $" { fail "set variable double=0" } | |
1007 | timeout { fail "(timeout) set variable double=0" } | |
1008 | } | |
1009 | ||
1010 | ||
1011 | send "set variable v_double=1.0\n" | |
1012 | expect { | |
1013 | -re "$prompt $"\ | |
1014 | { | |
1015 | send "print v_double\n" | |
1016 | expect { | |
1017 | -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable double=1" } | |
1018 | -re "$prompt $" { fail "set variable double=1" } | |
1019 | timeout { fail "(timeout) set variable double=1" } | |
1020 | } | |
1021 | } | |
1022 | -re "$prompt $" { fail "set variable double=1" } | |
1023 | timeout { fail "(timeout) set variable double=1" } | |
1024 | } | |
1025 | ||
1026 | ||
1027 | send "set variable v_double=-1.0\n" | |
1028 | expect { | |
1029 | -re "set.*$prompt $"\ | |
1030 | { | |
1031 | send "print v_double\n" | |
1032 | expect { | |
1033 | -re "print.*.\[0-9\]* = -1.*$prompt $" { pass "set variable double=-1 (minus)" } | |
1034 | -re "$prompt $" { fail "set variable double=-1 (minus)" } | |
1035 | timeout { fail "(timeout) set variable double=-1 (minus)" } | |
1036 | } | |
1037 | } | |
1038 | -re "$prompt $" { fail "set variable double=-1 (minus)" } | |
1039 | timeout { fail "(timeout) set variable double=-1 (minus)" } | |
1040 | } | |
1041 | ||
1042 | ||
1043 | # | |
1044 | # test "set variable" for "char array[2]" | |
1045 | # | |
1046 | send "set variable v_char_array\[0\]='h'\n" | |
1047 | expect -re "$prompt $" | |
1048 | send "set variable v_char_array\[1\]='i'\n" | |
1049 | expect { | |
1050 | -re "set.*$prompt $"\ | |
1051 | { | |
1052 | send "print v_char_array\n" | |
1053 | expect { | |
1054 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable char array=\"hi\" (string)" } | |
1055 | -re "$prompt $" { fail "set variable char array=\"hi\" (string)" } | |
1056 | timeout { fail "(timeout) set variable char array=\"hi\" (string)" } | |
1057 | } | |
1058 | } | |
1059 | -re "$prompt $" { fail "set variable char array=\"hi\" (string)" } | |
1060 | timeout { fail "(timeout) set variable char array=\"hi\" (string)" } | |
1061 | } | |
1062 | ||
1063 | ||
1064 | # | |
1065 | # test "set variable" for "signed char array[2]" | |
1066 | # | |
1067 | send "set variable v_signed_char_array\[0\]='h'\n" | |
1068 | expect -re "$prompt $" | |
1069 | send "set variable v_signed_char_array\[1\]='i'\n" | |
1070 | expect { | |
1071 | -re "set.*$prompt $"\ | |
1072 | { | |
1073 | send "print v_signed_char_array\n" | |
1074 | expect { | |
1075 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable signed char array=\"hi\" (string)" } | |
1076 | -re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" } | |
1077 | timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" } | |
1078 | } | |
1079 | } | |
1080 | -re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" } | |
1081 | timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" } | |
1082 | } | |
1083 | ||
1084 | ||
1085 | # | |
1086 | # test "set variable" for "unsigned char array[2]" | |
1087 | # | |
1088 | send "set variable v_unsigned_char_array\[0\]='h'\n" | |
1089 | expect -re "$prompt $" | |
1090 | send "set variable v_unsigned_char_array\[1\]='i'\n" | |
1091 | expect { | |
1092 | -re "set.*$prompt $"\ | |
1093 | { | |
1094 | send "print v_unsigned_char_array\n" | |
1095 | expect { | |
1096 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable unsigned char array=\"hi\" (string)" } | |
1097 | -re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" } | |
1098 | timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" } | |
1099 | } | |
1100 | } | |
1101 | -re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" } | |
1102 | timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" } | |
1103 | } | |
1104 | ||
1105 | ||
1106 | # | |
1107 | # test "set variable" for "short array[2]" | |
1108 | # | |
1109 | send "set variable v_short_array\[0\]=123\n" | |
1110 | expect -re "$prompt $" | |
1111 | send "set variable v_short_array\[1\]=-456\n" | |
1112 | expect { | |
1113 | -re "set.*$prompt $"\ | |
1114 | { | |
1115 | send "print v_short_array\n" | |
1116 | expect { | |
1117 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable short array" } | |
1118 | -re "$prompt $" { fail "set variable short array" } | |
1119 | timeout { fail "(timeout) set variable short array" } | |
1120 | } | |
1121 | } | |
1122 | -re "$prompt $" { fail "set variable short array" } | |
1123 | timeout { fail "(timeout) set variable short array" } | |
1124 | } | |
1125 | ||
1126 | ||
1127 | # | |
1128 | # test "set variable" for "signed short array[2]" | |
1129 | # | |
1130 | send "set variable v_signed_short_array\[0\]=123\n" | |
1131 | expect -re "$prompt $" | |
1132 | send "set variable v_signed_short_array\[1\]=-456\n" | |
1133 | expect { | |
1134 | -re "set.*$prompt $"\ | |
1135 | { | |
1136 | send "print v_signed_short_array\n" | |
1137 | expect { | |
1138 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed short array" } | |
1139 | -re "$prompt $" { fail "set variable signed short array" } | |
1140 | timeout { fail "(timeout) set variable signed short array" } | |
1141 | } | |
1142 | } | |
1143 | -re "$prompt $" { fail "set variable signed short array" } | |
1144 | timeout { fail "(timeout) set variable signed short array" } | |
1145 | } | |
1146 | ||
1147 | ||
1148 | # | |
1149 | # test "set variable" for "unsigned short array[2]" | |
1150 | # | |
1151 | send "set variable v_unsigned_short_array\[0\]=123\n" | |
1152 | expect -re "$prompt $" | |
1153 | send "set variable v_unsigned_short_array\[1\]=-456\n" | |
1154 | expect { | |
1155 | -re "set.*$prompt $"\ | |
1156 | { | |
1157 | send "print v_unsigned_short_array\n" | |
1158 | expect { | |
1159 | -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" { pass "set variable unsigned short array" } | |
1160 | -re "$prompt $" { fail "set variable unsigned short array" } | |
1161 | timeout { fail "(timeout) set variable unsigned short array" } | |
1162 | } | |
1163 | } | |
1164 | -re "$prompt $" { fail "set variable unsigned short array" } | |
1165 | timeout { fail "(timeout) set variable unsigned short array" } | |
1166 | } | |
1167 | ||
1168 | ||
1169 | # | |
1170 | # test "set variable" for "int array[2]" | |
1171 | # | |
1172 | send "set variable v_int_array\[0\]=123\n" | |
1173 | expect -re "$prompt $" | |
1174 | send "set variable v_int_array\[1\]=-456\n" | |
1175 | expect { | |
1176 | -re "set.*$prompt $"\ | |
1177 | { | |
1178 | send "print v_int_array\n" | |
1179 | expect { | |
1180 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable int array" } | |
1181 | -re "$prompt $" { fail "set variable int array" } | |
1182 | timeout { fail "(timeout) set variable int array" } | |
1183 | } | |
1184 | } | |
1185 | -re "$prompt $" { fail "set variable int array" } | |
1186 | timeout { fail "(timeout) set variable int array" } | |
1187 | } | |
1188 | ||
1189 | ||
1190 | # | |
1191 | # test "set variable" for "signed int array[2]" | |
1192 | # | |
1193 | send "set variable v_signed_int_array\[0\]=123\n" | |
1194 | expect -re "$prompt $" | |
1195 | send "set variable v_signed_int_array\[1\]=-456\n" | |
1196 | expect { | |
1197 | -re "set.*$prompt $"\ | |
1198 | { | |
1199 | send "print v_signed_int_array\n" | |
1200 | expect { | |
1201 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed int array" } | |
1202 | -re "$prompt $" { fail "set variable signed int array" } | |
1203 | timeout { fail "(timeout) set variable signed int array" } | |
1204 | } | |
1205 | } | |
1206 | -re "$prompt $" { fail "set variable signed int array" } | |
1207 | timeout { fail "(timeout) set variable signed int array" } | |
1208 | } | |
1209 | ||
1210 | ||
1211 | ||
1212 | # | |
1213 | # test "set variable" for "unsigned int array[2]" | |
1214 | # | |
1215 | send "set variable v_unsigned_int_array\[0\]=123\n" | |
1216 | expect -re "$prompt $" | |
1217 | send "set variable v_unsigned_int_array\[1\]=-456\n" | |
1218 | expect { | |
1219 | -re "set.*$prompt $"\ | |
1220 | { | |
1221 | send "print v_unsigned_int_array\n" | |
1222 | expect { | |
1223 | -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" { pass "set variable unsigned int array" } | |
1224 | -re "$prompt $" { fail "set variable unsigned int array" } | |
1225 | timeout { fail "(timeout) set variable unsigned int array" } | |
1226 | } | |
1227 | } | |
1228 | -re "$prompt $" { fail "set variable unsigned int array" } | |
1229 | timeout { fail "(timeout) set variable unsigned int array" } | |
1230 | } | |
1231 | ||
1232 | ||
1233 | # | |
1234 | # test "set variable" for "long array[2]" | |
1235 | # | |
1236 | send "set variable v_long_array\[0\]=123\n" | |
1237 | expect -re "$prompt $" | |
1238 | send "set variable v_long_array\[1\]=-456\n" | |
1239 | expect { | |
1240 | -re "set.*$prompt $"\ | |
1241 | { | |
1242 | send "print v_long_array\n" | |
1243 | expect { | |
1244 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable long array" } | |
1245 | -re "$prompt $" { fail "set variable long array" } | |
1246 | timeout { fail "(timeout) set variable long array" } | |
1247 | } | |
1248 | } | |
1249 | -re "$prompt $" { fail "set variable long array" } | |
1250 | timeout { fail "(timeout) set variable long array" } | |
1251 | } | |
1252 | ||
1253 | ||
1254 | # | |
1255 | # test "set variable" for "signed long array[2]" | |
1256 | # | |
1257 | send "set variable v_signed_long_array\[0\]=123\n" | |
1258 | expect -re "$prompt $" | |
1259 | send "set variable v_signed_long_array\[1\]=-456\n" | |
1260 | expect { | |
1261 | -re "set.*$prompt $"\ | |
1262 | { | |
1263 | send "print v_signed_long_array\n" | |
1264 | expect { | |
1265 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed long array" } | |
1266 | -re "$prompt $" { fail "set variable signed long array" } | |
1267 | timeout { fail "(timeout) set variable signed long array" } | |
1268 | } | |
1269 | } | |
1270 | -re "$prompt $" { fail "set variable signed long array" } | |
1271 | timeout { fail "(timeout) set variable signed long array" } | |
1272 | } | |
1273 | ||
1274 | ||
1275 | ||
1276 | # | |
1277 | # test "set variable" for "unsigned long array[2]" | |
1278 | # | |
1279 | send "set variable v_unsigned_long_array\[0\]=123\n" | |
1280 | expect -re "$prompt $" | |
1281 | send "set variable v_unsigned_long_array\[1\]=-456\n" | |
1282 | expect { | |
1283 | -re "$prompt $"\ | |
1284 | { | |
1285 | send "print v_unsigned_long_array\n" | |
1286 | expect { | |
1287 | -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" { pass "set variable unsigned long array" } | |
1288 | -re "$prompt $" { fail "set variable unsigned long array" } | |
1289 | timeout { fail "(timeout) set variable unsigned long array" } | |
1290 | } | |
1291 | } | |
1292 | -re "$prompt $" { fail "set variable unsigned long array" } | |
1293 | timeout { fail "(timeout) set variable unsigned long array" } | |
1294 | } | |
1295 | ||
1296 | ||
1297 | # | |
1298 | # test "set variable" for "float array[2]" | |
1299 | # | |
1300 | send "set variable v_float_array\[0\]=123.0\n" | |
1301 | expect -re "$prompt $" | |
1302 | send "set variable v_float_array\[1\]=-456.0\n" | |
1303 | expect { | |
1304 | -re "$prompt $"\ | |
1305 | { | |
1306 | send "print v_float_array\n" | |
1307 | expect { | |
1308 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable float array" } | |
1309 | -re "$prompt $" { fail "set variable float array" } | |
1310 | timeout { fail "(timeout) set variable float array" } | |
1311 | } | |
1312 | } | |
1313 | -re "$prompt $" { fail "set variable float array" } | |
1314 | timeout { fail "(timeout) set variable float array" } | |
1315 | } | |
1316 | ||
1317 | ||
1318 | # | |
1319 | # test "set variable" for "double array[2]" | |
1320 | # | |
1321 | send "set variable v_double_array\[0\]=123.0\n" | |
1322 | expect -re "$prompt $" | |
1323 | send "set variable v_double_array\[1\]=-456.0\n" | |
1324 | expect { | |
1325 | -re "$prompt $"\ | |
1326 | { | |
1327 | send "print v_double_array\n" | |
1328 | expect { | |
1329 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable double array" } | |
1330 | -re "$prompt $" { fail "set variable double array" } | |
1331 | timeout { fail "(timeout) set variable double array" } | |
1332 | } | |
1333 | } | |
1334 | -re "$prompt $" { fail "set variable double array" } | |
1335 | timeout { fail "(timeout) set variable double array" } | |
1336 | } | |
1337 | ||
1338 | ||
1339 | # | |
1340 | # test "set variable" for type "char *" | |
1341 | # | |
1342 | send "set v_char_pointer=v_char_array\n" | |
1343 | expect -re "set.*$prompt $" | |
1344 | send "set variable *(v_char_pointer)='h'\n" | |
1345 | expect -re "set.*$prompt $" | |
1346 | send "set variable *(v_char_pointer+1)='i'\n" | |
1347 | expect { | |
1348 | -re "set.*$prompt $" { | |
1349 | send "print v_char_array\n" | |
1350 | expect { | |
1351 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { | |
1352 | send "print *(v_char_pointer+1)\n" | |
1353 | expect { | |
1354 | -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable char pointer=\"hi\" (string)" } | |
1355 | -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" } | |
1356 | timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" } | |
1357 | ||
1358 | } | |
1359 | } | |
1360 | -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" } | |
1361 | timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" } | |
1362 | } | |
1363 | } | |
1364 | -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" } | |
1365 | timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" } | |
1366 | } | |
1367 | ||
1368 | ||
1369 | # | |
1370 | # test "set variable" for type "signed char *" | |
1371 | # | |
1372 | send "set v_signed_char_pointer=v_signed_char_array\n" | |
1373 | expect -re "set.*$prompt $" | |
1374 | send "set variable *(v_signed_char_pointer)='h'\n" | |
1375 | expect -re "set.*$prompt $" | |
1376 | send "set variable *(v_signed_char_pointer+1)='i'\n" | |
1377 | expect { | |
1378 | -re "set.*$prompt $" { | |
1379 | send "print v_signed_char_array\n" | |
1380 | expect { | |
1381 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { | |
1382 | send "print *(v_signed_char_pointer+1)\n" | |
1383 | expect { | |
1384 | -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable signed char pointer=\"hi\" (string)" } | |
1385 | -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" } | |
1386 | timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" } | |
1387 | ||
1388 | } | |
1389 | } | |
1390 | -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" } | |
1391 | timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" } | |
1392 | } | |
1393 | } | |
1394 | -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" } | |
1395 | timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" } | |
1396 | } | |
1397 | ||
1398 | ||
1399 | # | |
1400 | # test "set variable" for type "unsigned char *" | |
1401 | # | |
1402 | send "set v_unsigned_char_pointer=v_unsigned_char_array\n" | |
1403 | expect -re "set.*$prompt $" | |
1404 | send "set variable *(v_unsigned_char_pointer)='h'\n" | |
1405 | expect -re "set.*$prompt $" | |
1406 | send "set variable *(v_unsigned_char_pointer+1)='i'\n" | |
1407 | expect { | |
1408 | -re "set.*$prompt $" { | |
1409 | send "print v_unsigned_char_array\n" | |
1410 | expect { | |
1411 | -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { | |
1412 | send "print *(v_unsigned_char_pointer+1)\n" | |
1413 | expect { | |
1414 | -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable unsigned char pointer=\"hi\" (string)" } | |
1415 | -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" } | |
1416 | timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" } | |
1417 | ||
1418 | } | |
1419 | } | |
1420 | -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" } | |
1421 | timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" } | |
1422 | } | |
1423 | } | |
1424 | -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" } | |
1425 | timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" } | |
1426 | } | |
1427 | ||
1428 | ||
1429 | # | |
1430 | # test "set variable" for type "short *" | |
1431 | # | |
1432 | send "set v_short_pointer=v_short_array\n" | |
1433 | expect -re "set.*$prompt $" | |
1434 | send "set variable *(v_short_pointer)=123\n" | |
1435 | expect -re "set.*$prompt $" | |
1436 | send "set variable *(v_short_pointer+1)=-456\n" | |
1437 | expect { | |
1438 | -re "set.*$prompt $" { | |
1439 | send "print v_short_array\n" | |
1440 | expect { | |
1441 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1442 | send "print *(v_short_pointer+1)\n" | |
1443 | expect { | |
1444 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable short pointer" } | |
1445 | -re "$prompt $" { fail "set variable short pointer" } | |
1446 | timeout { fail "(timeout) set variable short pointer" } | |
1447 | ||
1448 | } | |
1449 | } | |
1450 | -re "$prompt $" { fail "set variable short pointer" } | |
1451 | timeout { fail "(timeout) set variable short pointer" } | |
1452 | } | |
1453 | } | |
1454 | -re "$prompt $" { fail "set variable short pointer" } | |
1455 | timeout { fail "(timeout) set variable short pointer" } | |
1456 | } | |
1457 | ||
1458 | ||
1459 | # | |
1460 | # test "set variable" for type "signed short *" | |
1461 | # | |
3c88a10a PS |
1462 | gdb_test "set v_signed_short_pointer=v_signed_short_array" "" |
1463 | gdb_test "set variable *(v_signed_short_pointer)=123" "" | |
1464 | gdb_test "set variable *(v_signed_short_pointer+1)=-456" "" | |
1465 | gdb_test "print v_signed_short_array" ".\[0-9\]* =.*\{123,.*-456\}" \ | |
1466 | "set variable signed short pointer" | |
1467 | gdb_test "print *(v_signed_short_pointer+1)" ".\[0-9\]*.*=.*-456" | |
ef44eed1 SS |
1468 | |
1469 | ||
1470 | # | |
1471 | # test "set variable" for type "unsigned short *" | |
1472 | # | |
3c88a10a PS |
1473 | gdb_test "set v_unsigned_short_pointer=v_unsigned_short_array" "" |
1474 | gdb_test "set variable *(v_unsigned_short_pointer)=123" "" | |
1475 | gdb_test "set variable *(v_unsigned_short_pointer+1)=-456" "" | |
1476 | gdb_test "print v_unsigned_short_array" ".\[0-9\]* =.*\{123,.*65080\}" \ | |
1477 | "set variable unsigned short pointer" | |
1478 | gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080" | |
ef44eed1 SS |
1479 | |
1480 | ||
1481 | # | |
1482 | # test "set variable" for type "int *" | |
1483 | # | |
1484 | send "set v_int_pointer=v_int_array\n" | |
1485 | expect -re "set.*$prompt $" | |
1486 | send "set variable *(v_int_pointer)=123\n" | |
1487 | expect -re "set.*$prompt $" | |
1488 | send "set variable *(v_int_pointer+1)=-456\n" | |
1489 | expect { | |
1490 | -re "set.*$prompt $" { | |
1491 | send "print v_int_array\n" | |
1492 | expect { | |
1493 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1494 | send "print *(v_int_pointer+1)\n" | |
1495 | expect { | |
1496 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable int pointer" } | |
1497 | -re "$prompt $" { fail "set variable int pointer" } | |
1498 | timeout { fail "(timeout) set variable int pointer" } | |
1499 | ||
1500 | } | |
1501 | } | |
1502 | -re "$prompt $" { fail "set variable int pointer" } | |
1503 | timeout { fail "(timeout) set variable int pointer" } | |
1504 | } | |
1505 | } | |
1506 | -re "$prompt $" { fail "set variable int pointer" } | |
1507 | timeout { fail "(timeout) set variable int pointer" } | |
1508 | } | |
1509 | ||
1510 | ||
1511 | # | |
1512 | # test "set variable" for type "signed int *" | |
1513 | # | |
1514 | send "set v_signed_int_pointer=v_signed_int_array\n" | |
1515 | expect -re "set.*$prompt $" | |
1516 | send "set variable *(v_signed_int_pointer)=123\n" | |
1517 | expect -re "set.*$prompt $" | |
1518 | send "set variable *(v_signed_int_pointer+1)=-456\n" | |
1519 | expect { | |
1520 | -re "set.*$prompt $" { | |
1521 | send "print v_signed_int_array\n" | |
1522 | expect { | |
1523 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1524 | send "print *(v_signed_int_pointer+1)\n" | |
1525 | expect { | |
1526 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed int pointer" } | |
1527 | -re "$prompt $" { fail "set variable signed int pointer" } | |
1528 | timeout { fail "(timeout) set variable signed int pointer" } | |
1529 | ||
1530 | } | |
1531 | } | |
1532 | -re "$prompt $" { fail "set variable signed int pointer" } | |
1533 | timeout { fail "(timeout) set variable signed int pointer" } | |
1534 | } | |
1535 | } | |
1536 | -re "$prompt $" { fail "set variable signed int pointer" } | |
1537 | timeout { fail "(timeout) set variable signed int pointer" } | |
1538 | } | |
1539 | ||
1540 | ||
1541 | # | |
1542 | # test "set variable" for type "unsigned int *" | |
1543 | # | |
1544 | send "set v_unsigned_int_pointer=v_unsigned_int_array\n" | |
1545 | expect -re "set.*$prompt $" | |
1546 | send "set variable *(v_unsigned_int_pointer)=123\n" | |
1547 | expect -re "set.*$prompt $" | |
1548 | send "set variable *(v_unsigned_int_pointer+1)=-456\n" | |
1549 | expect { | |
1550 | -re "set.*$prompt $" { | |
1551 | send "print v_unsigned_int_array\n" | |
1552 | expect { | |
1553 | -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" { | |
1554 | send "print *(v_unsigned_int_pointer+1)\n" | |
1555 | expect { | |
1556 | -re "print.*.\[0-9\]* = 4294966840.*$prompt $" { pass "set variable unsigned int pointer" } | |
1557 | -re "$prompt $" { fail "set variable unsigned int pointer" } | |
1558 | timeout { fail "(timeout) set variable unsigned int pointer" } | |
1559 | ||
1560 | } | |
1561 | } | |
1562 | -re "$prompt $" { fail "set variable unsigned int pointer" } | |
1563 | timeout { fail "(timeout) set variable unsigned int pointer" } | |
1564 | } | |
1565 | } | |
1566 | -re "$prompt $" { fail "set variable unsigned int pointer" } | |
1567 | timeout { fail "(timeout) set variable unsigned int pointer" } | |
1568 | } | |
1569 | ||
1570 | ||
1571 | # | |
1572 | # test "set variable" for type "long *" | |
1573 | # | |
1574 | send "set v_long_pointer=v_long_array\n" | |
1575 | expect -re "set.*$prompt $" | |
1576 | send "set variable *(v_long_pointer)=123\n" | |
1577 | expect -re "set.*$prompt $" | |
1578 | send "set variable *(v_long_pointer+1)=-456\n" | |
1579 | expect { | |
1580 | -re "set.*$prompt $" { | |
1581 | send "print v_long_array\n" | |
1582 | expect { | |
1583 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1584 | send "print *(v_long_pointer+1)\n" | |
1585 | expect { | |
1586 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable long pointer" } | |
1587 | -re "$prompt $" { fail "set variable long pointer" } | |
1588 | timeout { fail "(timeout) set variable long pointer" } | |
1589 | ||
1590 | } | |
1591 | } | |
1592 | -re "$prompt $" { fail "set variable long pointer" } | |
1593 | timeout { fail "(timeout) set variable long pointer" } | |
1594 | } | |
1595 | } | |
1596 | -re "$prompt $" { fail "set variable long pointer" } | |
1597 | timeout { fail "(timeout) set variable long pointer" } | |
1598 | } | |
1599 | ||
1600 | ||
1601 | # | |
1602 | # test "set variable" for type "signed long *" | |
1603 | # | |
1604 | send "set v_signed_long_pointer=v_signed_long_array\n" | |
1605 | expect -re "set.*$prompt $" | |
1606 | send "set variable *(v_signed_long_pointer)=123\n" | |
1607 | expect -re "set.*$prompt $" | |
1608 | send "set variable *(v_signed_long_pointer+1)=-456\n" | |
1609 | expect { | |
1610 | -re "set.*$prompt $" { | |
1611 | send "print v_signed_long_array\n" | |
1612 | expect { | |
1613 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1614 | send "print *(v_signed_long_pointer+1)\n" | |
1615 | expect { | |
1616 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed long pointer" } | |
1617 | -re "$prompt $" { fail "set variable signed long pointer" } | |
1618 | timeout { fail "(timeout) set variable signed long pointer" } | |
1619 | ||
1620 | } | |
1621 | } | |
1622 | -re "$prompt $" { fail "set variable signed long pointer" } | |
1623 | timeout { fail "(timeout) set variable signed long pointer" } | |
1624 | } | |
1625 | } | |
1626 | -re "$prompt $" { fail "set variable signed long pointer" } | |
1627 | timeout { fail "(timeout) set variable signed long pointer" } | |
1628 | } | |
1629 | ||
1630 | ||
1631 | # | |
1632 | # test "set variable" for type "unsigned long *" | |
1633 | # | |
1634 | send "set v_unsigned_long_pointer=v_unsigned_long_array\n" | |
1635 | expect -re "set.*$prompt $" | |
1636 | send "set variable *(v_unsigned_long_pointer)=123\n" | |
1637 | expect -re "set.*$prompt $" | |
1638 | send "set variable *(v_unsigned_long_pointer+1)=-456\n" | |
1639 | expect { | |
1640 | -re "set.*$prompt $" { | |
1641 | send "print v_unsigned_long_array\n" | |
1642 | expect { | |
1643 | -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" { | |
1644 | send "print *(v_unsigned_long_pointer+1)\n" | |
1645 | expect { | |
1646 | -re "print.*.\[0-9\]* = $ulong_minus_456.*$prompt $" { pass "set variable unsigned long pointer" } | |
1647 | -re "$prompt $" { fail "set variable unsigned long pointer" } | |
1648 | timeout { fail "(timeout) set variable unsigned long pointer" } | |
1649 | ||
1650 | } | |
1651 | } | |
1652 | -re "$prompt $" { fail "set variable unsigned long pointer" } | |
1653 | timeout { fail "(timeout) set variable unsigned long pointer" } | |
1654 | } | |
1655 | } | |
1656 | -re "$prompt $" { fail "set variable unsigned long pointer" } | |
1657 | timeout { fail "(timeout) set variable unsigned long pointer" } | |
1658 | } | |
1659 | ||
1660 | ||
1661 | # | |
1662 | # test "set variable" for type "float *" | |
1663 | # | |
1664 | send "set v_float_pointer=v_float_array\n" | |
1665 | expect -re "set.*$prompt $" | |
1666 | send "set variable *(v_float_pointer)=123.0\n" | |
1667 | expect -re "set.*$prompt $" | |
1668 | send "set variable *(v_float_pointer+1)=-456.0\n" | |
1669 | expect { | |
1670 | -re "set.*$prompt $" { | |
1671 | send "print v_float_array\n" | |
1672 | expect { | |
1673 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1674 | send "print *(v_float_pointer+1)\n" | |
1675 | expect { | |
1676 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable float pointer" } | |
1677 | -re "$prompt $" { fail "set variable float pointer" } | |
1678 | timeout { fail "(timeout) set variable float pointer" } | |
1679 | ||
1680 | } | |
1681 | } | |
1682 | -re "$prompt $" { fail "set variable float pointer" } | |
1683 | timeout { fail "(timeout) set variable float pointer" } | |
1684 | } | |
1685 | } | |
1686 | -re "$prompt $" { fail "set variable float pointer" } | |
1687 | timeout { fail "(timeout) set variable float pointer" } | |
1688 | } | |
1689 | ||
1690 | ||
1691 | # | |
1692 | # test "set variable" for type "double *" | |
1693 | # | |
1694 | send "set v_double_pointer=v_double_array\n" | |
1695 | expect -re "set.*$prompt $" | |
1696 | send "set variable *(v_double_pointer)=123.0\n" | |
1697 | expect -re "set.*$prompt $" | |
1698 | send "set variable *(v_double_pointer+1)=-456.0\n" | |
1699 | expect { | |
1700 | -re "set.*$prompt $" { | |
1701 | send "print v_double_array\n" | |
1702 | expect { | |
1703 | -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { | |
1704 | send "print *(v_double_pointer+1)\n" | |
1705 | expect { | |
1706 | -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable double pointer" } | |
1707 | -re "$prompt $" { fail "set variable double pointer" } | |
1708 | timeout { fail "(timeout) set variable double pointer" } | |
1709 | ||
1710 | } | |
1711 | } | |
1712 | -re "$prompt $" { fail "set variable double pointer" } | |
1713 | timeout { fail "(timeout) set variable double pointer" } | |
1714 | } | |
1715 | } | |
1716 | -re "$prompt $" { fail "set variable double pointer" } | |
1717 | timeout { fail "(timeout) set variable double pointer" } | |
1718 | } | |
1719 | ||
1720 | ||
1721 | # | |
1722 | # test "set variable" for struct members | |
1723 | # | |
1724 | send "set variable v_struct1.v_char_member='h'\n" | |
1725 | expect { | |
1726 | -re "set.*$prompt $"\ | |
1727 | { | |
1728 | send "print v_struct1.v_char_member\n" | |
1729 | expect { | |
1730 | -re "print.*.\[0-9\]* = 104 \'h\'.*$prompt $" { pass "set variable structure char member" } | |
1731 | -re "$prompt $" { fail "set variable structure char member" } | |
1732 | timeout { fail "(timeout) set variable structure char member" } | |
1733 | } | |
1734 | } | |
1735 | -re "$prompt $" { fail "set variable structure char member" } | |
1736 | timeout { fail "(timeout) set variable structure char member" } | |
1737 | } | |
1738 | ||
1739 | ||
1740 | send "set variable v_struct1.v_short_member=1\n" | |
1741 | expect { | |
1742 | -re "set.*$prompt $"\ | |
1743 | { | |
1744 | send "print v_struct1.v_short_member\n" | |
1745 | expect { | |
1746 | -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "set variable structure short member" } | |
1747 | -re "$prompt $" { fail "set variable structure short member" } | |
1748 | timeout { fail "(timeout) set variable structure short member" } | |
1749 | } | |
1750 | } | |
1751 | -re "$prompt $" { fail "set variable structure short member" } | |
1752 | timeout { fail "(timeout) set variable structure short member" } | |
1753 | } | |
1754 | ||
1755 | ||
1756 | send "set variable v_struct1.v_int_member=2\n" | |
1757 | expect { | |
1758 | -re "set.*$prompt $"\ | |
1759 | { | |
1760 | send "print v_struct1.v_int_member\n" | |
1761 | expect { | |
1762 | -re "print.*.\[0-9\]* = 2.*$prompt $" { pass "set variable structure int member" } | |
1763 | -re "$prompt $" { fail "set variable structure int member" } | |
1764 | timeout { fail "(timeout) set variable structure int member" } | |
1765 | } | |
1766 | } | |
1767 | -re "$prompt $" { fail "set variable structure int member" } | |
1768 | timeout { fail "(timeout) set variable structure int member" } | |
1769 | } | |
1770 | ||
1771 | ||
1772 | send "set variable v_struct1.v_long_member=3\n" | |
1773 | expect { | |
1774 | -re "set.*$prompt $"\ | |
1775 | { | |
1776 | send "print v_struct1.v_long_member\n" | |
1777 | expect { | |
1778 | -re "print.*.\[0-9\]* = 3.*$prompt $" { pass "set variable structure long member" } | |
1779 | -re "$prompt $" { fail "set variable structure long member" } | |
1780 | timeout { fail "(timeout) set variable structure long member" } | |
1781 | } | |
1782 | } | |
1783 | -re "$prompt $" { fail "set variable structure long member" } | |
1784 | timeout { fail "(timeout) set variable structure long member" } | |
1785 | } | |
1786 | ||
1787 | ||
1788 | send "set variable v_struct1.v_float_member=4.0\n" | |
1789 | expect { | |
1790 | -re "set.*$prompt $"\ | |
1791 | { | |
1792 | send "print v_struct1.v_float_member\n" | |
1793 | expect { | |
1794 | -re "print.*.\[0-9\]* = 4.*$prompt $" { pass "set variable structure float member" } | |
1795 | -re "$prompt $" { fail "set variable structure float member" } | |
1796 | timeout { fail "(timeout) set variable structure float member" } | |
1797 | } | |
1798 | } | |
1799 | -re "$prompt $" { fail "set variable structure float member" } | |
1800 | timeout { fail "(timeout) set variable structure float member" } | |
1801 | } | |
1802 | ||
1803 | ||
1804 | send "set variable v_struct1.v_double_member=5.0\n" | |
1805 | expect { | |
1806 | -re "set.*$prompt $"\ | |
1807 | { | |
1808 | send "print v_struct1.v_double_member\n" | |
1809 | expect { | |
1810 | -re "print.*.\[0-9\]* = 5.*$prompt $" { pass "set variable structure double member" } | |
1811 | -re "$prompt $" { fail "set variable structure double member" } | |
1812 | timeout { fail "(timeout) set variable structure double member" } | |
1813 | } | |
1814 | } | |
1815 | -re "$prompt $" { fail "set variable structure double member" } | |
1816 | timeout { fail "(timeout) set variable structure double member" } | |
1817 | } | |
1818 | ||
1819 | ||
3c88a10a PS |
1820 | gdb_test "print v_struct1" \ |
1821 | "print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\ | |
1822 | .*v_int_member = 2,.*\ | |
1823 | v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \ | |
1824 | "set print structure #1" | |
1825 | ||
1826 | # This should be an error. GCC extensions for structure constants require | |
1827 | # the type of the structure to be specified, as in | |
1828 | # v_struct1 = (struct t_struct) {32, 33, 34, 35, 36, 37} | |
1829 | # GDB should do the same if it wants to provide this feature. | |
1830 | gdb_test "set variable v_struct1 = {32, 33, 34, 35, 36, 37}" "Invalid.*" | |
1831 | ||
1832 | # And after the error the structure should be unchanged. | |
1833 | gdb_test "print v_struct1" \ | |
1834 | "print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\ | |
1835 | .*v_int_member = 2,.*\ | |
1836 | v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \ | |
1837 | "set print structure #2" | |
1838 | ||
1839 | # Test printing of enumeration bitfields. | |
1840 | # GNU C supports them, some other compilers don't. | |
1841 | ||
1842 | if {$gcc_compiled} then { | |
1843 | gdb_test "print sef.field=sm1" "print.*.\[0-9\]* = sm1" | |
1844 | gdb_test "print sef.field" "print.*.\[0-9\]* = sm1" "print sef.field (sm1)" | |
1845 | gdb_test "print sef.field=s1" "print.*.\[0-9\]* = s1" | |
1846 | gdb_test "print sef.field" "print.*.\[0-9\]* = s1" "print sef.field (s1)" | |
1847 | gdb_test "print uef.field=u1" "print.*.\[0-9\]* = u1" | |
1848 | gdb_test "print uef.field" "print.*.\[0-9\]* = u1" "print uef.field (u1)" | |
1849 | gdb_test "print uef.field=u2" "print.*.\[0-9\]* = u2" | |
1850 | gdb_test "print uef.field" "print.*.\[0-9\]* = u2" "print uef.field (u2)" | |
ef44eed1 | 1851 | } |