1 # Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
2 # 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
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 3 of the License, or
7 # (at your option) any later version.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # This file was written by Fred Fish. (fnf@cygnus.com)
18 # And rewritten by Michael Chastain. (mec.gnu@mindspring.com)
28 if { [skip_cplus_tests] } { continue }
30 load_lib "cp-support.exp"
32 set testfile "inherit"
34 set binfile ${objdir}/${subdir}/${testfile}
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
41 # Single inheritance, print type definitions.
43 proc test_ptype_si { } {
51 "ptype A" "ptype A (FIXME)" "class" "A" \
53 { field public "int a;" }
54 { field public "int x;" }
56 cp_test_ptype_class "ptype class A" "ptype class A (FIXME)" "class" "A" ibid
57 cp_test_ptype_class "ptype g_A" "ptype g_A (FIXME)" "class" "A" ibid
62 "ptype B" "" "class" "B" \
65 { field public "int b;" }
66 { field public "int x;" }
68 cp_test_ptype_class "ptype class B" "" "class" "B" ibid
69 cp_test_ptype_class "ptype g_B" "" "class" "B" ibid
71 # Another derived class.
74 "ptype C" "" "class" "C" \
77 { field public "int c;" }
78 { field public "int x;" }
80 cp_test_ptype_class "ptype class C" "" "class" "C" ibid
81 cp_test_ptype_class "ptype g_C" "" "class" "C" ibid
83 # A structure with no tag.
84 # TODO: move this mess into a separate file, and re-specify
85 # which results are PASS, KFAIL, XFAIL, and FAIL.
87 set re_tag "tagless_struct"
89 set re_class "(class $re_tag \{${ws}public:|class \{${ws}public:|struct $re_tag \{|struct \{)"
90 set XX_class "(class $XX_tag \{${ws}public:|struct $XX_tag \{)"
91 set re_fields "int one;${ws}int two;"
92 set re_synth_gcc_23 "$re_tag & operator=\\($re_tag const ?&\\);${ws}$re_tag\\($re_tag const ?&\\);${ws}$re_tag\\((void|)\\);"
93 set XX_synth_gcc_23 "($re_tag|$XX_tag) & operator=\\($XX_tag const ?&\\);${ws}$XX_tag\\($XX_tag const ?&\\);${ws}$XX_tag\\((void|)\\);"
95 set name "ptype tagless struct"
96 gdb_test_multiple "ptype tagless_struct" $name {
97 -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
98 # gcc 2.95.3 -gdwarf-2
101 -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" {
102 # gcc 2.95.3 -gstabs+
105 -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
106 # gcc 3.3.4 -gdwarf-2
107 # gcc 3.4.1 -gdwarf-2
108 # gcc HEAD 2004-07-31 -gdwarf-2
109 # gcc HEAD 2004-07-31 -gstabs+
112 -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
117 -re "No symbol \"tagless_struct\" in current context.$nl$gdb_prompt $" {
118 # Several GCC 4.x versions provide neither a DW_TAG_typedef DIE
119 # nor use the typedef name as struct tag name.
124 set name "ptype variable of type tagless struct"
125 gdb_test_multiple "ptype v_tagless" $name {
126 -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
127 # gcc 2.95.3 -gdwarf-2
130 -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" {
131 # gcc 2.95.3 -gstabs+
134 -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
135 # gcc 3.3.4 -gdwarf-2
136 # gcc 3.4.1 -gdwarf-2
137 # gcc HEAD 2004-07-31 -gdwarf-2
138 # gcc HEAD 2004-07-31 -gstabs+
141 -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
149 # Multiple inheritance, print type definitions.
151 proc test_ptype_mi { } {
153 # A class with two bases.
155 cp_test_ptype_class \
156 "ptype D" "" "class" "D" \
160 { field public "int d;" }
161 { field public "int x;" }
163 cp_test_ptype_class "ptype class D" "" "class" "D" ibid
164 cp_test_ptype_class "ptype g_D" "" "class" "D" ibid
166 # A class derived from the previous class.
168 cp_test_ptype_class \
169 "ptype E" "" "class" "E" \
172 { field public "int e;" }
173 { field public "int x;" }
175 cp_test_ptype_class "ptype class E" "" "class" "E" ibid
176 cp_test_ptype_class "ptype g_E" "" "class" "E" ibid
179 # Single virtual inheritance, print type definitions.
181 proc test_ptype_vi { } {
185 cp_test_ptype_class \
186 "ptype vA" "" "class" "vA" \
188 { field public "int va;" }
189 { field public "int vx;" }
191 cp_test_ptype_class "ptype class vA" "" "class" "vA" ibid
192 cp_test_ptype_class "ptype g_vA" "" "class" "vA" ibid
196 cp_test_ptype_class \
197 "ptype vB" "" "class" "vB" \
199 { base "public virtual vA" }
201 { field public "int vb;" }
202 { field public "int vx;" }
204 cp_test_ptype_class "ptype class vB" "" "class" "vB" ibid
205 cp_test_ptype_class "ptype g_vB" "" "class" "vB" ibid
209 cp_test_ptype_class \
210 "ptype vC" "" "class" "vC" \
212 { base "public virtual vA" }
214 { field public "int vc;" }
215 { field public "int vx;" }
217 cp_test_ptype_class "ptype class vC" "" "class" "vC" ibid
218 cp_test_ptype_class "ptype g_vC" "" "class" "vC" ibid
222 # Multiple virtual inheritance, print type definitions.
224 proc test_ptype_mvi { } {
228 cp_test_ptype_class \
229 "ptype vD" "" "class" "vD" \
231 { base "public virtual vB" }
232 { base "public virtual vC" }
235 { field public "int vd;" }
236 { field public "int vx;" }
238 cp_test_ptype_class "ptype class vD" "" "class" "vD" ibid
239 cp_test_ptype_class "ptype g_vD" "" "class" "vD" ibid
243 cp_test_ptype_class \
244 "ptype vE" "" "class" "vE" \
246 { base "public virtual vD" }
248 { field public "int ve;" }
249 { field public "int vx;" }
251 cp_test_ptype_class "ptype class vE" "" "class" "vE" ibid
252 cp_test_ptype_class "ptype g_vE" "" "class" "vE" ibid
256 # Single inheritance, print individual members.
258 proc test_print_si_members { } {
261 # Print all members of g_A using fully qualified form.
262 gdb_test "print g_A.A::a" "$vhn = 1"
263 gdb_test "print g_A.A::x" "$vhn = 2"
265 # Print members of g_A using nonambiguous compact form.
266 gdb_test "print g_A.a" "$vhn = 1"
267 gdb_test "print g_A.x" "$vhn = 2"
269 # Print all members of g_B using fully qualified form.
270 gdb_test "print g_B.A::a" "$vhn = 3"
271 gdb_test "print g_B.A::x" "$vhn = 4"
272 gdb_test "print g_B.B::b" "$vhn = 5"
273 gdb_test "print g_B.B::x" "$vhn = 6"
275 # Print members of g_B using nonambiguous compact form.
276 gdb_test "print g_B.a" "$vhn = 3"
277 gdb_test "print g_B.b" "$vhn = 5"
278 gdb_test "print g_B.x" "$vhn = 6"
280 # Print all members of g_C using fully qualified form.
281 gdb_test "print g_C.A::a" "$vhn = 7"
282 gdb_test "print g_C.A::x" "$vhn = 8"
283 gdb_test "print g_C.C::c" "$vhn = 9"
284 gdb_test "print g_C.C::x" "$vhn = 10"
286 # Print members of g_C using nonambiguous compact form.
287 gdb_test "print g_C.a" "$vhn = 7"
288 gdb_test "print g_C.c" "$vhn = 9"
289 gdb_test "print g_C.x" "$vhn = 10"
292 # Single inheritance, print complete classes.
294 proc test_print_si_classes { } {
297 # Print all members of g_A, g_B, g_C.
298 gdb_test "print g_A" "$vhn = \{a = 1, x = 2\}"
299 gdb_test "print g_B" "$vhn = \{<(class A|A)> = \{a = 3, x = 4\}, b = 5, x = 6\}"
300 gdb_test "print g_C" "$vhn = \{<(class A|A)> = \{a = 7, x = 8\}, c = 9, x = 10\}"
303 # Multiple inheritance, print individual members.
305 proc test_print_mi_members {} {
310 # Print all members of g_A.
311 gdb_test "print g_A.A::a" "$vhn = 1"
312 gdb_test "print g_A.A::x" "$vhn = 2"
314 # Print all members of g_B.
315 gdb_test "print g_B.A::a" "$vhn = 3"
316 gdb_test "print g_B.A::x" "$vhn = 4"
317 gdb_test "print g_B.B::b" "$vhn = 5"
318 gdb_test "print g_B.B::x" "$vhn = 6"
320 # Print all members of g_C.
321 gdb_test "print g_C.A::a" "$vhn = 7"
322 gdb_test "print g_C.A::x" "$vhn = 8"
323 gdb_test "print g_C.C::c" "$vhn = 9"
324 gdb_test "print g_C.C::x" "$vhn = 10"
326 # Print all members of g_D.
328 # g_D.A::a and g_D.A::x are ambiguous member accesses, and gdb
329 # should detect these. There are no ways to PASS these tests
330 # because I don't know what the gdb message will be. -- chastain
333 set name "print g_D.A::a"
334 gdb_test_multiple "print g_D.A::a" $name {
335 -re "$vhn = (15|11)$nl$gdb_prompt $" {
336 kfail "gdb/68" "print g_D.A::a"
340 set name "print g_D.A::x"
341 gdb_test_multiple "print g_D.A::x" $name {
342 -re "$vhn = (16|12)$nl$gdb_prompt $" {
343 kfail "gdb/68" "print g_D.A::x"
347 gdb_test "print g_D.B::b" "$vhn = 13"
348 gdb_test "print g_D.B::x" "$vhn = 14"
349 gdb_test "print g_D.C::c" "$vhn = 17"
350 gdb_test "print g_D.C::x" "$vhn = 18"
351 gdb_test "print g_D.D::d" "$vhn = 19"
352 gdb_test "print g_D.D::x" "$vhn = 20"
354 # Print all members of g_E.
355 # g_E.A::a and g_E.A::x are ambiguous.
357 set name "print g_E.A::a"
358 gdb_test_multiple "print g_E.A::a" $name {
359 -re "$vhn = (21|25)$nl$gdb_prompt $" {
360 kfail "gdb/68" "print g_E.A::a"
364 set name "print g_E.A::x"
365 gdb_test_multiple "print g_E.A::x" $name {
366 -re "$vhn = (26|22)$nl$gdb_prompt $" {
367 kfail "gdb/68" "print g_E.A::x"
371 gdb_test "print g_E.B::b" "$vhn = 23"
372 gdb_test "print g_E.B::x" "$vhn = 24"
373 gdb_test "print g_E.C::c" "$vhn = 27"
374 gdb_test "print g_E.C::x" "$vhn = 28"
375 gdb_test "print g_E.D::d" "$vhn = 29"
376 gdb_test "print g_E.D::x" "$vhn = 30"
377 gdb_test "print g_E.E::e" "$vhn = 31"
378 gdb_test "print g_E.E::x" "$vhn = 32"
381 # Multiple inheritance, print individual member types.
383 proc test_print_mi_member_types {} {
388 # Print the types of some members of g_D without qualifying them.
389 gdb_test "ptype g_D.b" "type = int"
390 gdb_test "ptype g_D.c" "type = int"
391 gdb_test "ptype g_D.d" "type = int"
393 # Print the types of qualified members; none of these tests pass today.
395 # Print all members of g_A.
396 gdb_test "ptype g_A.A::a" "type = int"
397 gdb_test "ptype g_A.A::x" "type = int"
399 # Print all members of g_B.
400 gdb_test "ptype g_B.A::a" "type = int"
401 gdb_test "ptype g_B.A::x" "type = int"
402 gdb_test "ptype g_B.B::b" "type = int"
403 gdb_test "ptype g_B.B::x" "type = int"
405 # Print all members of g_C.
406 gdb_test "ptype g_C.A::a" "type = int"
407 gdb_test "ptype g_C.A::x" "type = int"
408 gdb_test "ptype g_C.C::c" "type = int"
409 gdb_test "ptype g_C.C::x" "type = int"
411 # Print all members of g_D.
413 # g_D.A::a and g_D.A::x are ambiguous member accesses, and gdb
414 # should detect these. There are no ways to PASS these tests
415 # because I don't know what the gdb message will be. -- chastain
418 set name "ptype g_D.A::a"
419 gdb_test_multiple "ptype g_D.A::a" $name {
420 -re "type = int$nl$gdb_prompt $" {
421 kfail "gdb/68" "ptype g_D.A::a"
425 set name "ptype g_D.A::x"
426 gdb_test_multiple "ptype g_D.A::x" $name {
427 -re "type = int$nl$gdb_prompt $" {
428 kfail "gdb/68" "ptype g_D.A::x"
432 gdb_test "ptype g_D.B::b" "type = int"
433 gdb_test "ptype g_D.B::x" "type = int"
434 gdb_test "ptype g_D.C::c" "type = int"
435 gdb_test "ptype g_D.C::x" "type = int"
436 gdb_test "ptype g_D.D::d" "type = int"
437 gdb_test "ptype g_D.D::x" "type = int"
439 # Print all members of g_E.
440 # g_E.A::a and g_E.A::x are ambiguous.
442 set name "ptype g_E.A::a"
443 gdb_test_multiple "ptype g_E.A::a" $name {
444 -re "type = int$nl$gdb_prompt $" {
445 kfail "gdb/68" "ptype g_E.A::a"
449 set name "ptype g_E.A::x"
450 gdb_test_multiple "ptype g_E.A::x" $name {
451 -re "type = int$nl$gdb_prompt $" {
452 kfail "gdb/68" "ptype g_E.A::x"
456 gdb_test "ptype g_E.B::b" "type = int"
457 gdb_test "ptype g_E.B::x" "type = int"
458 gdb_test "ptype g_E.C::c" "type = int"
459 gdb_test "ptype g_E.C::x" "type = int"
460 gdb_test "ptype g_E.D::d" "type = int"
461 gdb_test "ptype g_E.D::x" "type = int"
462 gdb_test "ptype g_E.E::e" "type = int"
463 gdb_test "ptype g_E.E::x" "type = int"
466 # Multiple inheritance, print complete classes.
468 proc test_print_mi_classes { } {
471 # Print all members of g_D.
472 gdb_test "print g_D" "$vhn = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}"
474 # Print all members of g_E.
475 gdb_test "print g_E" "$vhn = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}"
478 # Single inheritance, print anonymous unions.
479 # GDB versions prior to 4.14 entered an infinite loop when printing
480 # the type of a class containing an anonymous union, and they were also
481 # incapable of printing the member of an anonymous union.
482 # We test the printing of the member first, and perform the other tests
483 # only if the test succeeds, to avoid the infinite loop.
485 # GDB HEAD 2004-01-27 with hp aCC A.03.45 crashes on the first test.
486 # -- chastain 2004-01-27
488 proc test_print_anon_union {} {
494 gdb_test "print g_anon_union.a" "$vhn = 2" "print anonymous union member"
496 set name "print variable of type anonymous union"
497 gdb_test_multiple "print g_anon_union" $name {
498 -re "$vhn = \{one = 1, \{a = 2, b = \[0-9\]+\}\}$nl$gdb_prompt $" {
503 set name "print type of anonymous union"
504 set re_tag "class_with_anon_union"
505 set re_class "(class $re_tag \{${ws}public:|struct $re_tag \{)"
506 set re_fields "int one;${ws}union \{${ws}int a;${ws}long( int)? b;${ws}\};"
507 gdb_test_multiple "ptype g_anon_union" $name {
508 -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
515 # Single virtual inheritance, print individual members.
517 proc test_print_svi_members { } {
520 # Print all members of g_vA.
521 gdb_test "print g_vA.vA::va" "$vhn = 1"
522 gdb_test "print g_vA.vA::vx" "$vhn = 2"
524 # Print members of g_vA using compact form.
525 gdb_test "print g_vA.va" "$vhn = 1"
526 gdb_test "print g_vA.vx" "$vhn = 2"
528 # Print all members of g_vB.
529 gdb_test "print g_vB.vA::va" "$vhn = 3"
530 gdb_test "print g_vB.vA::vx" "$vhn = 4"
531 gdb_test "print g_vB.vB::vb" "$vhn = 5"
532 gdb_test "print g_vB.vB::vx" "$vhn = 6"
534 # Print members of g_vB using compact form.
535 gdb_test "print g_vB.va" "$vhn = 3"
536 gdb_test "print g_vB.vb" "$vhn = 5"
537 gdb_test "print g_vB.vx" "$vhn = 6"
539 # Print all members of g_vC.
540 gdb_test "print g_vC.vA::va" "$vhn = 7"
541 gdb_test "print g_vC.vA::vx" "$vhn = 8"
542 gdb_test "print g_vC.vC::vc" "$vhn = 9"
543 gdb_test "print g_vC.vC::vx" "$vhn = 10"
545 # Print members of g_vC using compact form.
546 gdb_test "print g_vC.va" "$vhn = 7" "print g_vC.va"
547 gdb_test "print g_vC.vc" "$vhn = 9" "print g_vC.vc"
548 gdb_test "print g_vC.vx" "$vhn = 10" "print g_vC.vx"
551 # Single virtual inheritance, print complete classes.
553 proc test_print_svi_classes { } {
559 # Print all members of g_vA.
560 gdb_test "print g_vA" "$vhn = \{va = 1, vx = 2\}"
562 # Print all members of g_vB.
563 set re_vbptr_2 "(_vb.2vA|_vb.vA)"
564 set re_vbptr_3 "_vptr.vB"
566 set name "print g_vB"
567 gdb_test_multiple "print g_vB" $name {
568 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_2 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
569 # gcc 2.95.3 -gdwarf-2
570 # gcc 2.95.3 -gstabs+
573 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
574 # gcc 3.3.4 -gdwarf-2
575 # gcc 3.4.1 -gdwarf-2
577 # gcc HEAD 2004-07-31 -gdwarf-2
578 pass "$name (FIXME v3 vtbl ptr)"
580 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex <VTT for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" {
584 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex <typeinfo for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" {
585 # gcc HEAD 2004-07-31 -gstabs+
590 # Print all members of g_vC.
591 set re_vbptr_2 "(_vb.2vA|_vb.vA)"
592 set re_vbptr_3 "_vptr.vC"
594 set name "print g_vC"
595 gdb_test_multiple "print g_vC" $name {
596 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_2 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
597 # gcc 2.95.3 -gdwarf-2
598 # gcc 2.95.3 -gstabs+
601 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
602 # gcc 3.3.4 -gdwarf-2
603 # gcc 3.4.1 -gdwarf-2
605 # gcc HEAD 2004-07-31 -gdwarf-2
606 pass "$name (FIXME v3 vtbl ptr)"
608 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex <VTT for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" {
612 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex <typeinfo for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" {
613 # gcc HEAD 2004-07-31 -gstabs+
619 # Multiple virtual inheritance, print individual members.
621 proc test_print_mvi_members { } {
624 # Print all members of g_vD.
625 gdb_test "print g_vD.vA::va" "$vhn = 19"
626 gdb_test "print g_vD.vA::vx" "$vhn = 20"
627 gdb_test "print g_vD.vB::vb" "$vhn = 21"
628 gdb_test "print g_vD.vB::vx" "$vhn = 22"
629 gdb_test "print g_vD.vC::vc" "$vhn = 23"
630 gdb_test "print g_vD.vC::vx" "$vhn = 24"
631 gdb_test "print g_vD.vD::vd" "$vhn = 25"
632 gdb_test "print g_vD.vD::vx" "$vhn = 26"
634 # Print all members of g_vE.
635 gdb_test "print g_vE.vA::va" "$vhn = 0"
636 gdb_test "print g_vE.vA::vx" "$vhn = 0"
637 gdb_test "print g_vE.vB::vb" "$vhn = 0"
638 gdb_test "print g_vE.vB::vx" "$vhn = 0"
639 gdb_test "print g_vE.vC::vc" "$vhn = 0"
640 gdb_test "print g_vE.vC::vx" "$vhn = 0"
641 gdb_test "print g_vE.vD::vd" "$vhn = 0"
642 gdb_test "print g_vE.vD::vx" "$vhn = 0"
643 gdb_test "print g_vE.vE::ve" "$vhn = 27"
644 gdb_test "print g_vE.vE::vx" "$vhn = 28"
647 # Multiple virtual inheritance, print complete classes.
649 proc test_print_mvi_classes { } {
656 # Virtual base pointers for everybody.
658 set re_vbptr_2_vA "(_vb.2vA|_vb.vA)"
659 set re_vbptr_2_vB "(_vb.2vB|_vb.vB)"
660 set re_vbptr_2_vC "(_vb.2vC|_vb.vC)"
661 set re_vbptr_2_vD "(_vb.2vD|_vb.vD)"
662 set re_vbptr_3_vA "_vptr.vA"
663 set re_vbptr_3_vB "_vptr.vB"
664 set re_vbptr_3_vC "_vptr.vC"
665 set re_vbptr_3_vD "_vptr.vD"
666 set re_vbptr_3_vE "_vptr.vE"
668 # Print all members of g_vD.
670 set name "print g_vD"
671 gdb_test_multiple "print g_vD" $name {
672 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_2_vA = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 23, vx = 24\}, $re_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
673 # gcc 2.95.3 -gdwarf-2
674 # gcc 2.95.3 -gstabs+
677 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
678 # gcc 3.3.2 -gdwarf-2
679 # gcc HEAD 2004-01-21 -gdwarf-2
680 # gcc HEAD 2004-01-21 -gstabs+
681 pass "$name (FIXME v3 vtbl ptr)"
683 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
689 # Print all members of g_vE.
691 set name "print g_vE"
692 gdb_test_multiple "print g_vE" $name {
693 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_2_vA = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 0, vx = 0\}, $re_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 0, vx = 0\}, $re_vbptr_2_vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
694 # gcc 2.95.3 -gdwarf-2
695 # gcc 2.95.3 -gstabs+
698 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
699 # gcc 3.3.4 -gdwarf-2
701 # gcc 3.4.1 -gdwarf-2
703 # gcc HEAD 2004-07-31 -gdwarf-2
704 pass "$name (FIXME v3 vtbl ptr)"
706 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
707 # gcc 3.2.7-rh -gstabs+
710 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <typeinfo for vE>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
711 # gcc HEAD 2004-07-31 -gstabs+
724 # Start with a fresh gdb.
728 gdb_reinitialize_dir $srcdir/$subdir
731 gdb_test "set language c++" ""
732 gdb_test "set width 0" ""
734 if { ![runto_main] } then {
735 perror "couldn't run to main"
744 if { ![runto 'inheritance2'] } then {
745 perror "couldn't run to inheritance2"
749 test_print_si_members
750 test_print_si_classes
751 test_print_mi_members
752 test_print_mi_member_types
753 test_print_mi_classes
754 test_print_anon_union
756 if { ![runto 'inheritance4'] } {
757 perror "couldn't run to inheritance4"
761 test_print_svi_members
762 test_print_svi_classes
763 test_print_mvi_members
764 test_print_mvi_classes