Fix PR gdb/66.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / ptype.exp
1 # Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999, 2000
2 # Free Software Foundation, Inc.
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
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 # Please email any bugs, comments, and/or additions to this file to:
19 # bug-gdb@prep.ai.mit.edu
20
21 # This file was written by Rob Savoye. (rob@cygnus.com)
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 testfile "ptype"
34 set srcfile ${testfile}.c
35 set binfile ${objdir}/${subdir}/${testfile}
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
37 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
38 }
39
40 # Create and source the file that provides information about the compiler
41 # used to compile the test case.
42 if [get_compiler_info ${binfile}] {
43 return -1;
44 }
45
46 gdb_exit
47 gdb_start
48 gdb_reinitialize_dir $srcdir/$subdir
49 gdb_load ${binfile}
50
51 # Test ptype of unnamed enumeration members before any action causes
52 # the partial symbol table to be expanded to full symbols. This fails
53 # with stabs compilers which fail to use a nameless stab (such as
54 # pre-2.4.5 versions of gcc and most non-gcc compilers).
55
56 send_gdb "ptype red1\n"
57 gdb_expect {
58 -re "type = enum primary1_tag \{red1, green1, blue1\}.*$gdb_prompt $"\
59 {
60 # The workaround is in effect. As this is a compiler, not GDB,
61 # bug, we'll make it a PASS but perhaps it should be an XFAIL.
62 pass "ptype unnamed enumeration member (worked around)"
63 }
64 -re "type = enum \{red1, green1, blue1\}.*$gdb_prompt $"\
65 { pass "ptype unnamed enumeration member" }
66 -re ".*$gdb_prompt $" { fail "ptype unnamed enumeration member" }
67 timeout { fail "(timeout) ptype unnamed enumeration member" }
68 }
69
70 #
71 # test ptype command with structures
72 #
73 # Here and elsewhere, we accept
74 # "long", "long int", or "int" for long variables (whatis.exp already
75 # has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
76 gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure"
77
78
79 # Test the equivalence between '.' and '->' for struct member references.
80
81 if [gdb_test "ptype v_struct1.v_float_member" "type = float"]<0 then {
82 return -1
83 }
84 if [gdb_test "ptype v_struct1->v_float_member" "type = float"]<0 then {
85 return -1
86 }
87 if [gdb_test "ptype v_t_struct_p.v_float_member" "type = float"]<0 then {
88 return -1
89 }
90 if [gdb_test "ptype v_t_struct_p->v_float_member" "type = float"]<0 then {
91 return -1
92 }
93
94
95 # IBM's xlc puts out bogus stabs--the stuff field is type 42,
96 # which isn't defined.
97
98 gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure"
99
100 #
101 # test ptype command with unions
102 #
103 gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union"
104
105 # IBM's xlc puts out bogus stabs--the stuff field is type 42,
106 # which isn't defined.
107 gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union"
108
109 #
110 # test ptype command with enums
111 #
112
113 gdb_test "ptype primary" "type = enum .red, green, blue.*" "ptype unnamed enumeration"
114
115 gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "ptype named enumeration"
116
117
118 #
119 # test ptype command with enums as typedef
120 #
121 gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration"
122
123 # And check that whatis shows the name, not "enum {...}".
124 # This probably fails for all DWARF 1 cases, so assume so for now. -fnf
125 # The problem with xlc is that the stabs look like
126 # :t51=eFALSE:0,TRUE:1,;
127 # boolean:t55=51
128 # v_boolean:G51
129 # GDB's behavior is correct; the type which the variable is defined
130 # as (51) doesn't have a name. Only 55 has a name.
131
132 if {!$gcc_compiled && !$hp_aCC_compiler} {
133 setup_xfail "rs6000-*-*" "i*86-*-sysv4*"
134 setup_xfail "hppa*-*-*" CLLbs14773
135 }
136
137 # For get_debug_format to do its job, we need to have a current source file.
138 gdb_test "list main" ""
139 get_debug_format
140 setup_xfail_format "DWARF 1"
141 gdb_test "whatis v_boolean" "type = (enum |)boolean" \
142 "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
143
144 # Same thing with struct and union.
145 gdb_test "ptype t_struct3" "type = struct (t_struct3 |)\{.*
146 *double v_double_member;.*
147 *int v_int_member;.*\}" "printing typedef'd struct"
148
149 gdb_test "ptype t_union3" "type = union (t_union3 |)\{.*
150 *double v_double_member;.*
151 *int v_int_member;.*\}" "printing typedef'd union"
152
153 gdb_test "ptype enum bvals" "type = enum bvals \{my_false, my_true\}.*" "ptype named typedef'd enumf'd enum"
154
155 #
156 # test ptype command with out-of-order enum values
157 #
158 gdb_test "ptype enum misordered" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype misordered enumeration"
159
160 #
161 # test ptype command with a named enum's value
162 #
163 gdb_test "ptype three" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype named enumeration member"
164
165 gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumeration member #2"
166
167 #
168 # test ptype command with basic C types
169 #
170 # I've commented most of this out because it duplicates tests in whatis.exp.
171 # I've just left in a token test or 2 which is designed to test that ptype
172 # acts like whatis for basic types. If it is thought to be necessary to
173 # test both whatis and ptype for all the types, the tests should be
174 # merged into whatis.exp, or else maintenance will be a royal pain -kingdon
175 #setup_xfail "i960-*-*" 1821
176 #setup_xfail "mips-idt-*" "mips-sgi-*"
177 # OBSOLETE #setup_xfail "a29k-*-*"
178 #send "ptype v_char\n"
179 #gdb_expect {
180 # -re "type = char.*$gdb_prompt $" { pass "ptype char" }
181 # -re ".*$gdb_prompt $" { fail "ptype char" }
182 # timeout { fail "(timeout) ptype char" }
183 #}
184 #
185 #
186 #setup_xfail "mips-*-*"
187 # OBSOLETE #setup_xfail "a29k-*-*"
188 #send "ptype v_signed_char\n"
189 #gdb_expect {
190 # -re "type = signed char.*$gdb_prompt $" { pass "ptype signed char" }
191 # -re ".*$gdb_prompt $" { fail "ptype signed char" }
192 # timeout { fail "(timeout) ptype signed char" }
193 #}
194 #
195 #
196 #send "ptype v_unsigned_char\n"
197 #gdb_expect {
198 # -re "type = unsigned char.*$gdb_prompt $" { pass "ptype unsigned char" }
199 # -re ".*$gdb_prompt $" { fail "ptype unsigned char" }
200 # timeout { fail "(timeout) ptype unsigned char" }
201 #}
202
203 gdb_test "ptype v_short" "type = short(| int).*" "ptype short"
204
205 #send "ptype v_signed_short\n"
206 #gdb_expect {
207 # -re "type = short.*$gdb_prompt $" { pass "ptype signed short" }
208 # -re ".*$gdb_prompt $" { fail "ptype signed short" }
209 # timeout { fail "(timeout) ptype signed short" }
210 #}
211 #
212 #
213 #send "ptype v_unsigned_short\n"
214 #gdb_expect {
215 # -re "type = unsigned short.*$gdb_prompt $" { pass "ptype unsigned short" }
216 # -re ".*$gdb_prompt $" { fail "ptype unsigned short" }
217 # timeout { fail "(timeout) ptype unsigned short" }
218 #}
219
220
221 gdb_test "ptype v_int" "type = int.*" "ptype int"
222
223 #send "ptype v_signed_int\n"
224 #gdb_expect {
225 # -re "type = int.*$gdb_prompt $" { pass "ptype signed int" }
226 # -re ".*$gdb_prompt $" { fail "ptype signed int" }
227 # timeout { fail "(timeout) ptype signed int" }
228 #}
229 #
230 #
231 #send "ptype v_unsigned_int\n"
232 #gdb_expect {
233 # -re "type = unsigned int.*$gdb_prompt $" { pass "ptype unsigned int" }
234 # -re ".*$gdb_prompt $" { fail "ptype unsigned int" }
235 # timeout { fail "(timeout) ptype unsigned int" }
236 #}
237 #
238 #
239 #send "ptype v_long\n"
240 #gdb_expect {
241 # -re "type = long.*$gdb_prompt $" { pass "ptype long" }
242 # -re ".*$gdb_prompt $" { fail "ptype long" }
243 # timeout { fail "(timeout) ptype long" }
244 #}
245 #
246 #
247 #send "ptype v_signed_long\n"
248 #gdb_expect {
249 # -re "type = long.*$gdb_prompt $" { pass "ptype signed long" }
250 # -re ".*$gdb_prompt $" { fail "ptype signed long" }
251 # timeout { fail "(timeout) ptype signed long" }
252 #}
253 #
254 #
255 #send "ptype v_unsigned_long\n"
256 #gdb_expect {
257 # -re "type = unsigned long.*$gdb_prompt $" { pass "ptype unsigned long" }
258 # -re ".*$gdb_prompt $" { fail "ptype unsigned long" }
259 # timeout { fail "(timeout) ptype unsigned long" }
260 #}
261 #
262 #
263 #send "ptype v_float\n"
264 #gdb_expect {
265 # -re "type = float.*$gdb_prompt $" { pass "ptype float" }
266 # -re ".*$gdb_prompt $" { fail "ptype float" }
267 # timeout { fail "(timeout) ptype float" }
268 #}
269 #
270 #
271 #send "ptype v_double\n"
272 #gdb_expect {
273 # -re "type = double.*$gdb_prompt $" { pass "ptype double" }
274 # -re ".*$gdb_prompt $" { fail "ptype double" }
275 # timeout { fail "(timeout) ptype double" }
276 #}
277
278
279 #
280 # test ptype command with arrays
281 #
282 #setup_xfail "i960-*-*" 1821
283 #setup_xfail "mips-idt-*" "mips-sgi-*"
284 # OBSOLETE #setup_xfail "a29k-*-*"
285 #send "ptype v_char_array\n"
286 #gdb_expect {
287 # -re "type = char .2..*$gdb_prompt $" { pass "ptype char array" }
288 # -re ".*$gdb_prompt $" { fail "ptype char array" }
289 # timeout { fail "(timeout) ptype char array" }
290 #}
291 #
292 #
293 #setup_xfail "mips-*-*"
294 # OBSOLETE #setup_xfail "a29k-*-*"
295 #send "ptype v_signed_char_array\n"
296 #gdb_expect {
297 # -re "type = (|signed )char .2..*$gdb_prompt $" { pass "ptype signed char array" }
298 # -re ".*$gdb_prompt $" { fail "ptype signed char array" }
299 # timeout { fail "(timeout) ptype signed char array" }
300 #}
301 #
302 #
303 #send "ptype v_unsigned_char_array\n"
304 #gdb_expect {
305 # -re "type = unsigned char .2..*$gdb_prompt $" { pass "ptype unsigned char array" }
306 # -re ".*$gdb_prompt $" { fail "ptype unsigned char array" }
307 # timeout { fail "(timeout) ptype unsigned char array" }
308 #}
309 #
310 #
311 #
312 #send "ptype v_int_array\n"
313 #gdb_expect {
314 # -re "type = int .2..*$gdb_prompt $" { pass "ptype int array" }
315 # -re ".*$gdb_prompt $" { fail "ptype int array" }
316 # timeout { fail "(timeout) ptype int array" }
317 #}
318 #
319 #
320 #send "ptype v_signed_int_array\n"
321 #gdb_expect {
322 # -re "type = int .2..*$gdb_prompt $" { pass "ptype signed int array" }
323 # -re ".*$gdb_prompt $" { fail "ptype signed int array" }
324 # timeout { fail "(timeout) ptype signed int array" }
325 #}
326 #
327 #
328 #send "ptype v_unsigned_int_array\n"
329 #gdb_expect {
330 # -re "type = unsigned int .2..*$gdb_prompt $" { pass "ptype unsigned int array" }
331 # -re ".*$gdb_prompt $" { fail "ptype unsigned int array" }
332 # timeout { fail "(timeout) ptype unsigned int array" }
333 #}
334 #
335 #
336 #send "ptype v_long_array\n"
337 #gdb_expect {
338 # -re "type = (long|int|long int) .2..*$gdb_prompt $" {
339 # pass "ptype long array" }
340 # -re ".*$gdb_prompt $" { fail "ptype long array" }
341 # timeout { fail "(timeout) ptype long array" }
342 #}
343 #
344 #
345 #send "ptype v_signed_long_array\n"
346 #gdb_expect {
347 # -re "type = (long|int|long int) .2..*$gdb_prompt $" {
348 # pass "ptype signed long array" }
349 # -re ".*$gdb_prompt $" { fail "ptype signed long array" }
350 # timeout { fail "(timeout) ptype signed long array" }
351 #}
352 #
353 #
354 #send "ptype v_unsigned_long_array\n"
355 #gdb_expect {
356 # -re "type = unsigned long .2..*$gdb_prompt $" { pass "ptype unsigned long array" }
357 # -re ".*$gdb_prompt $" { fail "ptype unsigned long array" }
358 # timeout { fail "(timeout) ptype unsigned long array" }
359 #}
360 #
361 #
362 #send "ptype v_float_array\n"
363 #gdb_expect {
364 # -re "type = float .2..*$gdb_prompt $" { pass "ptype float array" }
365 # -re ".*$gdb_prompt $" { fail "ptype float array" }
366 # timeout { fail "(timeout) ptype float array" }
367 #}
368 #
369 #
370 #send "ptype v_double_array\n"
371 #gdb_expect {
372 # -re "type = double .2..*$gdb_prompt $" { pass "ptype double array" }
373 # -re ".*$gdb_prompt $" { fail "ptype double array" }
374 # timeout { fail "(timeout) ptype double array" }
375 #}
376 #
377
378 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
379 setup_xfail_format "DWARF 1"
380 if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"}
381 gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
382
383 #
384 ##
385 ## test ptype command with pointers
386 ##
387 #setup_xfail "i960-*-*" 1821
388 #setup_xfail "mips-idt-*" "mips-sgi-*"
389 # OBSOLETE #setup_xfail "a29k-*-*"
390 #send "ptype v_char_pointer\n"
391 #gdb_expect {
392 # -re "type = char \*.*$gdb_prompt $" { pass "ptype char pointer" }
393 # -re ".*$gdb_prompt $" { fail "ptype char pointer" }
394 # timeout { fail "(timeout) ptype char pointer" }
395 #}
396 #
397 #
398 #setup_xfail "mips-*-*"
399 # OBSOLETE #setup_xfail "a29k-*-*"
400 #send "ptype v_signed_char_pointer\n"
401 #gdb_expect {
402 # -re "type = (|signed )char \*.*$gdb_prompt $"
403 # { pass "ptype signed char pointer" }
404 # -re ".*$gdb_prompt $" { fail "ptype signed char pointer" }
405 # timeout { fail "(timeout) ptype signed char pointer" }
406 #}
407 #
408 #
409 #send "ptype v_unsigned_char_pointer\n"
410 #gdb_expect {
411 # -re "type = unsigned char \*.*$gdb_prompt $" { pass "ptype unsigned char pointer" }
412 # -re ".*$gdb_prompt $" { fail "ptype unsigned char pointer" }
413 # timeout { fail "(timeout) ptype unsigned char pointer" }
414 #}
415 #
416 #
417 #send "ptype v_short_pointer\n"
418 #gdb_expect {
419 # -re "type = (short|short int) \*.*$gdb_prompt $" { pass "ptype short pointer" }
420 # -re ".*$gdb_prompt $" { fail "ptype short pointer" }
421 # timeout { fail "(timeout) ptype short pointer" }
422 #}
423 #
424 #
425 #send "ptype v_signed_short_pointer\n"
426 #gdb_expect {
427 # -re "type = short \*.*$gdb_prompt $" { pass "ptype signed short pointer" }
428 # -re ".*$gdb_prompt $" { fail "ptype signed short pointer" }
429 # timeout { fail "(timeout) ptype signed short pointer" }
430 #}
431 #
432 #
433 #send "ptype v_unsigned_short_pointer\n"
434 #gdb_expect {
435 # -re "type = unsigned short \*.*$gdb_prompt $" { pass "ptype unsigned short pointer" }
436 # -re ".*$gdb_prompt $" { fail "ptype unsigned short pointer" }
437 # timeout { fail "(timeout) ptype unsigned short pointer" }
438 #}
439 #
440 #
441 #send "ptype v_int_pointer\n"
442 #gdb_expect {
443 # -re "type = int \*.*$gdb_prompt $" { pass "ptype int pointer" }
444 # -re ".*$gdb_prompt $" { fail "ptype int pointer" }
445 # timeout { fail "(timeout) ptype int pointer" }
446 #}
447 #
448 #
449 #send "ptype v_signed_int_pointer\n"
450 #gdb_expect {
451 # -re "type = int \*.*$gdb_prompt $" { pass "ptype signed int pointer" }
452 # -re ".*$gdb_prompt $" { fail "ptype signed int pointer" }
453 # timeout { fail "(timeout) ptype signed int pointer" }
454 #}
455 #
456 #
457 #send "ptype v_unsigned_int_pointer\n"
458 #gdb_expect {
459 # -re "type = unsigned int \*.*$gdb_prompt $" { pass "ptype unsigned int pointer" }
460 # -re ".*$gdb_prompt $" { fail "ptype unsigned int pointer" }
461 # timeout { fail "(timeout) ptype unsigned int pointer" }
462 #}
463 #
464 #
465 #send "ptype v_long_pointer\n"
466 #gdb_expect {
467 # -re "type = long \*.*$gdb_prompt $" { pass "ptype long pointer" }
468 # -re ".*$gdb_prompt $" { fail "ptype long pointer" }
469 # timeout { fail "(timeout) ptype long pointer" }
470 #}
471 #
472 #
473 #send "ptype v_signed_long_pointer\n"
474 #gdb_expect {
475 # -re "type = long \*.*$gdb_prompt $" { pass "ptype signed long pointer" }
476 # -re ".*$gdb_prompt $" { fail "ptype signed long pointer" }
477 # timeout { fail "(timeout) ptype signed long pointer" }
478 #}
479 #
480 #
481 #send "ptype v_unsigned_long_pointer\n"
482 #gdb_expect {
483 # -re "type = unsigned long \*.*$gdb_prompt $" { pass "ptype unsigned long pointer" }
484 # -re ".*$gdb_prompt $" { fail "ptype unsigned long pointer" }
485 # timeout { fail "(timeout) ptype unsigned long pointer" }
486 #}
487 #
488 #
489 #send "ptype v_float_pointer\n"
490 #gdb_expect {
491 # -re "type = float \*.*$gdb_prompt $" { pass "ptype float pointer" }
492 # -re ".*$gdb_prompt $" { fail "ptype float pointer" }
493 # timeout { fail "(timeout) ptype float pointer" }
494 #}
495 #
496 #
497 #send "ptype v_double_pointer\n"
498 #gdb_expect {
499 # -re "type = double \*.*$gdb_prompt $" { pass "ptype double pointer" }
500 # -re ".*$gdb_prompt $" { fail "ptype double pointer" }
501 # timeout { fail "(timeout) ptype double pointer" }
502 #}
503
504 #
505 # test ptype command with nested structure and union
506 #
507 if {$hp_aCC_compiler} {
508 set outer "outer_struct::"
509 set struct ""
510 set union ""
511 } else {
512 set outer ""
513 set struct "struct"
514 set union "union"
515 }
516 gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\]+\
517 .*int outer_int;.*\[\r\n\]+\
518 .*(struct|) ${outer}inner_struct inner_struct_instance;.*\[\r\n\]+\
519 .*(union|) ${outer}inner_union inner_union_instance;.*\[\r\n\]+\
520 .*(long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure"
521
522 gdb_test "ptype ${struct} ${outer}inner_struct" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure"
523
524 gdb_test "ptype ${union} ${outer}inner_union" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union"
525
526 gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] (struct |)${outer}inner_struct inner_struct_instance;.*\[\r\n\] (union |)${outer}inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure"
527
528 gdb_test "ptype nested_su.outer_int" "type = int.*" "ptype outer int"
529
530 gdb_test "ptype nested_su.inner_struct_instance" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2"
531
532 gdb_test "ptype nested_su.inner_struct_instance.inner_int" "type = int.*" "ptype inner int"
533
534 gdb_test "ptype nested_su.inner_union_instance" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union"
535
536 # Test printing type of string constants and array constants, but
537 # requires a running process. These call malloc, and can take a long
538 # time to execute over a slow serial link, so increase the timeout.
539
540 # UDI can't do this (PR 2416). XFAIL is not suitable, because attempting
541 # the operation causes a slow painful death rather than a nice simple failure.
542
543 if [runto_main] then {
544
545 if [target_info exists gdb,cannot_call_functions] {
546 setup_xfail "*-*-*" 2416
547 fail "This target can not call functions"
548 continue
549 }
550
551 # We need to up this because this can be really slow on some boards.
552 # (malloc() is called as part of the test).
553 set timeout 60;
554
555 gdb_test "ptype \"abc\"" "type = char \\\[4\\\]"
556 gdb_test "ptype {'a','b','c'}" "type = char \\\[3\\\]"
557 gdb_test "ptype {0,1,2}" "type = int \\\[3\\\]"
558 gdb_test "ptype {(long)0,(long)1,(long)2}" "type = long \\\[3\\\]"
559 gdb_test "ptype {(float)0,(float)1,(float)2}" "type = float \\\[3\\\]"
560 gdb_test "ptype {{0,1,2},{3,4,5}}" "type = int \\\[2\\\]\\\[3\\\]"
561 gdb_test "ptype {4,5,6}\[2\]" "type = int"
562 gdb_test "ptype *&{4,5,6}\[1\]" "type = int"
563 }
This page took 0.069546 seconds and 5 git commands to generate.