* gdb.base/a1-selftest.exp: Change "i*86-*-sysv4" xfail for
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / ptype.exp
1 # Copyright (C) 1988, 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # This file was written by Rob Savoye. (rob@cygnus.com)
21
22 if $tracelevel then {
23 strace $tracelevel
24 }
25
26 #
27 # test running programs
28 #
29 set prms_id 0
30 set bug_id 0
31
32 set binfile "ptype"
33
34 if ![file exists $objdir/$subdir/$binfile] then {
35 perror "$objdir/$subdir/$binfile does not exist."
36 return 0
37 }
38
39 gdb_exit
40 gdb_start
41 gdb_reinitialize_dir $srcdir/$subdir
42 gdb_load $objdir/$subdir/$binfile
43
44 # Test ptype of unnamed enumeration members before any action causes
45 # the partial symbol table to be expanded to full symbols. This fails
46 # with stabs compilers which fail to use a nameless stab (such as
47 # pre-2.4.5 versions of gcc and most non-gcc compilers).
48
49 send "ptype red1\n"
50 expect {
51 -re "type = enum primary1_tag \{red1, green1, blue1\}.*$prompt $"\
52 {
53 # The workaround is in effect. As this is a compiler, not GDB,
54 # bug, we'll make it a PASS but perhaps it should be an XFAIL.
55 pass "ptype unnamed enumeration member (worked around)"
56 }
57 -re "type = enum \{red1, green1, blue1\}.*$prompt $"\
58 { pass "ptype unnamed enumeration member" }
59 -re ".*$prompt $" { fail "ptype unnamed enumeration member" }
60 timeout { fail "(timeout) ptype unnamed enumeration member" }
61 }
62
63 #
64 # test ptype command with structures
65 #
66 # Here and elsewhere, we accept
67 # "long", "long int", or "int" for long variables (whatis.exp already
68 # has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
69 send "ptype struct t_struct\n"
70 expect {
71 -re "type = struct t_struct \{.*
72 (unsigned |)char v_char_member;.*
73 (short|short int) v_short_member;.*
74 int v_int_member;.*
75 (long|long int|int) v_long_member;.*
76 float v_float_member;.*
77 double v_double_member;.*
78 \}.*$prompt $" { pass "ptype structure" }
79 -re ".*$prompt $" { fail "ptype structure" }
80 timeout { fail "(timeout) ptype structure" }
81 }
82
83 # Test the equivalence between '.' and '->' for struct member references.
84
85 if [gdb_test "ptype v_struct1.v_float_member" "type = float"]<0 then {
86 gdb_exit
87 gdb_start
88 return -1
89 }
90 if [gdb_test "ptype v_struct1->v_float_member" "type = float"]<0 then {
91 gdb_exit
92 gdb_start
93 return -1
94 }
95 if [gdb_test "ptype v_t_struct_p.v_float_member" "type = float"]<0 then {
96 gdb_exit
97 gdb_start
98 return -1
99 }
100 if [gdb_test "ptype v_t_struct_p->v_float_member" "type = float"]<0 then {
101 gdb_exit
102 gdb_start
103 return -1
104 }
105
106
107 send "ptype struct link\n"
108 expect {
109 -re "type = struct link \{.*
110 struct link \[*\]next;.*
111 struct link \[*(\]+linkfunc\[)(\]+;.*
112 struct t_struct stuff.1..2..3.;.*
113 \}.*$prompt $" { pass "ptype linked list structure" }
114 -re ".*$prompt $" {
115
116 # IBM's xlc puts out bogus stabs--the stuff field is type 42,
117 # which isn't defined.
118
119 fail "ptype linked list structure (compiler bug in IBM's xlc)"
120 }
121 timeout { fail "(timeout) ptype linked list structure" }
122 }
123
124
125 #
126 # test ptype command with unions
127 #
128 send "ptype union t_union\n"
129 expect {
130 -re "type = union t_union \{.*
131 (unsigned |)char v_char_member;.*
132 (short|short int) v_short_member;.*
133 int v_int_member;.*
134 (long|long int|int) v_long_member;.*
135 float v_float_member;.*
136 double v_double_member;.*
137 \}.*$prompt $" { pass "ptype union" }
138 -re ".*$prompt $" { fail "ptype union" }
139 timeout { fail "(timeout) ptype union" }
140 }
141
142
143 send "ptype union tu_link\n"
144 expect {
145 -re "type = union tu_link .*
146 struct link \[*\]next;.*
147 struct link \[(\*\]+linkfunc\[)(\]+;.*
148 struct t_struct stuff.1..2..3.;.*
149 \}.*$prompt $" { pass "ptype linked list union" }
150 -re ".*$prompt $" {
151
152 # IBM's xlc puts out bogus stabs--the stuff field is type 42,
153 # which isn't defined.
154
155 fail "ptype linked list union (compiler bug in IBM's xlc)"
156 }
157 timeout { fail "(timeout) ptype linked list union" }
158 }
159
160
161 #
162 # test ptype command with enums
163 #
164
165 send "ptype primary\n"
166 expect {
167 -re "type = enum .red, green, blue.*$prompt $" { pass "ptype unnamed enumeration" }
168 -re ".*$prompt $" { fail "ptype unnamed enumeration" }
169 timeout { fail "(timeout) ptype unnamed enumeration" }
170 }
171
172
173 send "ptype enum colors\n"
174 expect {
175 -re "type = enum colors \{yellow, purple, pink\}.*$prompt $"\
176 { pass "ptype named enumeration" }
177 -re ".*$prompt $" { fail "ptype named enumeration" }
178 timeout { fail "(timeout) ptype named enumeration" }
179 }
180
181
182 #
183 # test ptype command with enums as typedef
184 #
185 send "ptype boolean\n"
186 expect {
187 -re "type = enum \{FALSE, TRUE\}.*$prompt $" { pass "ptype unnamed typedef'd enumeration" }
188 -re ".*$prompt $" { fail "ptype unnamed typedef'd enumeration" }
189 timeout { fail "(timeout) ptype unnamed typedef'd enumeration" }
190 }
191
192 # And check that whatis shows the name, not "enum {...}".
193
194 # The problem with xlc is that the stabs look like
195 # :t51=eFALSE:0,TRUE:1,;
196 # boolean:t55=51
197 # v_boolean:G51
198 # GDB's behavior is correct; the type which the variable is defined
199 # as (51) doesn't have a name. Only 55 has a name.
200
201 setup_xfail "i*86-*-sysv4*"
202 gdb_test "whatis v_boolean" "type = boolean" \
203 "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
204
205 # Same thing with struct and union.
206 gdb_test "ptype t_struct3" "type = struct \{.*
207 *double v_double_member;.*
208 *int v_int_member;.*\}" "printing typedef'd struct"
209
210 gdb_test "ptype t_union3" "type = union \{.*
211 *double v_double_member;.*
212 *int v_int_member;.*\}" "printing typedef'd union"
213
214 send "ptype enum bvals\n"
215 expect {
216 -re "type = enum bvals \{false, true\}.*$prompt $" { pass "ptype named typedef'd enumf'd enum" }
217 -re ".*$prompt $" { fail "ptype named typedef'd enumeration" }
218 timeout { fail "(timeout) ptype named typedef'd enumeration" }
219 }
220
221
222 #
223 # test ptype command with out-of-order enum values
224 #
225 send "ptype enum misordered\n"
226 expect {
227 -re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\
228 { pass "ptype misordered enumeration" }
229 -re ".*$prompt $" { fail "ptype misordered enumeration" }
230 timeout { fail "(timeout) ptype misordered enumeration" }
231 }
232
233
234 #
235 # test ptype command with a named enum's value
236 #
237 send "ptype three\n"
238 expect {
239 -re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\
240 { pass "ptype named enumeration member" }
241 -re ".*$prompt $" { fail "ptype named enumeration member" }
242 timeout { fail "(timeout) ptype named enumeration member" }
243 }
244
245
246 send "ptype red\n"
247 expect {
248 -re "type = enum \{red, green, blue\}.*$prompt $"\
249 { pass "ptype unnamed enumeration member" }
250 -re ".*$prompt $" { fail "ptype unnamed enumeration member" }
251 timeout { fail "(timeout) ptype unnamed enumeration member" }
252 }
253
254
255 #
256 # test ptype command with basic C types
257 #
258 # I've commented most of this out because it duplicates tests in whatis.exp.
259 # I've just left in a token test or 2 which is designed to test that ptype
260 # acts like whatis for basic types. If it is thought to be necessary to
261 # test both whatis and ptype for all the types, the tests should be
262 # merged into whatis.exp, or else maintenance will be a royal pain -kingdon
263 #setup_xfail "i960-*-*" 1821
264 #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*"
265 #send "ptype v_char\n"
266 #expect {
267 # -re "type = char.*$prompt $" { pass "ptype char" }
268 # -re ".*$prompt $" { fail "ptype char" }
269 # timeout { fail "(timeout) ptype char" }
270 #}
271 #
272 #
273 #setup_xfail "mips-*-*" "a29k-*-*"
274 #send "ptype v_signed_char\n"
275 #expect {
276 # -re "type = signed char.*$prompt $" { pass "ptype signed char" }
277 # -re ".*$prompt $" { fail "ptype signed char" }
278 # timeout { fail "(timeout) ptype signed char" }
279 #}
280 #
281 #
282 #send "ptype v_unsigned_char\n"
283 #expect {
284 # -re "type = unsigned char.*$prompt $" { pass "ptype unsigned char" }
285 # -re ".*$prompt $" { fail "ptype unsigned char" }
286 # timeout { fail "(timeout) ptype unsigned char" }
287 #}
288
289
290 send "ptype v_short\n"
291 expect {
292 -re "type = short(| int).*$prompt $" { pass "ptype short" }
293 -re ".*$prompt $" { fail "ptype short" }
294 timeout { fail "(timeout) ptype short" }
295 }
296
297
298 #send "ptype v_signed_short\n"
299 #expect {
300 # -re "type = short.*$prompt $" { pass "ptype signed short" }
301 # -re ".*$prompt $" { fail "ptype signed short" }
302 # timeout { fail "(timeout) ptype signed short" }
303 #}
304 #
305 #
306 #send "ptype v_unsigned_short\n"
307 #expect {
308 # -re "type = unsigned short.*$prompt $" { pass "ptype unsigned short" }
309 # -re ".*$prompt $" { fail "ptype unsigned short" }
310 # timeout { fail "(timeout) ptype unsigned short" }
311 #}
312
313
314 send "ptype v_int\n"
315 expect {
316 -re "type = int.*$prompt $" { pass "ptype int" }
317 -re ".*$prompt $" { fail "ptype int" }
318 timeout { fail "(timeout) ptype int" }
319 }
320
321
322 #send "ptype v_signed_int\n"
323 #expect {
324 # -re "type = int.*$prompt $" { pass "ptype signed int" }
325 # -re ".*$prompt $" { fail "ptype signed int" }
326 # timeout { fail "(timeout) ptype signed int" }
327 #}
328 #
329 #
330 #send "ptype v_unsigned_int\n"
331 #expect {
332 # -re "type = unsigned int.*$prompt $" { pass "ptype unsigned int" }
333 # -re ".*$prompt $" { fail "ptype unsigned int" }
334 # timeout { fail "(timeout) ptype unsigned int" }
335 #}
336 #
337 #
338 #send "ptype v_long\n"
339 #expect {
340 # -re "type = long.*$prompt $" { pass "ptype long" }
341 # -re ".*$prompt $" { fail "ptype long" }
342 # timeout { fail "(timeout) ptype long" }
343 #}
344 #
345 #
346 #send "ptype v_signed_long\n"
347 #expect {
348 # -re "type = long.*$prompt $" { pass "ptype signed long" }
349 # -re ".*$prompt $" { fail "ptype signed long" }
350 # timeout { fail "(timeout) ptype signed long" }
351 #}
352 #
353 #
354 #send "ptype v_unsigned_long\n"
355 #expect {
356 # -re "type = unsigned long.*$prompt $" { pass "ptype unsigned long" }
357 # -re ".*$prompt $" { fail "ptype unsigned long" }
358 # timeout { fail "(timeout) ptype unsigned long" }
359 #}
360 #
361 #
362 #send "ptype v_float\n"
363 #expect {
364 # -re "type = float.*$prompt $" { pass "ptype float" }
365 # -re ".*$prompt $" { fail "ptype float" }
366 # timeout { fail "(timeout) ptype float" }
367 #}
368 #
369 #
370 #send "ptype v_double\n"
371 #expect {
372 # -re "type = double.*$prompt $" { pass "ptype double" }
373 # -re ".*$prompt $" { fail "ptype double" }
374 # timeout { fail "(timeout) ptype double" }
375 #}
376
377
378 #
379 # test ptype command with arrays
380 #
381 #setup_xfail "i960-*-*" 1821
382 #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*"
383 #send "ptype v_char_array\n"
384 #expect {
385 # -re "type = char .2..*$prompt $" { pass "ptype char array" }
386 # -re ".*$prompt $" { fail "ptype char array" }
387 # timeout { fail "(timeout) ptype char array" }
388 #}
389 #
390 #
391 #setup_xfail "mips-*-*" "a29k-*-*"
392 #send "ptype v_signed_char_array\n"
393 #expect {
394 # -re "type = (|signed )char .2..*$prompt $" { pass "ptype signed char array" }
395 # -re ".*$prompt $" { fail "ptype signed char array" }
396 # timeout { fail "(timeout) ptype signed char array" }
397 #}
398 #
399 #
400 #send "ptype v_unsigned_char_array\n"
401 #expect {
402 # -re "type = unsigned char .2..*$prompt $" { pass "ptype unsigned char array" }
403 # -re ".*$prompt $" { fail "ptype unsigned char array" }
404 # timeout { fail "(timeout) ptype unsigned char array" }
405 #}
406 #
407 #
408 #
409 #send "ptype v_int_array\n"
410 #expect {
411 # -re "type = int .2..*$prompt $" { pass "ptype int array" }
412 # -re ".*$prompt $" { fail "ptype int array" }
413 # timeout { fail "(timeout) ptype int array" }
414 #}
415 #
416 #
417 #send "ptype v_signed_int_array\n"
418 #expect {
419 # -re "type = int .2..*$prompt $" { pass "ptype signed int array" }
420 # -re ".*$prompt $" { fail "ptype signed int array" }
421 # timeout { fail "(timeout) ptype signed int array" }
422 #}
423 #
424 #
425 #send "ptype v_unsigned_int_array\n"
426 #expect {
427 # -re "type = unsigned int .2..*$prompt $" { pass "ptype unsigned int array" }
428 # -re ".*$prompt $" { fail "ptype unsigned int array" }
429 # timeout { fail "(timeout) ptype unsigned int array" }
430 #}
431 #
432 #
433 #send "ptype v_long_array\n"
434 #expect {
435 # -re "type = (long|int|long int) .2..*$prompt $" {
436 # pass "ptype long array" }
437 # -re ".*$prompt $" { fail "ptype long array" }
438 # timeout { fail "(timeout) ptype long array" }
439 #}
440 #
441 #
442 #send "ptype v_signed_long_array\n"
443 #expect {
444 # -re "type = (long|int|long int) .2..*$prompt $" {
445 # pass "ptype signed long array" }
446 # -re ".*$prompt $" { fail "ptype signed long array" }
447 # timeout { fail "(timeout) ptype signed long array" }
448 #}
449 #
450 #
451 #send "ptype v_unsigned_long_array\n"
452 #expect {
453 # -re "type = unsigned long .2..*$prompt $" { pass "ptype unsigned long array" }
454 # -re ".*$prompt $" { fail "ptype unsigned long array" }
455 # timeout { fail "(timeout) ptype unsigned long array" }
456 #}
457 #
458 #
459 #send "ptype v_float_array\n"
460 #expect {
461 # -re "type = float .2..*$prompt $" { pass "ptype float array" }
462 # -re ".*$prompt $" { fail "ptype float array" }
463 # timeout { fail "(timeout) ptype float array" }
464 #}
465 #
466 #
467 #send "ptype v_double_array\n"
468 #expect {
469 # -re "type = double .2..*$prompt $" { pass "ptype double array" }
470 # -re ".*$prompt $" { fail "ptype double array" }
471 # timeout { fail "(timeout) ptype double array" }
472 #}
473 #
474
475 setup_xfail "i*86-*-sysv4*"
476 gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
477
478 #
479 ##
480 ## test ptype command with pointers
481 ##
482 #setup_xfail "i960-*-*" 1821
483 #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*"
484 #send "ptype v_char_pointer\n"
485 #expect {
486 # -re "type = char \*.*$prompt $" { pass "ptype char pointer" }
487 # -re ".*$prompt $" { fail "ptype char pointer" }
488 # timeout { fail "(timeout) ptype char pointer" }
489 #}
490 #
491 #
492 #setup_xfail "mips-*-*" "a29k-*-*"
493 #send "ptype v_signed_char_pointer\n"
494 #expect {
495 # -re "type = (|signed )char \*.*$prompt $"
496 # { pass "ptype signed char pointer" }
497 # -re ".*$prompt $" { fail "ptype signed char pointer" }
498 # timeout { fail "(timeout) ptype signed char pointer" }
499 #}
500 #
501 #
502 #send "ptype v_unsigned_char_pointer\n"
503 #expect {
504 # -re "type = unsigned char \*.*$prompt $" { pass "ptype unsigned char pointer" }
505 # -re ".*$prompt $" { fail "ptype unsigned char pointer" }
506 # timeout { fail "(timeout) ptype unsigned char pointer" }
507 #}
508 #
509 #
510 #send "ptype v_short_pointer\n"
511 #expect {
512 # -re "type = (short|short int) \*.*$prompt $" { pass "ptype short pointer" }
513 # -re ".*$prompt $" { fail "ptype short pointer" }
514 # timeout { fail "(timeout) ptype short pointer" }
515 #}
516 #
517 #
518 #send "ptype v_signed_short_pointer\n"
519 #expect {
520 # -re "type = short \*.*$prompt $" { pass "ptype signed short pointer" }
521 # -re ".*$prompt $" { fail "ptype signed short pointer" }
522 # timeout { fail "(timeout) ptype signed short pointer" }
523 #}
524 #
525 #
526 #send "ptype v_unsigned_short_pointer\n"
527 #expect {
528 # -re "type = unsigned short \*.*$prompt $" { pass "ptype unsigned short pointer" }
529 # -re ".*$prompt $" { fail "ptype unsigned short pointer" }
530 # timeout { fail "(timeout) ptype unsigned short pointer" }
531 #}
532 #
533 #
534 #send "ptype v_int_pointer\n"
535 #expect {
536 # -re "type = int \*.*$prompt $" { pass "ptype int pointer" }
537 # -re ".*$prompt $" { fail "ptype int pointer" }
538 # timeout { fail "(timeout) ptype int pointer" }
539 #}
540 #
541 #
542 #send "ptype v_signed_int_pointer\n"
543 #expect {
544 # -re "type = int \*.*$prompt $" { pass "ptype signed int pointer" }
545 # -re ".*$prompt $" { fail "ptype signed int pointer" }
546 # timeout { fail "(timeout) ptype signed int pointer" }
547 #}
548 #
549 #
550 #send "ptype v_unsigned_int_pointer\n"
551 #expect {
552 # -re "type = unsigned int \*.*$prompt $" { pass "ptype unsigned int pointer" }
553 # -re ".*$prompt $" { fail "ptype unsigned int pointer" }
554 # timeout { fail "(timeout) ptype unsigned int pointer" }
555 #}
556 #
557 #
558 #send "ptype v_long_pointer\n"
559 #expect {
560 # -re "type = long \*.*$prompt $" { pass "ptype long pointer" }
561 # -re ".*$prompt $" { fail "ptype long pointer" }
562 # timeout { fail "(timeout) ptype long pointer" }
563 #}
564 #
565 #
566 #send "ptype v_signed_long_pointer\n"
567 #expect {
568 # -re "type = long \*.*$prompt $" { pass "ptype signed long pointer" }
569 # -re ".*$prompt $" { fail "ptype signed long pointer" }
570 # timeout { fail "(timeout) ptype signed long pointer" }
571 #}
572 #
573 #
574 #send "ptype v_unsigned_long_pointer\n"
575 #expect {
576 # -re "type = unsigned long \*.*$prompt $" { pass "ptype unsigned long pointer" }
577 # -re ".*$prompt $" { fail "ptype unsigned long pointer" }
578 # timeout { fail "(timeout) ptype unsigned long pointer" }
579 #}
580 #
581 #
582 #send "ptype v_float_pointer\n"
583 #expect {
584 # -re "type = float \*.*$prompt $" { pass "ptype float pointer" }
585 # -re ".*$prompt $" { fail "ptype float pointer" }
586 # timeout { fail "(timeout) ptype float pointer" }
587 #}
588 #
589 #
590 #send "ptype v_double_pointer\n"
591 #expect {
592 # -re "type = double \*.*$prompt $" { pass "ptype double pointer" }
593 # -re ".*$prompt $" { fail "ptype double pointer" }
594 # timeout { fail "(timeout) ptype double pointer" }
595 #}
596
597 #
598 # test ptype command with nested structure and union
599 #
600 send "ptype struct outer_struct\n"
601 expect {
602 -re "type = struct outer_struct \{.*
603 int outer_int;.*
604 struct inner_struct inner_struct_instance;.*
605 union inner_union inner_union_instance;.*
606 (long|long int|int) outer_long;.*
607 \}.*$prompt $" { pass "ptype outer structure" }
608 -re ".*$prompt $" { fail "ptype outer structure" }
609 timeout { fail "(timeout) ptype outer structure" }
610 }
611
612
613 send "ptype struct inner_struct\n"
614 expect {
615 -re "type = struct inner_struct \{.*
616 int inner_int;.*
617 (long|long int|int) inner_long;.*
618 \}.*$prompt $" { pass "ptype inner structure" }
619 -re ".*$prompt $" { fail "ptype inner structure" }
620 timeout { fail "(timeout) ptype inner structure" }
621 }
622
623
624 send "ptype union inner_union\n"
625 expect {
626 -re "type = union inner_union \{.*
627 int inner_union_int;.*
628 (long|long int|int) inner_union_long;.*
629 \}.*$prompt $" { pass "ptype inner union" }
630 -re ".*$prompt $" { fail "ptype inner union" }
631 timeout { fail "(timeout) ptype inner union" }
632 }
633
634
635 send "ptype nested_su\n"
636 expect {
637 -re "type = struct outer_struct \{.*
638 int outer_int;.*
639 struct inner_struct inner_struct_instance;.*
640 union inner_union inner_union_instance;.*
641 (long|long int|int) outer_long;.*
642 \}.*$prompt $" { pass "ptype nested structure" }
643 -re ".*$prompt $" { fail "ptype nested structure" }
644 timeout { fail "(timeout) ptype nested structure" }
645 }
646
647
648 send "ptype nested_su.outer_int\n"
649 expect {
650 -re "type = int.*$prompt $" { pass "ptype outer int" }
651 -re ".*$prompt $" { fail "ptype outer int" }
652 timeout { fail "(timeout) ptype outer int" }
653 }
654
655
656 send "ptype nested_su.inner_struct_instance\n"
657 expect {
658 -re "type = struct inner_struct \{.*
659 int inner_int;.*
660 (long|long int|int) inner_long;.*
661 \}.*$prompt $" { pass "ptype nested structure" }
662 -re ".*$prompt $" { fail "ptype nested structure" }
663 timeout { fail "(timeout) ptype nested structure" }
664 }
665
666
667 send "ptype nested_su.inner_struct_instance.inner_int\n"
668 expect {
669 -re "type = int.*$prompt $" { pass "ptype inner int" }
670 -re ".*$prompt $" { fail "ptype inner int" }
671 timeout { fail "(timeout) ptype inner int" }
672 }
673
674
675 send "ptype nested_su.inner_union_instance\n"
676 expect {
677 -re "type = union inner_union \{.*
678 int inner_union_int;.*
679 (long|long int|int) inner_union_long;.*
680 \}.*$prompt $" { pass "ptype nested union" }
681 -re ".*$prompt $" { fail "ptype nested union" }
682 timeout { fail "(timeout) ptype nested union" }
683 }
684
685 # Test printing type of string constants and array constants, but
686 # requires a running process. These call malloc, and can take a long
687 # time to execute over a slow serial link, so increase the timeout.
688
689 # UDI can't do this (PR 2416). XFAIL is not suitable, because attempting
690 # the operation causes a slow painful death rather than a nice simple failure.
691
692 if ![istarget "*-*-udi*"] then {
693 if [runto_main] then {
694 setup_xfail "a29k-*-udi" 2416
695 gdb_test "ptype \"abc\"" "type = char \\\[4\\\]"
696 setup_xfail "a29k-*-udi" 2416
697 gdb_test "ptype {'a','b','c'}" "type = char \\\[3\\\]"
698 setup_xfail "a29k-*-udi" 2416
699 gdb_test "ptype {0,1,2}" "type = int \\\[3\\\]"
700 setup_xfail "a29k-*-udi" 2416
701 gdb_test "ptype {(long)0,(long)1,(long)2}" "type = long \\\[3\\\]"
702 setup_xfail "a29k-*-udi" 2416
703 gdb_test "ptype {(float)0,(float)1,(float)2}" "type = float \\\[3\\\]"
704 setup_xfail "a29k-*-udi" 2416
705 gdb_test "ptype {{0,1,2},{3,4,5}}" "type = int \\\[2\\\]\\\[3\\\]"
706 setup_xfail "a29k-*-udi" 2416
707 gdb_test "ptype {4,5,6}\[2\]" "type = int"
708 setup_xfail "a29k-*-udi" 2416
709 gdb_test "ptype *&{4,5,6}\[1\]" "type = int"
710 }
711 }
This page took 0.073941 seconds and 5 git commands to generate.