1 # Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Rob Savoye. (rob@cygnus.com)
27 # test running programs
34 if ![file exists $objdir/$subdir/$binfile] then {
35 perror "$objdir/$subdir/$binfile does not exist."
41 gdb_reinitialize_dir $srcdir/$subdir
42 gdb_load $objdir/$subdir/$binfile
45 # set it up at a breakpoint so we canplay with the variable values
47 send "set print sevenbit-strings\n" ; expect -re "$prompt $"
49 if ![runto main] then {
50 perror "couldn't run to breakpoint"
54 # Determine expected output for unsigned long variables,
55 # the output varies with sizeof (unsigned long).
57 set ulong_minus_1 4294967295
58 set ulong_minus_456 4294966840
59 send "print sizeof (unsigned long)\n"
61 -re ".\[0-9\]* = 4.*$prompt $" {}
62 -re ".\[0-9\]* = 8.*$prompt $" {
63 set ulong_minus_1 18446744073709551615
64 set ulong_minus_456 18446744073709551160
67 fail "getting sizeof unsigned long"
69 default { fail "(timeout) getting sizeof unsigned long" }
73 # test "set variable" for type "char"
75 # Because bare char types can be either signed or unsigned, we just test the
76 # range of values that are common to both (0-127).
78 send "set variable v_char=0\n"
84 -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable char=0" }
85 -re "$prompt $" { fail "set variable char=0" }
86 timeout { fail "(timeout) set variable char=0" }
89 -re "$prompt $" { fail "set variable char=0" }
90 timeout { fail "(timeout) set variable char=0" }
94 send "set variable v_char=1\n"
100 -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable char=1" }
101 -re "$prompt $" { fail "set variable char=1" }
102 timeout { fail "(timeout) set variable char=1" }
105 -re "$prompt $" { fail "set variable char=1" }
106 timeout { fail "(timeout) set variable char=1" }
110 send "set variable v_char=27\n"
114 send "print v_char\n"
116 -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable char=27 (Esc)" }
117 -re "$prompt $" { fail "set variable char=27 (Esc)" }
118 timeout { fail "(timeout) set variable char=27 (Esc)" }
121 -re "$prompt $" { fail "set variable char=27 (Esc)" }
122 timeout { fail "(timeout) set variable char=27 (Esc)" }
126 send "set variable v_char=32\n"
130 send "print v_char\n"
132 -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable char=32 (SPC)" }
133 -re "$prompt $" { fail "set variable char=32 (SPC)" }
134 timeout { fail "(timeout) set variable char=32 (SPC)" }
137 -re "$prompt $" { fail "set variable char=32 (SPC)" }
138 timeout { fail "(timeout) set variable char=32 (SPC)" }
142 send "set variable v_char=65\n"
146 send "print v_char\n"
148 -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable char=65 ('A')" }
149 -re "$prompt $" { fail "set variable char=65 ('A')" }
150 timeout { fail "(timeout) set variable char=65 ('A')" }
153 -re "$prompt $" { fail "set variable char=65 ('A')" }
154 timeout { fail "(timeout) set variable char=65 ('A')" }
158 send "set variable v_char=97\n"
162 send "print v_char\n"
164 -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable char=97 ('a')" }
165 -re "$prompt $" { fail "set variable char=97 ('a')" }
166 timeout { fail "(timeout) set variable char=97 ('a')" }
169 -re "$prompt $" { fail "set variable char=97 ('a')" }
170 timeout { fail "(timeout) set variable char=97 ('a')" }
174 send "set variable v_char=126\n"
178 send "print v_char\n"
180 -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable char=126 ('~')" }
181 -re "$prompt $" { fail "set variable char=126 ('~')" }
182 timeout { fail "(timeout) set variable char=126 ('~')" }
185 -re "$prompt $" { fail "set variable char=126 ('~')" }
186 timeout { fail "(timeout) set variable char=126 ('~')" }
190 send "set variable v_char=127\n"
194 send "print v_char\n"
196 -re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable char=127 (8-bit)" }
197 -re "$prompt $" { fail "set variable char=127 (8-bit)" }
198 timeout { fail "(timeout) set variable char=127 (8-bit)" }
201 -re "$prompt $" { fail "set variable char=127 (8-bit)" }
202 timeout { fail "(timeout) set variable char=127 (8-bit)" }
207 # test "set variable" for type "signed char"
209 send "set variable v_char=0\n"
213 send "print v_signed_char\n"
215 -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable signed char=0" }
216 -re "$prompt $" { fail "set variable signed char=0" }
217 timeout { fail "(timeout) set variable signed char=0" }
220 -re "$prompt $" { fail "set variable signed char=0" }
221 timeout { fail "(timeout) set variable signed char=0" }
225 send "set variable v_signed_char=1\n"
229 send "print v_signed_char\n"
231 -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable signed char=1" }
232 -re "$prompt $" { fail "set variable signed char=1" }
233 timeout { fail "(timeout) set variable signed char=1" }
236 -re "$prompt $" { fail "set variable signed char=1" }
237 timeout { fail "(timeout) set variable signed char=1" }
241 send "set variable v_signed_char=27\n"
245 send "print v_signed_char\n"
247 -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable signed char=27 (Esc)" }
248 -re "$prompt $" { fail "set variable signed char=27 (Esc)" }
249 timeout { fail "(timeout) set variable signed char=27 (Esc)" }
252 -re "$prompt $" { fail "set variable signed char=27 (Esc)" }
253 timeout { fail "(timeout) set variable signed char=27 (Esc)" }
257 send "set variable v_signed_char=32\n"
261 send "print v_signed_char\n"
263 -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable signed char=32 (SPC)" }
264 -re "$prompt $" { fail "set variable signed char=32 (SPC)" }
265 timeout { fail "(timeout) set variable signed char=32 (SPC)" }
268 -re "$prompt $" { fail "set variable signed char=32 (SPC)" }
269 timeout { fail "(timeout) set variable signed char=32 (SPC)" }
273 send "set variable v_signed_char=65\n"
277 send "print v_signed_char\n"
279 -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable signed char=65 ('A')" }
280 -re "$prompt $" { fail "set variable signed char=65 ('A')" }
281 timeout { fail "(timeout) set variable signed char=65 ('A')" }
284 -re "$prompt $" { fail "set variable signed char=65 ('A')" }
285 timeout { fail "(timeout) set variable signed char=65 ('A')" }
289 send "set variable v_signed_char=97\n"
293 send "print v_signed_char\n"
295 -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable signed char=97 ('a')" }
296 -re "$prompt $" { fail "set variable signed char=97 ('a')" }
297 timeout { fail "(timeout) set variable signed char=97 ('a')" }
300 -re "$prompt $" { fail "set variable signed char=97 ('a')" }
301 timeout { fail "(timeout) set variable signed char=97 ('a')" }
305 send "set variable v_signed_char=126\n"
309 send "print v_signed_char\n"
311 -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable signed char=126 ('~')" }
312 -re "$prompt $" { fail "set variable signed char=126 ('~')" }
313 timeout { fail "(timeout) set variable signed char=126 ('~')" }
316 -re "$prompt $" { fail "set variable signed char=126 ('~')" }
317 timeout { fail "(timeout) set variable signed char=126 ('~')" }
321 send "set variable v_signed_char=127\n"
325 send "print v_signed_char\n"
327 -re ".\[0-9\]* = 127 \'.177\'.*$prompt $" { pass "set variable signed char=127 (8-bit)" }
328 -re "$prompt $" { fail "set variable signed char=127 (8-bit)" }
329 timeout { fail "(timeout) set variable signed char=127 (8-bit)" }
332 -re "$prompt $" { fail "set variable signed char=127 (8-bit)" }
333 timeout { fail "(timeout) set variable signed char=127 (8-bit)" }
337 send "set variable v_signed_char=-1\n"
341 send "print v_signed_char\n"
343 -re ".\[0-9\]* = -1 \'.377\'.*$prompt $" { pass "set variable signed char=-1 (-1)" }
344 -re "$prompt $" { fail "set variable signed char=-1 (minus)" }
345 timeout { fail "(timeout) set variable signed char=-1 (minus)" }
348 -re "$prompt $" { fail "set variable signed char=-1 (minus)" }
349 timeout { fail "(timeout) set variable signed char=-1 (minus)" }
353 send "set variable v_signed_char=0xFF\n"
357 send "print v_signed_char\n"
359 -re ".\[0-9\]* = -1 \'.377\'.*$prompt $" { pass "set variable signed char=0xFF (0xFF)" }
360 -re "$prompt $" { fail "set variable signed char=0xFF (hex)" }
361 timeout { fail "(timeout) set variable signed char=0xFF (hex)" }
364 -re "$prompt $" { fail "set variable signed char=0xFF (hex)" }
365 timeout { fail "(timeout) set variable signed char=0xFF (hex)" }
370 # test "set variable" for type "unsigned char"
372 send "set variable v_unsigned_char=0\n"
376 send "print v_unsigned_char\n"
378 -re ".\[0-9\]* = 0 \'.000\'.*$prompt $" { pass "set variable unsigned char=0" }
379 -re "$prompt $" { fail "set variable unsigned char=0" }
380 timeout { fail "(timeout) set variable unsigned char=0" }
383 -re "$prompt $" { fail "set variable unsigned char=0" }
384 timeout { fail "(timeout) set variable unsigned char=0" }
388 send "set variable v_unsigned_char=1\n"
392 send "print v_unsigned_char\n"
394 -re ".\[0-9\]* = 1 \'.001\'.*$prompt $" { pass "set variable unsigned char=1" }
395 -re "$prompt $" { fail "set variable unsigned char=1" }
396 timeout { fail "(timeout) set variable unsigned char=1" }
399 -re "$prompt $" { fail "set variable unsigned char=1" }
400 timeout { fail "(timeout) set variable unsigned char=1" }
404 send "set variable v_unsigned_char=27\n"
408 send "print v_unsigned_char\n"
410 -re ".\[0-9\]* = 27 \'.e\'.*$prompt $" { pass "set variable unsigned char=27 (Esc)" }
411 -re "$prompt $" { fail "set variable unsigned char=27 (Esc)" }
412 timeout { fail "(timeout) set variable unsigned char=27 (Esc)" }
415 -re "$prompt $" { fail "set variable unsigned char=27 (Esc)" }
416 timeout { fail "(timeout) set variable unsigned char=27 (Esc)" }
420 send "set variable v_unsigned_char=32\n"
424 send "print v_unsigned_char\n"
426 -re ".\[0-9\]* = 32 \' \'.*$prompt $" { pass "set variable unsigned char=32 (SPC)" }
427 -re "$prompt $" { fail "set variable unsigned char=32 (SPC)" }
428 timeout { fail "(timeout) set variable unsigned char=32 (SPC)" }
431 -re "$prompt $" { fail "set variable unsigned char=32 (SPC)" }
432 timeout { fail "(timeout) set variable unsigned char=32 (SPC)" }
436 send "set variable v_unsigned_char=65\n"
440 send "print v_unsigned_char\n"
442 -re ".\[0-9\]* = 65 \'A\'.*$prompt $" { pass "set variable unsigned char=65 ('A')" }
443 -re "$prompt $" { fail "set variable unsigned char=65 ('A')" }
444 timeout { fail "(timeout) set variable unsigned char=65 ('A')" }
447 -re "$prompt $" { fail "set variable unsigned char=65 ('A')" }
448 timeout { fail "(timeout) set variable unsigned char=65 ('A')" }
452 send "set variable v_unsigned_char=97\n"
456 send "print v_unsigned_char\n"
458 -re ".\[0-9\]* = 97 \'a\'.*$prompt $" { pass "set variable unsigned char=97 ('a')" }
459 -re "$prompt $" { fail "set variable unsigned char=97 ('a')" }
460 timeout { fail "(timeout) set variable unsigned char=97 ('a')" }
463 -re "$prompt $" { fail "set variable unsigned char=97 ('a')" }
464 timeout { fail "(timeout) set variable unsigned char=97 ('a')" }
468 send "set variable v_unsigned_char=126\n"
472 send "print v_unsigned_char\n"
474 -re ".\[0-9\]* = 126 \'~\'.*$prompt $" { pass "set variable unsigned char=126 ('~')" }
475 -re "$prompt $" { fail "set variable unsigned char=126 ('~')" }
476 timeout { fail "(timeout) set variable unsigned char=126 ('~')" }
479 -re "$prompt $" { fail "set variable unsigned char=126 ('~')" }
480 timeout { fail "(timeout) set variable unsigned char=126 ('~')" }
484 send "set variable v_unsigned_char=~0\n"
488 send "print v_unsigned_char\n"
490 -re ".\[0-9\]* = 255 \'.377\'.*$prompt $" { pass "set variable unsigned char=255 (8-bit)" }
491 -re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" }
492 timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" }
495 -re "$prompt $" { fail "set variable unsigned char=255 (8-bit)" }
496 timeout { fail "(timeout) set variable unsigned char=255 (8-bit)" }
501 # test "set variable" for type "short"
503 send "set variable v_short=0\n"
507 send "print v_short\n"
509 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable short=0" }
510 -re "$prompt $" { fail "set variable short=0" }
511 timeout { fail "(timeout) set variable short=0" }
514 -re "$prompt $" { fail "set variable short=0" }
515 timeout { fail "(timeout) set variable short=0" }
519 send "set variable v_short=1\n"
523 send "print v_short\n"
525 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable short=1" }
526 -re "$prompt $" { fail "set variable short=1" }
527 timeout { fail "(timeout) set variable short=1" }
530 -re "$prompt $" { fail "set variable short=1" }
531 timeout { fail "(timeout) set variable short=1" }
535 send "set variable v_short=-1\n"
539 send "print v_short\n"
541 -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable short=-1 (minus)" }
542 -re "$prompt $" { fail "set variable short=-1 (minus)" }
543 timeout { fail "(timeout) set variable signed short=-1 (minus)" }
546 -re "$prompt $" { fail "set variable short=-1 (minus)" }
547 timeout { fail "(timeout) set variable short=-1 (minus)" }
552 # test "set variable" for type "signed short"
554 send "set variable v_signed_short=0\n"
558 send "print v_signed_short\n"
560 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed short=0" }
561 -re "$prompt $" { fail "set variable signed short=0" }
562 timeout { fail "(timeout) set variable signed short=0" }
565 -re "$prompt $" { fail "set variable signed short=0" }
566 timeout { fail "(timeout) set variable signed short=0" }
570 send "set variable v_signed_short=1\n"
574 send "print v_signed_short\n"
576 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed short=1" }
577 -re "$prompt $" { fail "set variable signed short=1" }
578 timeout { fail "(timeout) set variable signed short=1" }
581 -re "$prompt $" { fail "set variable signed short=1" }
582 timeout { fail "(timeout) set variable signed short=1" }
586 send "set variable v_signed_short=-1\n"
590 send "print v_signed_short\n"
592 -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed short=-1 (minus)" }
593 -re "$prompt $" { fail "set variable signed short=-1 (minus)" }
594 timeout { fail "(timeout) set variable signed short=-1 (minus)" }
597 -re "$prompt $" { fail "set variable signed short=-1 (minus)" }
598 timeout { fail "(timeout) set variable signed short=-1 (minus)" }
603 # test "set variable" for type "unsigned short"
605 send "set variable v_unsigned_short=0\n"
609 send "print v_unsigned_short\n"
611 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned short=0" }
612 -re "$prompt $" { fail "set variable unsigned short=0" }
613 timeout { fail "(timeout) set variable unsigned short=0" }
616 -re "$prompt $" { fail "set variable unsigned short=0" }
617 timeout { fail "(timeout) set variable unsigned short=0" }
621 send "set variable v_unsigned_short=1\n"
625 send "print v_unsigned_short\n"
627 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned short=1" }
628 -re "$prompt $" { fail "set variable unsigned short=1" }
629 timeout { fail "(timeout) set variable unsigned short=1" }
632 -re "$prompt $" { fail "set variable unsigned short=1" }
633 timeout { fail "(timeout) set variable unsigned short=1" }
637 send "set variable v_unsigned_short=~0\n"
641 send "print v_unsigned_short\n"
643 -re ".\[0-9\]* = 65535.*$prompt $" { pass "set variable unsigned short=~0 (minus)" }
644 -re "$prompt $" { fail "set variable unsigned short=~0 (minus)" }
645 timeout { fail "(timeout) set variable unsigned short=~0 (minus)" }
648 -re "$prompt $" { fail "set variable unsigned short=~0 (minus)" }
649 timeout { fail "(timeout) set variable unsigned short=~0 (minus)" }
654 # test "set variable" for type "int"
656 send "set variable v_int=0\n"
662 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable int=0" }
663 -re "$prompt $" { fail "set variable int=0" }
664 timeout { fail "(timeout) set variable int=0" }
667 -re "$prompt $" { fail "set variable int=0" }
668 timeout { fail "(timeout) set variable int=0" }
672 send "set variable v_int=1\n"
678 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable int=1" }
679 -re "$prompt $" { fail "set variable int=1" }
680 timeout { fail "(timeout) set variable int=1" }
683 -re "$prompt $" { fail "set variable int=1" }
684 timeout { fail "(timeout) set variable int=1" }
688 send "set variable v_int=-1\n"
694 -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable int=-1 (minus)" }
695 -re "$prompt $" { fail "set variable int=-1 (minus)" }
696 timeout { fail "(timeout) set variable signed int=-1 (minus)" }
699 -re "$prompt $" { fail "set variable int=-1 (minus)" }
700 timeout { fail "(timeout) set variable int=-1 (minus)" }
705 # test "set variable" for type "signed int"
707 send "set variable v_signed_int=0\n"
711 send "print v_signed_int\n"
713 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed int=0" }
714 -re "$prompt $" { fail "set variable signed int=0" }
715 timeout { fail "(timeout) set variable signed int=0" }
718 -re "$prompt $" { fail "set variable signed int=0" }
719 timeout { fail "(timeout) set variable signed int=0" }
723 send "set variable v_signed_int=1\n"
727 send "print v_signed_int\n"
729 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed int=1" }
730 -re "$prompt $" { fail "set variable signed int=1" }
731 timeout { fail "(timeout) set variable signed int=1" }
734 -re "$prompt $" { fail "set variable signed int=1" }
735 timeout { fail "(timeout) set variable signed int=1" }
739 send "set variable v_signed_int=-1\n"
743 send "print v_signed_int\n"
745 -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed int=-1 (minus)" }
746 -re "$prompt $" { fail "set variable signed int=-1 (minus)" }
747 timeout { fail "(timeout) set variable signed int=-1 (minus)" }
750 -re "$prompt $" { fail "set variable signed int=-1 (minus)" }
751 timeout { fail "(timeout) set variable signed int=-1 (minus)" }
756 # test "set variable" for type "unsigned int"
758 send "set variable v_unsigned_int=0\n"
762 send "print v_unsigned_int\n"
764 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned int=0" }
765 -re "$prompt $" { fail "set variable unsigned int=0" }
766 timeout { fail "(timeout) set variable unsigned int=0" }
769 -re "$prompt $" { fail "set variable unsigned int=0" }
770 timeout { fail "(timeout) set variable unsigned int=0" }
774 send "set variable v_unsigned_int=1\n"
778 send "print v_unsigned_int\n"
780 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned int=1" }
781 -re "$prompt $" { fail "set variable unsigned int=1" }
782 timeout { fail "(timeout) set variable unsigned int=1" }
785 -re "$prompt $" { fail "set variable unsigned int=1" }
786 timeout { fail "(timeout) set variable unsigned int=1" }
790 send "set variable v_unsigned_int=~0\n"
794 send "print v_unsigned_int\n"
796 -re ".\[0-9\]* = 4294967295.*$prompt $" { pass "set variable unsigned int=~0 (minus)" }
797 -re "$prompt $" { fail "set variable unsigned int=~0 (minus)" }
798 timeout { fail "(timeout) set variable unsigned int=~0 (minus)" }
801 -re "$prompt $" { fail "set variable unsigned int=~0 (minus)" }
802 timeout { fail "(timeout) set variable unsigned int=~0 (minus)" }
807 # test "set variable" for type "long"
809 send "set variable v_long=0\n"
813 send "print v_long\n"
815 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable long=0" }
816 -re "$prompt $" { fail "set variable long=0" }
817 timeout { fail "(timeout) set variable long=0" }
820 -re "$prompt $" { fail "set variable long=0" }
821 timeout { fail "(timeout) set variable long=0" }
825 send "set variable v_long=1\n"
829 send "print v_long\n"
831 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable long=1" }
832 -re "$prompt $" { fail "set variable long=1" }
833 timeout { fail "(timeout) set variable long=1" }
836 -re "$prompt $" { fail "set variable long=1" }
837 timeout { fail "(timeout) set variable long=1" }
841 send "set variable v_long=-1\n"
845 send "print v_long\n"
847 -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable long=-1 (minus)" }
848 -re "$prompt $" { fail "set variable long=-1 (minus)" }
849 timeout { fail "(timeout) set variable signed long=-1 (minus)" }
852 -re "$prompt $" { fail "set variable long=-1 (minus)" }
853 timeout { fail "(timeout) set variable long=-1 (minus)" }
858 # test "set variable" for type "signed long"
860 send "set variable v_signed_long=0\n"
864 send "print v_signed_long\n"
866 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable signed long=0" }
867 -re "$prompt $" { fail "set variable signed long=0" }
868 timeout { fail "(timeout) set variable signed long=0" }
871 -re "$prompt $" { fail "set variable signed long=0" }
872 timeout { fail "(timeout) set variable signed long=0" }
876 send "set variable v_signed_long=1\n"
880 send "print v_signed_long\n"
882 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable signed long=1" }
883 -re "$prompt $" { fail "set variable signed long=1" }
884 timeout { fail "(timeout) set variable signed long=1" }
887 -re "$prompt $" { fail "set variable signed long=1" }
888 timeout { fail "(timeout) set variable signed long=1" }
892 send "set variable v_signed_long=-1\n"
896 send "print v_signed_long\n"
898 -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable signed long=-1 (minus)" }
899 -re "$prompt $" { fail "set variable signed long=-1 (minus)" }
900 timeout { fail "(timeout) set variable signed long=-1 (minus)" }
903 -re "$prompt $" { fail "set variable signed long=-1 (minus)" }
904 timeout { fail "(timeout) set variable signed long=-1 (minus)" }
909 # test "set variable" for type "unsigned long"
911 send "set variable v_unsigned_long=0\n"
915 send "print v_unsigned_long\n"
917 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable unsigned long=0" }
918 -re "$prompt $" { fail "set variable unsigned long=0" }
919 timeout { fail "(timeout) set variable unsigned long=0" }
922 -re "$prompt $" { fail "set variable unsigned long=0" }
923 timeout { fail "(timeout) set variable unsigned long=0" }
927 send "set variable v_unsigned_long=1\n"
931 send "print v_unsigned_long\n"
933 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable unsigned long=1" }
934 -re "$prompt $" { fail "set variable unsigned long=1" }
935 timeout { fail "(timeout) set variable unsigned long=1" }
938 -re "$prompt $" { fail "set variable unsigned long=1" }
939 timeout { fail "(timeout) set variable unsigned long=1" }
943 send "set variable v_unsigned_long=~0\n"
947 send "print v_unsigned_long\n"
949 -re ".\[0-9\]* = $ulong_minus_1.*$prompt $" { pass "set variable unsigned long=~0 (minus)" }
950 -re "$prompt $" { fail "set variable unsigned long=~0 (minus)" }
951 timeout { fail "(timeout) set variable unsigned long=~0 (minus)" }
954 -re "$prompt $" { fail "set variable unsigned long=~0 (minus)" }
955 timeout { fail "(timeout) set variable unsigned long=~0 (minus)" }
960 # test "set variable" for type "float"
962 send "set variable v_float=0.0\n"
966 send "print v_float\n"
968 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable float=0" }
969 -re "$prompt $" { fail "set variable float=0" }
970 timeout { fail "(timeout) set variable float=0" }
973 -re "$prompt $" { fail "set variable float=0" }
974 timeout { fail "(timeout) set variable float=0" }
978 send "set variable v_float=1.0\n"
982 send "print v_float\n"
984 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable float=1" }
985 -re "$prompt $" { fail "set variable float=1" }
986 timeout { fail "(timeout) set variable float=1" }
989 -re "$prompt $" { fail "set variable float=1" }
990 timeout { fail "(timeout) set variable float=1" }
994 send "set variable v_float=-1.0\n"
998 send "print v_float\n"
1000 -re ".\[0-9\]* = -1.*$prompt $" { pass "set variable float=-1 (minus)" }
1001 -re "$prompt $" { fail "set variable float=-1 (minus)" }
1002 timeout { fail "(timeout) set variable signed float=-1 (minus)" }
1005 -re "$prompt $" { fail "set variable float=-1 (minus)" }
1006 timeout { fail "(timeout) set variable float=-1 (minus)" }
1011 # test "set variable" for type "double"
1013 send "set variable v_double=0.0\n"
1017 send "print v_double\n"
1019 -re ".\[0-9\]* = 0.*$prompt $" { pass "set variable double=0" }
1020 -re "$prompt $" { fail "set variable double=0" }
1021 timeout { fail "(timeout) set variable double=0" }
1024 -re "$prompt $" { fail "set variable double=0" }
1025 timeout { fail "(timeout) set variable double=0" }
1029 send "set variable v_double=1.0\n"
1033 send "print v_double\n"
1035 -re ".\[0-9\]* = 1.*$prompt $" { pass "set variable double=1" }
1036 -re "$prompt $" { fail "set variable double=1" }
1037 timeout { fail "(timeout) set variable double=1" }
1040 -re "$prompt $" { fail "set variable double=1" }
1041 timeout { fail "(timeout) set variable double=1" }
1045 send "set variable v_double=-1.0\n"
1047 -re "set.*$prompt $"\
1049 send "print v_double\n"
1051 -re "print.*.\[0-9\]* = -1.*$prompt $" { pass "set variable double=-1 (minus)" }
1052 -re "$prompt $" { fail "set variable double=-1 (minus)" }
1053 timeout { fail "(timeout) set variable double=-1 (minus)" }
1056 -re "$prompt $" { fail "set variable double=-1 (minus)" }
1057 timeout { fail "(timeout) set variable double=-1 (minus)" }
1062 # test "set variable" for "char array[2]"
1064 send "set variable v_char_array\[0\]='h'\n"
1065 expect -re "$prompt $"
1066 send "set variable v_char_array\[1\]='i'\n"
1068 -re "set.*$prompt $"\
1070 send "print v_char_array\n"
1072 -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable char array=\"hi\" (string)" }
1073 -re "$prompt $" { fail "set variable char array=\"hi\" (string)" }
1074 timeout { fail "(timeout) set variable char array=\"hi\" (string)" }
1077 -re "$prompt $" { fail "set variable char array=\"hi\" (string)" }
1078 timeout { fail "(timeout) set variable char array=\"hi\" (string)" }
1083 # test "set variable" for "signed char array[2]"
1085 send "set variable v_signed_char_array\[0\]='h'\n"
1086 expect -re "$prompt $"
1087 send "set variable v_signed_char_array\[1\]='i'\n"
1089 -re "set.*$prompt $"\
1091 send "print v_signed_char_array\n"
1093 -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable signed char array=\"hi\" (string)" }
1094 -re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" }
1095 timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" }
1098 -re "$prompt $" { fail "set variable signed char array=\"hi\" (string)" }
1099 timeout { fail "(timeout) set variable signed char array=\"hi\" (string)" }
1104 # test "set variable" for "unsigned char array[2]"
1106 send "set variable v_unsigned_char_array\[0\]='h'\n"
1107 expect -re "$prompt $"
1108 send "set variable v_unsigned_char_array\[1\]='i'\n"
1110 -re "set.*$prompt $"\
1112 send "print v_unsigned_char_array\n"
1114 -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" { pass "set variable unsigned char array=\"hi\" (string)" }
1115 -re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" }
1116 timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
1119 -re "$prompt $" { fail "set variable unsigned char array=\"hi\" (string)" }
1120 timeout { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
1125 # test "set variable" for "short array[2]"
1127 send "set variable v_short_array\[0\]=123\n"
1128 expect -re "$prompt $"
1129 send "set variable v_short_array\[1\]=-456\n"
1131 -re "set.*$prompt $"\
1133 send "print v_short_array\n"
1135 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable short array" }
1136 -re "$prompt $" { fail "set variable short array" }
1137 timeout { fail "(timeout) set variable short array" }
1140 -re "$prompt $" { fail "set variable short array" }
1141 timeout { fail "(timeout) set variable short array" }
1146 # test "set variable" for "signed short array[2]"
1148 send "set variable v_signed_short_array\[0\]=123\n"
1149 expect -re "$prompt $"
1150 send "set variable v_signed_short_array\[1\]=-456\n"
1152 -re "set.*$prompt $"\
1154 send "print v_signed_short_array\n"
1156 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed short array" }
1157 -re "$prompt $" { fail "set variable signed short array" }
1158 timeout { fail "(timeout) set variable signed short array" }
1161 -re "$prompt $" { fail "set variable signed short array" }
1162 timeout { fail "(timeout) set variable signed short array" }
1167 # test "set variable" for "unsigned short array[2]"
1169 send "set variable v_unsigned_short_array\[0\]=123\n"
1170 expect -re "$prompt $"
1171 send "set variable v_unsigned_short_array\[1\]=-456\n"
1173 -re "set.*$prompt $"\
1175 send "print v_unsigned_short_array\n"
1177 -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" { pass "set variable unsigned short array" }
1178 -re "$prompt $" { fail "set variable unsigned short array" }
1179 timeout { fail "(timeout) set variable unsigned short array" }
1182 -re "$prompt $" { fail "set variable unsigned short array" }
1183 timeout { fail "(timeout) set variable unsigned short array" }
1188 # test "set variable" for "int array[2]"
1190 send "set variable v_int_array\[0\]=123\n"
1191 expect -re "$prompt $"
1192 send "set variable v_int_array\[1\]=-456\n"
1194 -re "set.*$prompt $"\
1196 send "print v_int_array\n"
1198 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable int array" }
1199 -re "$prompt $" { fail "set variable int array" }
1200 timeout { fail "(timeout) set variable int array" }
1203 -re "$prompt $" { fail "set variable int array" }
1204 timeout { fail "(timeout) set variable int array" }
1209 # test "set variable" for "signed int array[2]"
1211 send "set variable v_signed_int_array\[0\]=123\n"
1212 expect -re "$prompt $"
1213 send "set variable v_signed_int_array\[1\]=-456\n"
1215 -re "set.*$prompt $"\
1217 send "print v_signed_int_array\n"
1219 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed int array" }
1220 -re "$prompt $" { fail "set variable signed int array" }
1221 timeout { fail "(timeout) set variable signed int array" }
1224 -re "$prompt $" { fail "set variable signed int array" }
1225 timeout { fail "(timeout) set variable signed int array" }
1231 # test "set variable" for "unsigned int array[2]"
1233 send "set variable v_unsigned_int_array\[0\]=123\n"
1234 expect -re "$prompt $"
1235 send "set variable v_unsigned_int_array\[1\]=-456\n"
1237 -re "set.*$prompt $"\
1239 send "print v_unsigned_int_array\n"
1241 -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" { pass "set variable unsigned int array" }
1242 -re "$prompt $" { fail "set variable unsigned int array" }
1243 timeout { fail "(timeout) set variable unsigned int array" }
1246 -re "$prompt $" { fail "set variable unsigned int array" }
1247 timeout { fail "(timeout) set variable unsigned int array" }
1252 # test "set variable" for "long array[2]"
1254 send "set variable v_long_array\[0\]=123\n"
1255 expect -re "$prompt $"
1256 send "set variable v_long_array\[1\]=-456\n"
1258 -re "set.*$prompt $"\
1260 send "print v_long_array\n"
1262 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable long array" }
1263 -re "$prompt $" { fail "set variable long array" }
1264 timeout { fail "(timeout) set variable long array" }
1267 -re "$prompt $" { fail "set variable long array" }
1268 timeout { fail "(timeout) set variable long array" }
1273 # test "set variable" for "signed long array[2]"
1275 send "set variable v_signed_long_array\[0\]=123\n"
1276 expect -re "$prompt $"
1277 send "set variable v_signed_long_array\[1\]=-456\n"
1279 -re "set.*$prompt $"\
1281 send "print v_signed_long_array\n"
1283 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable signed long array" }
1284 -re "$prompt $" { fail "set variable signed long array" }
1285 timeout { fail "(timeout) set variable signed long array" }
1288 -re "$prompt $" { fail "set variable signed long array" }
1289 timeout { fail "(timeout) set variable signed long array" }
1295 # test "set variable" for "unsigned long array[2]"
1297 send "set variable v_unsigned_long_array\[0\]=123\n"
1298 expect -re "$prompt $"
1299 send "set variable v_unsigned_long_array\[1\]=-456\n"
1303 send "print v_unsigned_long_array\n"
1305 -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" { pass "set variable unsigned long array" }
1306 -re "$prompt $" { fail "set variable unsigned long array" }
1307 timeout { fail "(timeout) set variable unsigned long array" }
1310 -re "$prompt $" { fail "set variable unsigned long array" }
1311 timeout { fail "(timeout) set variable unsigned long array" }
1316 # test "set variable" for "float array[2]"
1318 send "set variable v_float_array\[0\]=123.0\n"
1319 expect -re "$prompt $"
1320 send "set variable v_float_array\[1\]=-456.0\n"
1324 send "print v_float_array\n"
1326 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable float array" }
1327 -re "$prompt $" { fail "set variable float array" }
1328 timeout { fail "(timeout) set variable float array" }
1331 -re "$prompt $" { fail "set variable float array" }
1332 timeout { fail "(timeout) set variable float array" }
1337 # test "set variable" for "double array[2]"
1339 send "set variable v_double_array\[0\]=123.0\n"
1340 expect -re "$prompt $"
1341 send "set variable v_double_array\[1\]=-456.0\n"
1345 send "print v_double_array\n"
1347 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" { pass "set variable double array" }
1348 -re "$prompt $" { fail "set variable double array" }
1349 timeout { fail "(timeout) set variable double array" }
1352 -re "$prompt $" { fail "set variable double array" }
1353 timeout { fail "(timeout) set variable double array" }
1358 # test "set variable" for type "char *"
1360 send "set v_char_pointer=v_char_array\n"
1361 expect -re "set.*$prompt $"
1362 send "set variable *(v_char_pointer)='h'\n"
1363 expect -re "set.*$prompt $"
1364 send "set variable *(v_char_pointer+1)='i'\n"
1366 -re "set.*$prompt $" {
1367 send "print v_char_array\n"
1369 -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
1370 send "print *(v_char_pointer+1)\n"
1372 -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable char pointer=\"hi\" (string)" }
1373 -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" }
1374 timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" }
1378 -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" }
1379 timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" }
1382 -re "$prompt $" { fail "set variable char pointer=\"hi\" (string)" }
1383 timeout { fail "(timeout) set variable char pointer=\"hi\" (string)" }
1388 # test "set variable" for type "signed char *"
1390 send "set v_signed_char_pointer=v_signed_char_array\n"
1391 expect -re "set.*$prompt $"
1392 send "set variable *(v_signed_char_pointer)='h'\n"
1393 expect -re "set.*$prompt $"
1394 send "set variable *(v_signed_char_pointer+1)='i'\n"
1396 -re "set.*$prompt $" {
1397 send "print v_signed_char_array\n"
1399 -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
1400 send "print *(v_signed_char_pointer+1)\n"
1402 -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable signed char pointer=\"hi\" (string)" }
1403 -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" }
1404 timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
1408 -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" }
1409 timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
1412 -re "$prompt $" { fail "set variable signed char pointer=\"hi\" (string)" }
1413 timeout { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
1418 # test "set variable" for type "unsigned char *"
1420 send "set v_unsigned_char_pointer=v_unsigned_char_array\n"
1421 expect -re "set.*$prompt $"
1422 send "set variable *(v_unsigned_char_pointer)='h'\n"
1423 expect -re "set.*$prompt $"
1424 send "set variable *(v_unsigned_char_pointer+1)='i'\n"
1426 -re "set.*$prompt $" {
1427 send "print v_unsigned_char_array\n"
1429 -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
1430 send "print *(v_unsigned_char_pointer+1)\n"
1432 -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $" { pass "set variable unsigned char pointer=\"hi\" (string)" }
1433 -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" }
1434 timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
1438 -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" }
1439 timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
1442 -re "$prompt $" { fail "set variable unsigned char pointer=\"hi\" (string)" }
1443 timeout { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
1448 # test "set variable" for type "short *"
1450 send "set v_short_pointer=v_short_array\n"
1451 expect -re "set.*$prompt $"
1452 send "set variable *(v_short_pointer)=123\n"
1453 expect -re "set.*$prompt $"
1454 send "set variable *(v_short_pointer+1)=-456\n"
1456 -re "set.*$prompt $" {
1457 send "print v_short_array\n"
1459 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1460 send "print *(v_short_pointer+1)\n"
1462 -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable short pointer" }
1463 -re "$prompt $" { fail "set variable short pointer" }
1464 timeout { fail "(timeout) set variable short pointer" }
1468 -re "$prompt $" { fail "set variable short pointer" }
1469 timeout { fail "(timeout) set variable short pointer" }
1472 -re "$prompt $" { fail "set variable short pointer" }
1473 timeout { fail "(timeout) set variable short pointer" }
1478 # test "set variable" for type "signed short *"
1480 send "set v_signed_short_pointer=v_signed_short_array\n"
1481 expect -re "set.*$prompt $"
1482 send "set variable *(v_signed_short_pointer)=123\n"
1483 expect -re "set.*$prompt $"
1484 send "set variable *(v_signed_short_pointer+1)=-456\n"
1486 -re "set.*$prompt $" {
1487 send "print v_signed_short_array\n"
1489 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1490 send "print *(v_signed_short_pointer+1)\n"
1492 -re "print.*.\[0-9\]*.*=.*-456.*$prompt $" { pass "set variable signed short pointer" }
1493 -re "$prompt $" { fail "set variable signed short pointer (FIXME)" }
1494 timeout { fail "(timeout) set variable signed short pointer (FIXME)" }
1498 -re "$prompt $" { fail "set variable signed short pointer (FIXME)" }
1499 timeout { fail "(timeout) set variable signed short pointer (FIXME)" }
1502 -re "$prompt $" { fail "set variable signed short pointer (FIXME)" }
1503 timeout { fail "(timeout) set variable signed short pointer (FIXME)" }
1508 # test "set variable" for type "unsigned short *"
1510 send "set v_unsigned_short_pointer=v_unsigned_short_array\n"
1511 expect -re "set.*$prompt $"
1512 send "set variable *(v_unsigned_short_pointer)=123\n"
1513 expect -re "set.*$prompt $"
1514 send "set variable *(v_unsigned_short_pointer+1)=-456\n"
1516 -re "set.*$prompt $" {
1517 send "print v_unsigned_short_array\n"
1519 -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $" {
1520 send "print *(v_unsigned_short_pointer+1)\n"
1522 -re "print.*.\[0-9\]* = 65080.*$prompt $" { pass "set variable unsigned short pointer" }
1523 -re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" }
1524 timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" }
1528 -re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" }
1529 timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" }
1532 -re "$prompt $" { fail "set variable unsigned short pointer (FIXME)" }
1533 timeout { fail "(timeout) set variable unsigned short pointer (FIXME)" }
1538 # test "set variable" for type "int *"
1540 send "set v_int_pointer=v_int_array\n"
1541 expect -re "set.*$prompt $"
1542 send "set variable *(v_int_pointer)=123\n"
1543 expect -re "set.*$prompt $"
1544 send "set variable *(v_int_pointer+1)=-456\n"
1546 -re "set.*$prompt $" {
1547 send "print v_int_array\n"
1549 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1550 send "print *(v_int_pointer+1)\n"
1552 -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable int pointer" }
1553 -re "$prompt $" { fail "set variable int pointer" }
1554 timeout { fail "(timeout) set variable int pointer" }
1558 -re "$prompt $" { fail "set variable int pointer" }
1559 timeout { fail "(timeout) set variable int pointer" }
1562 -re "$prompt $" { fail "set variable int pointer" }
1563 timeout { fail "(timeout) set variable int pointer" }
1568 # test "set variable" for type "signed int *"
1570 send "set v_signed_int_pointer=v_signed_int_array\n"
1571 expect -re "set.*$prompt $"
1572 send "set variable *(v_signed_int_pointer)=123\n"
1573 expect -re "set.*$prompt $"
1574 send "set variable *(v_signed_int_pointer+1)=-456\n"
1576 -re "set.*$prompt $" {
1577 send "print v_signed_int_array\n"
1579 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1580 send "print *(v_signed_int_pointer+1)\n"
1582 -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed int pointer" }
1583 -re "$prompt $" { fail "set variable signed int pointer" }
1584 timeout { fail "(timeout) set variable signed int pointer" }
1588 -re "$prompt $" { fail "set variable signed int pointer" }
1589 timeout { fail "(timeout) set variable signed int pointer" }
1592 -re "$prompt $" { fail "set variable signed int pointer" }
1593 timeout { fail "(timeout) set variable signed int pointer" }
1598 # test "set variable" for type "unsigned int *"
1600 send "set v_unsigned_int_pointer=v_unsigned_int_array\n"
1601 expect -re "set.*$prompt $"
1602 send "set variable *(v_unsigned_int_pointer)=123\n"
1603 expect -re "set.*$prompt $"
1604 send "set variable *(v_unsigned_int_pointer+1)=-456\n"
1606 -re "set.*$prompt $" {
1607 send "print v_unsigned_int_array\n"
1609 -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" {
1610 send "print *(v_unsigned_int_pointer+1)\n"
1612 -re "print.*.\[0-9\]* = 4294966840.*$prompt $" { pass "set variable unsigned int pointer" }
1613 -re "$prompt $" { fail "set variable unsigned int pointer" }
1614 timeout { fail "(timeout) set variable unsigned int pointer" }
1618 -re "$prompt $" { fail "set variable unsigned int pointer" }
1619 timeout { fail "(timeout) set variable unsigned int pointer" }
1622 -re "$prompt $" { fail "set variable unsigned int pointer" }
1623 timeout { fail "(timeout) set variable unsigned int pointer" }
1628 # test "set variable" for type "long *"
1630 send "set v_long_pointer=v_long_array\n"
1631 expect -re "set.*$prompt $"
1632 send "set variable *(v_long_pointer)=123\n"
1633 expect -re "set.*$prompt $"
1634 send "set variable *(v_long_pointer+1)=-456\n"
1636 -re "set.*$prompt $" {
1637 send "print v_long_array\n"
1639 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1640 send "print *(v_long_pointer+1)\n"
1642 -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable long pointer" }
1643 -re "$prompt $" { fail "set variable long pointer" }
1644 timeout { fail "(timeout) set variable long pointer" }
1648 -re "$prompt $" { fail "set variable long pointer" }
1649 timeout { fail "(timeout) set variable long pointer" }
1652 -re "$prompt $" { fail "set variable long pointer" }
1653 timeout { fail "(timeout) set variable long pointer" }
1658 # test "set variable" for type "signed long *"
1660 send "set v_signed_long_pointer=v_signed_long_array\n"
1661 expect -re "set.*$prompt $"
1662 send "set variable *(v_signed_long_pointer)=123\n"
1663 expect -re "set.*$prompt $"
1664 send "set variable *(v_signed_long_pointer+1)=-456\n"
1666 -re "set.*$prompt $" {
1667 send "print v_signed_long_array\n"
1669 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1670 send "print *(v_signed_long_pointer+1)\n"
1672 -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable signed long pointer" }
1673 -re "$prompt $" { fail "set variable signed long pointer" }
1674 timeout { fail "(timeout) set variable signed long pointer" }
1678 -re "$prompt $" { fail "set variable signed long pointer" }
1679 timeout { fail "(timeout) set variable signed long pointer" }
1682 -re "$prompt $" { fail "set variable signed long pointer" }
1683 timeout { fail "(timeout) set variable signed long pointer" }
1688 # test "set variable" for type "unsigned long *"
1690 send "set v_unsigned_long_pointer=v_unsigned_long_array\n"
1691 expect -re "set.*$prompt $"
1692 send "set variable *(v_unsigned_long_pointer)=123\n"
1693 expect -re "set.*$prompt $"
1694 send "set variable *(v_unsigned_long_pointer+1)=-456\n"
1696 -re "set.*$prompt $" {
1697 send "print v_unsigned_long_array\n"
1699 -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" {
1700 send "print *(v_unsigned_long_pointer+1)\n"
1702 -re "print.*.\[0-9\]* = $ulong_minus_456.*$prompt $" { pass "set variable unsigned long pointer" }
1703 -re "$prompt $" { fail "set variable unsigned long pointer" }
1704 timeout { fail "(timeout) set variable unsigned long pointer" }
1708 -re "$prompt $" { fail "set variable unsigned long pointer" }
1709 timeout { fail "(timeout) set variable unsigned long pointer" }
1712 -re "$prompt $" { fail "set variable unsigned long pointer" }
1713 timeout { fail "(timeout) set variable unsigned long pointer" }
1718 # test "set variable" for type "float *"
1720 send "set v_float_pointer=v_float_array\n"
1721 expect -re "set.*$prompt $"
1722 send "set variable *(v_float_pointer)=123.0\n"
1723 expect -re "set.*$prompt $"
1724 send "set variable *(v_float_pointer+1)=-456.0\n"
1726 -re "set.*$prompt $" {
1727 send "print v_float_array\n"
1729 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1730 send "print *(v_float_pointer+1)\n"
1732 -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable float pointer" }
1733 -re "$prompt $" { fail "set variable float pointer" }
1734 timeout { fail "(timeout) set variable float pointer" }
1738 -re "$prompt $" { fail "set variable float pointer" }
1739 timeout { fail "(timeout) set variable float pointer" }
1742 -re "$prompt $" { fail "set variable float pointer" }
1743 timeout { fail "(timeout) set variable float pointer" }
1748 # test "set variable" for type "double *"
1750 send "set v_double_pointer=v_double_array\n"
1751 expect -re "set.*$prompt $"
1752 send "set variable *(v_double_pointer)=123.0\n"
1753 expect -re "set.*$prompt $"
1754 send "set variable *(v_double_pointer+1)=-456.0\n"
1756 -re "set.*$prompt $" {
1757 send "print v_double_array\n"
1759 -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
1760 send "print *(v_double_pointer+1)\n"
1762 -re "print.*.\[0-9\]* = -456.*$prompt $" { pass "set variable double pointer" }
1763 -re "$prompt $" { fail "set variable double pointer" }
1764 timeout { fail "(timeout) set variable double pointer" }
1768 -re "$prompt $" { fail "set variable double pointer" }
1769 timeout { fail "(timeout) set variable double pointer" }
1772 -re "$prompt $" { fail "set variable double pointer" }
1773 timeout { fail "(timeout) set variable double pointer" }
1778 # test "set variable" for struct members
1780 send "set variable v_struct1.v_char_member='h'\n"
1782 -re "set.*$prompt $"\
1784 send "print v_struct1.v_char_member\n"
1786 -re "print.*.\[0-9\]* = 104 \'h\'.*$prompt $" { pass "set variable structure char member" }
1787 -re "$prompt $" { fail "set variable structure char member" }
1788 timeout { fail "(timeout) set variable structure char member" }
1791 -re "$prompt $" { fail "set variable structure char member" }
1792 timeout { fail "(timeout) set variable structure char member" }
1796 send "set variable v_struct1.v_short_member=1\n"
1798 -re "set.*$prompt $"\
1800 send "print v_struct1.v_short_member\n"
1802 -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "set variable structure short member" }
1803 -re "$prompt $" { fail "set variable structure short member" }
1804 timeout { fail "(timeout) set variable structure short member" }
1807 -re "$prompt $" { fail "set variable structure short member" }
1808 timeout { fail "(timeout) set variable structure short member" }
1812 send "set variable v_struct1.v_int_member=2\n"
1814 -re "set.*$prompt $"\
1816 send "print v_struct1.v_int_member\n"
1818 -re "print.*.\[0-9\]* = 2.*$prompt $" { pass "set variable structure int member" }
1819 -re "$prompt $" { fail "set variable structure int member" }
1820 timeout { fail "(timeout) set variable structure int member" }
1823 -re "$prompt $" { fail "set variable structure int member" }
1824 timeout { fail "(timeout) set variable structure int member" }
1828 send "set variable v_struct1.v_long_member=3\n"
1830 -re "set.*$prompt $"\
1832 send "print v_struct1.v_long_member\n"
1834 -re "print.*.\[0-9\]* = 3.*$prompt $" { pass "set variable structure long member" }
1835 -re "$prompt $" { fail "set variable structure long member" }
1836 timeout { fail "(timeout) set variable structure long member" }
1839 -re "$prompt $" { fail "set variable structure long member" }
1840 timeout { fail "(timeout) set variable structure long member" }
1844 send "set variable v_struct1.v_float_member=4.0\n"
1846 -re "set.*$prompt $"\
1848 send "print v_struct1.v_float_member\n"
1850 -re "print.*.\[0-9\]* = 4.*$prompt $" { pass "set variable structure float member" }
1851 -re "$prompt $" { fail "set variable structure float member" }
1852 timeout { fail "(timeout) set variable structure float member" }
1855 -re "$prompt $" { fail "set variable structure float member" }
1856 timeout { fail "(timeout) set variable structure float member" }
1860 send "set variable v_struct1.v_double_member=5.0\n"
1862 -re "set.*$prompt $"\
1864 send "print v_struct1.v_double_member\n"
1866 -re "print.*.\[0-9\]* = 5.*$prompt $" { pass "set variable structure double member" }
1867 -re "$prompt $" { fail "set variable structure double member" }
1868 timeout { fail "(timeout) set variable structure double member" }
1871 -re "$prompt $" { fail "set variable structure double member" }
1872 timeout { fail "(timeout) set variable structure double member" }
1877 send "print v_struct1\n"
1879 -re "print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,.*v_int_member = 2,.*\
1880 v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}.*$prompt $"\
1881 { pass "set print structure" }
1882 -re "$prompt $" { fail "set print structure" }
1883 timeout { fail "(timeout) set print structure" }
1886 if [istarget "a29k-*-udi"] then {
1887 # FIXME: If PR 2415 is fixed, this is not needed.