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