Commit | Line | Data |
---|---|---|
ef44eed1 SS |
1 | # Copyright (C) 1988, 1990, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, 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 | gdb_test "whatis v_boolean" "type = boolean" \ | |
202 | "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)" | |
203 | ||
204 | # Same thing with struct and union. | |
205 | gdb_test "ptype t_struct3" "type = struct \{.* | |
206 | *double v_double_member;.* | |
207 | *int v_int_member;.*\}" "printing typedef'd struct" | |
208 | ||
209 | gdb_test "ptype t_union3" "type = union \{.* | |
210 | *double v_double_member;.* | |
211 | *int v_int_member;.*\}" "printing typedef'd union" | |
212 | ||
213 | send "ptype enum bvals\n" | |
214 | expect { | |
215 | -re "type = enum bvals \{false, true\}.*$prompt $" { pass "ptype named typedef'd enumf'd enum" } | |
216 | -re ".*$prompt $" { fail "ptype named typedef'd enumeration" } | |
217 | timeout { fail "(timeout) ptype named typedef'd enumeration" } | |
218 | } | |
219 | ||
220 | ||
221 | # | |
222 | # test ptype command with out-of-order enum values | |
223 | # | |
224 | send "ptype enum misordered\n" | |
225 | expect { | |
226 | -re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\ | |
227 | { pass "ptype misordered enumeration" } | |
228 | -re ".*$prompt $" { fail "ptype misordered enumeration" } | |
229 | timeout { fail "(timeout) ptype misordered enumeration" } | |
230 | } | |
231 | ||
232 | ||
233 | # | |
234 | # test ptype command with a named enum's value | |
235 | # | |
236 | send "ptype three\n" | |
237 | expect { | |
238 | -re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\ | |
239 | { pass "ptype named enumeration member" } | |
240 | -re ".*$prompt $" { fail "ptype named enumeration member" } | |
241 | timeout { fail "(timeout) ptype named enumeration member" } | |
242 | } | |
243 | ||
244 | ||
245 | send "ptype red\n" | |
246 | expect { | |
247 | -re "type = enum \{red, green, blue\}.*$prompt $"\ | |
248 | { pass "ptype unnamed enumeration member" } | |
249 | -re ".*$prompt $" { fail "ptype unnamed enumeration member" } | |
250 | timeout { fail "(timeout) ptype unnamed enumeration member" } | |
251 | } | |
252 | ||
253 | ||
254 | # | |
255 | # test ptype command with basic C types | |
256 | # | |
257 | # I've commented most of this out because it duplicates tests in whatis.exp. | |
258 | # I've just left in a token test or 2 which is designed to test that ptype | |
259 | # acts like whatis for basic types. If it is thought to be necessary to | |
260 | # test both whatis and ptype for all the types, the tests should be | |
261 | # merged into whatis.exp, or else maintenance will be a royal pain -kingdon | |
262 | #setup_xfail "i960-*-*" 1821 | |
263 | #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*" | |
264 | #send "ptype v_char\n" | |
265 | #expect { | |
266 | # -re "type = char.*$prompt $" { pass "ptype char" } | |
267 | # -re ".*$prompt $" { fail "ptype char" } | |
268 | # timeout { fail "(timeout) ptype char" } | |
269 | #} | |
270 | # | |
271 | # | |
272 | #setup_xfail "mips-*-*" "a29k-*-*" | |
273 | #send "ptype v_signed_char\n" | |
274 | #expect { | |
275 | # -re "type = signed char.*$prompt $" { pass "ptype signed char" } | |
276 | # -re ".*$prompt $" { fail "ptype signed char" } | |
277 | # timeout { fail "(timeout) ptype signed char" } | |
278 | #} | |
279 | # | |
280 | # | |
281 | #send "ptype v_unsigned_char\n" | |
282 | #expect { | |
283 | # -re "type = unsigned char.*$prompt $" { pass "ptype unsigned char" } | |
284 | # -re ".*$prompt $" { fail "ptype unsigned char" } | |
285 | # timeout { fail "(timeout) ptype unsigned char" } | |
286 | #} | |
287 | ||
288 | ||
289 | send "ptype v_short\n" | |
290 | expect { | |
291 | -re "type = short(| int).*$prompt $" { pass "ptype short" } | |
292 | -re ".*$prompt $" { fail "ptype short" } | |
293 | timeout { fail "(timeout) ptype short" } | |
294 | } | |
295 | ||
296 | ||
297 | #send "ptype v_signed_short\n" | |
298 | #expect { | |
299 | # -re "type = short.*$prompt $" { pass "ptype signed short" } | |
300 | # -re ".*$prompt $" { fail "ptype signed short" } | |
301 | # timeout { fail "(timeout) ptype signed short" } | |
302 | #} | |
303 | # | |
304 | # | |
305 | #send "ptype v_unsigned_short\n" | |
306 | #expect { | |
307 | # -re "type = unsigned short.*$prompt $" { pass "ptype unsigned short" } | |
308 | # -re ".*$prompt $" { fail "ptype unsigned short" } | |
309 | # timeout { fail "(timeout) ptype unsigned short" } | |
310 | #} | |
311 | ||
312 | ||
313 | send "ptype v_int\n" | |
314 | expect { | |
315 | -re "type = int.*$prompt $" { pass "ptype int" } | |
316 | -re ".*$prompt $" { fail "ptype int" } | |
317 | timeout { fail "(timeout) ptype int" } | |
318 | } | |
319 | ||
320 | ||
321 | #send "ptype v_signed_int\n" | |
322 | #expect { | |
323 | # -re "type = int.*$prompt $" { pass "ptype signed int" } | |
324 | # -re ".*$prompt $" { fail "ptype signed int" } | |
325 | # timeout { fail "(timeout) ptype signed int" } | |
326 | #} | |
327 | # | |
328 | # | |
329 | #send "ptype v_unsigned_int\n" | |
330 | #expect { | |
331 | # -re "type = unsigned int.*$prompt $" { pass "ptype unsigned int" } | |
332 | # -re ".*$prompt $" { fail "ptype unsigned int" } | |
333 | # timeout { fail "(timeout) ptype unsigned int" } | |
334 | #} | |
335 | # | |
336 | # | |
337 | #send "ptype v_long\n" | |
338 | #expect { | |
339 | # -re "type = long.*$prompt $" { pass "ptype long" } | |
340 | # -re ".*$prompt $" { fail "ptype long" } | |
341 | # timeout { fail "(timeout) ptype long" } | |
342 | #} | |
343 | # | |
344 | # | |
345 | #send "ptype v_signed_long\n" | |
346 | #expect { | |
347 | # -re "type = long.*$prompt $" { pass "ptype signed long" } | |
348 | # -re ".*$prompt $" { fail "ptype signed long" } | |
349 | # timeout { fail "(timeout) ptype signed long" } | |
350 | #} | |
351 | # | |
352 | # | |
353 | #send "ptype v_unsigned_long\n" | |
354 | #expect { | |
355 | # -re "type = unsigned long.*$prompt $" { pass "ptype unsigned long" } | |
356 | # -re ".*$prompt $" { fail "ptype unsigned long" } | |
357 | # timeout { fail "(timeout) ptype unsigned long" } | |
358 | #} | |
359 | # | |
360 | # | |
361 | #send "ptype v_float\n" | |
362 | #expect { | |
363 | # -re "type = float.*$prompt $" { pass "ptype float" } | |
364 | # -re ".*$prompt $" { fail "ptype float" } | |
365 | # timeout { fail "(timeout) ptype float" } | |
366 | #} | |
367 | # | |
368 | # | |
369 | #send "ptype v_double\n" | |
370 | #expect { | |
371 | # -re "type = double.*$prompt $" { pass "ptype double" } | |
372 | # -re ".*$prompt $" { fail "ptype double" } | |
373 | # timeout { fail "(timeout) ptype double" } | |
374 | #} | |
375 | ||
376 | ||
377 | # | |
378 | # test ptype command with arrays | |
379 | # | |
380 | #setup_xfail "i960-*-*" 1821 | |
381 | #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*" | |
382 | #send "ptype v_char_array\n" | |
383 | #expect { | |
384 | # -re "type = char .2..*$prompt $" { pass "ptype char array" } | |
385 | # -re ".*$prompt $" { fail "ptype char array" } | |
386 | # timeout { fail "(timeout) ptype char array" } | |
387 | #} | |
388 | # | |
389 | # | |
390 | #setup_xfail "mips-*-*" "a29k-*-*" | |
391 | #send "ptype v_signed_char_array\n" | |
392 | #expect { | |
393 | # -re "type = (|signed )char .2..*$prompt $" { pass "ptype signed char array" } | |
394 | # -re ".*$prompt $" { fail "ptype signed char array" } | |
395 | # timeout { fail "(timeout) ptype signed char array" } | |
396 | #} | |
397 | # | |
398 | # | |
399 | #send "ptype v_unsigned_char_array\n" | |
400 | #expect { | |
401 | # -re "type = unsigned char .2..*$prompt $" { pass "ptype unsigned char array" } | |
402 | # -re ".*$prompt $" { fail "ptype unsigned char array" } | |
403 | # timeout { fail "(timeout) ptype unsigned char array" } | |
404 | #} | |
405 | # | |
406 | # | |
407 | # | |
408 | #send "ptype v_int_array\n" | |
409 | #expect { | |
410 | # -re "type = int .2..*$prompt $" { pass "ptype int array" } | |
411 | # -re ".*$prompt $" { fail "ptype int array" } | |
412 | # timeout { fail "(timeout) ptype int array" } | |
413 | #} | |
414 | # | |
415 | # | |
416 | #send "ptype v_signed_int_array\n" | |
417 | #expect { | |
418 | # -re "type = int .2..*$prompt $" { pass "ptype signed int array" } | |
419 | # -re ".*$prompt $" { fail "ptype signed int array" } | |
420 | # timeout { fail "(timeout) ptype signed int array" } | |
421 | #} | |
422 | # | |
423 | # | |
424 | #send "ptype v_unsigned_int_array\n" | |
425 | #expect { | |
426 | # -re "type = unsigned int .2..*$prompt $" { pass "ptype unsigned int array" } | |
427 | # -re ".*$prompt $" { fail "ptype unsigned int array" } | |
428 | # timeout { fail "(timeout) ptype unsigned int array" } | |
429 | #} | |
430 | # | |
431 | # | |
432 | #send "ptype v_long_array\n" | |
433 | #expect { | |
434 | # -re "type = (long|int|long int) .2..*$prompt $" { | |
435 | # pass "ptype long array" } | |
436 | # -re ".*$prompt $" { fail "ptype long array" } | |
437 | # timeout { fail "(timeout) ptype long array" } | |
438 | #} | |
439 | # | |
440 | # | |
441 | #send "ptype v_signed_long_array\n" | |
442 | #expect { | |
443 | # -re "type = (long|int|long int) .2..*$prompt $" { | |
444 | # pass "ptype signed long array" } | |
445 | # -re ".*$prompt $" { fail "ptype signed long array" } | |
446 | # timeout { fail "(timeout) ptype signed long array" } | |
447 | #} | |
448 | # | |
449 | # | |
450 | #send "ptype v_unsigned_long_array\n" | |
451 | #expect { | |
452 | # -re "type = unsigned long .2..*$prompt $" { pass "ptype unsigned long array" } | |
453 | # -re ".*$prompt $" { fail "ptype unsigned long array" } | |
454 | # timeout { fail "(timeout) ptype unsigned long array" } | |
455 | #} | |
456 | # | |
457 | # | |
458 | #send "ptype v_float_array\n" | |
459 | #expect { | |
460 | # -re "type = float .2..*$prompt $" { pass "ptype float array" } | |
461 | # -re ".*$prompt $" { fail "ptype float array" } | |
462 | # timeout { fail "(timeout) ptype float array" } | |
463 | #} | |
464 | # | |
465 | # | |
466 | #send "ptype v_double_array\n" | |
467 | #expect { | |
468 | # -re "type = double .2..*$prompt $" { pass "ptype double array" } | |
469 | # -re ".*$prompt $" { fail "ptype double array" } | |
470 | # timeout { fail "(timeout) ptype double array" } | |
471 | #} | |
472 | # | |
473 | # | |
474 | ## | |
475 | ## test ptype command with pointers | |
476 | ## | |
477 | #setup_xfail "i960-*-*" 1821 | |
478 | #setup_xfail "mips-idt-*" "mips-sgi-*" "a29k-*-*" | |
479 | #send "ptype v_char_pointer\n" | |
480 | #expect { | |
481 | # -re "type = char \*.*$prompt $" { pass "ptype char pointer" } | |
482 | # -re ".*$prompt $" { fail "ptype char pointer" } | |
483 | # timeout { fail "(timeout) ptype char pointer" } | |
484 | #} | |
485 | # | |
486 | # | |
487 | #setup_xfail "mips-*-*" "a29k-*-*" | |
488 | #send "ptype v_signed_char_pointer\n" | |
489 | #expect { | |
490 | # -re "type = (|signed )char \*.*$prompt $" | |
491 | # { pass "ptype signed char pointer" } | |
492 | # -re ".*$prompt $" { fail "ptype signed char pointer" } | |
493 | # timeout { fail "(timeout) ptype signed char pointer" } | |
494 | #} | |
495 | # | |
496 | # | |
497 | #send "ptype v_unsigned_char_pointer\n" | |
498 | #expect { | |
499 | # -re "type = unsigned char \*.*$prompt $" { pass "ptype unsigned char pointer" } | |
500 | # -re ".*$prompt $" { fail "ptype unsigned char pointer" } | |
501 | # timeout { fail "(timeout) ptype unsigned char pointer" } | |
502 | #} | |
503 | # | |
504 | # | |
505 | #send "ptype v_short_pointer\n" | |
506 | #expect { | |
507 | # -re "type = (short|short int) \*.*$prompt $" { pass "ptype short pointer" } | |
508 | # -re ".*$prompt $" { fail "ptype short pointer" } | |
509 | # timeout { fail "(timeout) ptype short pointer" } | |
510 | #} | |
511 | # | |
512 | # | |
513 | #send "ptype v_signed_short_pointer\n" | |
514 | #expect { | |
515 | # -re "type = short \*.*$prompt $" { pass "ptype signed short pointer" } | |
516 | # -re ".*$prompt $" { fail "ptype signed short pointer" } | |
517 | # timeout { fail "(timeout) ptype signed short pointer" } | |
518 | #} | |
519 | # | |
520 | # | |
521 | #send "ptype v_unsigned_short_pointer\n" | |
522 | #expect { | |
523 | # -re "type = unsigned short \*.*$prompt $" { pass "ptype unsigned short pointer" } | |
524 | # -re ".*$prompt $" { fail "ptype unsigned short pointer" } | |
525 | # timeout { fail "(timeout) ptype unsigned short pointer" } | |
526 | #} | |
527 | # | |
528 | # | |
529 | #send "ptype v_int_pointer\n" | |
530 | #expect { | |
531 | # -re "type = int \*.*$prompt $" { pass "ptype int pointer" } | |
532 | # -re ".*$prompt $" { fail "ptype int pointer" } | |
533 | # timeout { fail "(timeout) ptype int pointer" } | |
534 | #} | |
535 | # | |
536 | # | |
537 | #send "ptype v_signed_int_pointer\n" | |
538 | #expect { | |
539 | # -re "type = int \*.*$prompt $" { pass "ptype signed int pointer" } | |
540 | # -re ".*$prompt $" { fail "ptype signed int pointer" } | |
541 | # timeout { fail "(timeout) ptype signed int pointer" } | |
542 | #} | |
543 | # | |
544 | # | |
545 | #send "ptype v_unsigned_int_pointer\n" | |
546 | #expect { | |
547 | # -re "type = unsigned int \*.*$prompt $" { pass "ptype unsigned int pointer" } | |
548 | # -re ".*$prompt $" { fail "ptype unsigned int pointer" } | |
549 | # timeout { fail "(timeout) ptype unsigned int pointer" } | |
550 | #} | |
551 | # | |
552 | # | |
553 | #send "ptype v_long_pointer\n" | |
554 | #expect { | |
555 | # -re "type = long \*.*$prompt $" { pass "ptype long pointer" } | |
556 | # -re ".*$prompt $" { fail "ptype long pointer" } | |
557 | # timeout { fail "(timeout) ptype long pointer" } | |
558 | #} | |
559 | # | |
560 | # | |
561 | #send "ptype v_signed_long_pointer\n" | |
562 | #expect { | |
563 | # -re "type = long \*.*$prompt $" { pass "ptype signed long pointer" } | |
564 | # -re ".*$prompt $" { fail "ptype signed long pointer" } | |
565 | # timeout { fail "(timeout) ptype signed long pointer" } | |
566 | #} | |
567 | # | |
568 | # | |
569 | #send "ptype v_unsigned_long_pointer\n" | |
570 | #expect { | |
571 | # -re "type = unsigned long \*.*$prompt $" { pass "ptype unsigned long pointer" } | |
572 | # -re ".*$prompt $" { fail "ptype unsigned long pointer" } | |
573 | # timeout { fail "(timeout) ptype unsigned long pointer" } | |
574 | #} | |
575 | # | |
576 | # | |
577 | #send "ptype v_float_pointer\n" | |
578 | #expect { | |
579 | # -re "type = float \*.*$prompt $" { pass "ptype float pointer" } | |
580 | # -re ".*$prompt $" { fail "ptype float pointer" } | |
581 | # timeout { fail "(timeout) ptype float pointer" } | |
582 | #} | |
583 | # | |
584 | # | |
585 | #send "ptype v_double_pointer\n" | |
586 | #expect { | |
587 | # -re "type = double \*.*$prompt $" { pass "ptype double pointer" } | |
588 | # -re ".*$prompt $" { fail "ptype double pointer" } | |
589 | # timeout { fail "(timeout) ptype double pointer" } | |
590 | #} | |
591 | ||
592 | ||
593 | # | |
594 | # test ptype command with nested structure and union | |
595 | # | |
596 | send "ptype struct outer_struct\n" | |
597 | expect { | |
598 | -re "type = struct outer_struct \{.* | |
599 | int outer_int;.* | |
600 | struct inner_struct inner_struct_instance;.* | |
601 | union inner_union inner_union_instance;.* | |
602 | (long|long int|int) outer_long;.* | |
603 | \}.*$prompt $" { pass "ptype outer structure" } | |
604 | -re ".*$prompt $" { fail "ptype outer structure" } | |
605 | timeout { fail "(timeout) ptype outer structure" } | |
606 | } | |
607 | ||
608 | ||
609 | send "ptype struct inner_struct\n" | |
610 | expect { | |
611 | -re "type = struct inner_struct \{.* | |
612 | int inner_int;.* | |
613 | (long|long int|int) inner_long;.* | |
614 | \}.*$prompt $" { pass "ptype inner structure" } | |
615 | -re ".*$prompt $" { fail "ptype inner structure" } | |
616 | timeout { fail "(timeout) ptype inner structure" } | |
617 | } | |
618 | ||
619 | ||
620 | send "ptype union inner_union\n" | |
621 | expect { | |
622 | -re "type = union inner_union \{.* | |
623 | int inner_union_int;.* | |
624 | (long|long int|int) inner_union_long;.* | |
625 | \}.*$prompt $" { pass "ptype inner union" } | |
626 | -re ".*$prompt $" { fail "ptype inner union" } | |
627 | timeout { fail "(timeout) ptype inner union" } | |
628 | } | |
629 | ||
630 | ||
631 | send "ptype nested_su\n" | |
632 | expect { | |
633 | -re "type = struct outer_struct \{.* | |
634 | int outer_int;.* | |
635 | struct inner_struct inner_struct_instance;.* | |
636 | union inner_union inner_union_instance;.* | |
637 | (long|long int|int) outer_long;.* | |
638 | \}.*$prompt $" { pass "ptype nested structure" } | |
639 | -re ".*$prompt $" { fail "ptype nested structure" } | |
640 | timeout { fail "(timeout) ptype nested structure" } | |
641 | } | |
642 | ||
643 | ||
644 | send "ptype nested_su.outer_int\n" | |
645 | expect { | |
646 | -re "type = int.*$prompt $" { pass "ptype outer int" } | |
647 | -re ".*$prompt $" { fail "ptype outer int" } | |
648 | timeout { fail "(timeout) ptype outer int" } | |
649 | } | |
650 | ||
651 | ||
652 | send "ptype nested_su.inner_struct_instance\n" | |
653 | expect { | |
654 | -re "type = struct inner_struct \{.* | |
655 | int inner_int;.* | |
656 | (long|long int|int) inner_long;.* | |
657 | \}.*$prompt $" { pass "ptype nested structure" } | |
658 | -re ".*$prompt $" { fail "ptype nested structure" } | |
659 | timeout { fail "(timeout) ptype nested structure" } | |
660 | } | |
661 | ||
662 | ||
663 | send "ptype nested_su.inner_struct_instance.inner_int\n" | |
664 | expect { | |
665 | -re "type = int.*$prompt $" { pass "ptype inner int" } | |
666 | -re ".*$prompt $" { fail "ptype inner int" } | |
667 | timeout { fail "(timeout) ptype inner int" } | |
668 | } | |
669 | ||
670 | ||
671 | send "ptype nested_su.inner_union_instance\n" | |
672 | expect { | |
673 | -re "type = union inner_union \{.* | |
674 | int inner_union_int;.* | |
675 | (long|long int|int) inner_union_long;.* | |
676 | \}.*$prompt $" { pass "ptype nested union" } | |
677 | -re ".*$prompt $" { fail "ptype nested union" } | |
678 | timeout { fail "(timeout) ptype nested union" } | |
679 | } | |
680 | ||
681 | # Test printing type of string constants and array constants, but | |
682 | # requires a running process. These call malloc, and can take a long | |
683 | # time to execute over a slow serial link, so increase the timeout. | |
684 | ||
685 | # UDI can't do this (PR 2416). XFAIL is not suitable, because attempting | |
686 | # the operation causes a slow painful death rather than a nice simple failure. | |
687 | ||
688 | if ![istarget "*-*-udi*"] then { | |
689 | if [runto main] then { | |
690 | set timeout 120 | |
691 | setup_xfail "a29k-*-udi" 2416 | |
692 | gdb_test "ptype \\\"abc\\\"" "type = char \\\[4\\\]" | |
693 | setup_xfail "a29k-*-udi" 2416 | |
694 | gdb_test "ptype {'a','b','c'}" "type = char \\\[3\\\]" | |
695 | setup_xfail "a29k-*-udi" 2416 | |
696 | gdb_test "ptype {0,1,2}" "type = int \\\[3\\\]" | |
697 | setup_xfail "a29k-*-udi" 2416 | |
698 | gdb_test "ptype {(long)0,(long)1,(long)2}" "type = long \\\[3\\\]" | |
699 | setup_xfail "a29k-*-udi" 2416 | |
700 | gdb_test "ptype {(float)0,(float)1,(float)2}" "type = float \\\[3\\\]" | |
701 | setup_xfail "a29k-*-udi" 2416 | |
702 | gdb_test "ptype {{0,1,2},{3,4,5}}" "type = int \\\[2\\\]\\\[3\\\]" | |
703 | setup_xfail "a29k-*-udi" 2416 | |
704 | gdb_test "ptype {4,5,6}\\\[2\\\]" "type = int" | |
705 | setup_xfail "a29k-*-udi" 2416 | |
706 | gdb_test "ptype *&{4,5,6}\\\[1\\\]" "type = int" | |
707 | set timeout 10 | |
708 | if [istarget "a29k-*-udi"] then { | |
709 | # FIXME: If PR 2415 is fixed, this is not needed. | |
710 | gdb_target_udi | |
711 | } | |
712 | } | |
713 | } |