1 # Copyright 1992-1999, 2001-2004, 2006-2012 Free Software Foundation,
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)
24 if { [skip_cplus_tests] } { continue }
26 load_lib "cp-support.exp"
28 set testfile "inherit"
30 set binfile ${objdir}/${subdir}/${testfile}
32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
37 # Single inheritance, print type definitions.
39 proc test_ptype_si { } {
47 "ptype A" "ptype A (FIXME)" "class" "A" \
49 { field public "int a;" }
50 { field public "int x;" }
52 cp_test_ptype_class "ptype class A" "ptype class A (FIXME)" "class" "A" ibid
53 cp_test_ptype_class "ptype g_A" "ptype g_A (FIXME)" "class" "A" ibid
58 "ptype B" "" "class" "B" \
61 { field public "int b;" }
62 { field public "int x;" }
64 cp_test_ptype_class "ptype class B" "" "class" "B" ibid
65 cp_test_ptype_class "ptype g_B" "" "class" "B" ibid
67 # Another derived class.
70 "ptype C" "" "class" "C" \
73 { field public "int c;" }
74 { field public "int x;" }
76 cp_test_ptype_class "ptype class C" "" "class" "C" ibid
77 cp_test_ptype_class "ptype g_C" "" "class" "C" ibid
79 # A structure with no tag.
80 # TODO: move this mess into a separate file, and re-specify
81 # which results are PASS, KFAIL, XFAIL, and FAIL.
83 set re_tag "tagless_struct"
85 set re_class "(class $re_tag \{${ws}public:|class \{${ws}public:|struct $re_tag \{|struct \{)"
86 set XX_class "(class $XX_tag \{${ws}public:|struct $XX_tag \{)"
87 set re_fields "int one;${ws}int two;"
88 set re_synth_gcc_23 "$re_tag & operator=\\($re_tag const ?&\\);${ws}$re_tag\\($re_tag const ?&\\);${ws}$re_tag\\((void|)\\);"
89 set XX_synth_gcc_23 "($re_tag|$XX_tag) & operator=\\($XX_tag const ?&\\);${ws}$XX_tag\\($XX_tag const ?&\\);${ws}$XX_tag\\((void|)\\);"
91 set name "ptype tagless struct"
92 gdb_test_multiple "ptype tagless_struct" $name {
93 -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
94 # gcc 2.95.3 -gdwarf-2
97 -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" {
101 -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
102 # gcc 3.3.4 -gdwarf-2
103 # gcc 3.4.1 -gdwarf-2
104 # gcc HEAD 2004-07-31 -gdwarf-2
105 # gcc HEAD 2004-07-31 -gstabs+
108 -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
113 -re "No symbol \"tagless_struct\" in current context.$nl$gdb_prompt $" {
114 # Several GCC 4.x versions provide neither a DW_TAG_typedef DIE
115 # nor use the typedef name as struct tag name.
120 set name "ptype variable of type tagless struct"
121 gdb_test_multiple "ptype v_tagless" $name {
122 -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
123 # gcc 2.95.3 -gdwarf-2
126 -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" {
127 # gcc 2.95.3 -gstabs+
130 -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
131 # gcc 3.3.4 -gdwarf-2
132 # gcc 3.4.1 -gdwarf-2
133 # gcc HEAD 2004-07-31 -gdwarf-2
134 # gcc HEAD 2004-07-31 -gstabs+
137 -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
145 # Multiple inheritance, print type definitions.
147 proc test_ptype_mi { } {
149 # A class with two bases.
151 cp_test_ptype_class \
152 "ptype D" "" "class" "D" \
156 { field public "int d;" }
157 { field public "int x;" }
159 cp_test_ptype_class "ptype class D" "" "class" "D" ibid
160 cp_test_ptype_class "ptype g_D" "" "class" "D" ibid
162 # A class derived from the previous class.
164 cp_test_ptype_class \
165 "ptype E" "" "class" "E" \
168 { field public "int e;" }
169 { field public "int x;" }
171 cp_test_ptype_class "ptype class E" "" "class" "E" ibid
172 cp_test_ptype_class "ptype g_E" "" "class" "E" ibid
175 # Single virtual inheritance, print type definitions.
177 proc test_ptype_vi { } {
181 cp_test_ptype_class \
182 "ptype vA" "" "class" "vA" \
184 { field public "int va;" }
185 { field public "int vx;" }
187 cp_test_ptype_class "ptype class vA" "" "class" "vA" ibid
188 cp_test_ptype_class "ptype g_vA" "" "class" "vA" ibid
192 cp_test_ptype_class \
193 "ptype vB" "" "class" "vB" \
195 { base "public virtual vA" }
197 { field public "int vb;" }
198 { field public "int vx;" }
200 cp_test_ptype_class "ptype class vB" "" "class" "vB" ibid
201 cp_test_ptype_class "ptype g_vB" "" "class" "vB" ibid
205 cp_test_ptype_class \
206 "ptype vC" "" "class" "vC" \
208 { base "public virtual vA" }
210 { field public "int vc;" }
211 { field public "int vx;" }
213 cp_test_ptype_class "ptype class vC" "" "class" "vC" ibid
214 cp_test_ptype_class "ptype g_vC" "" "class" "vC" ibid
218 # Multiple virtual inheritance, print type definitions.
220 proc test_ptype_mvi { } {
224 cp_test_ptype_class \
225 "ptype vD" "" "class" "vD" \
227 { base "public virtual vB" }
228 { base "public virtual vC" }
231 { field public "int vd;" }
232 { field public "int vx;" }
234 cp_test_ptype_class "ptype class vD" "" "class" "vD" ibid
235 cp_test_ptype_class "ptype g_vD" "" "class" "vD" ibid
239 cp_test_ptype_class \
240 "ptype vE" "" "class" "vE" \
242 { base "public virtual vD" }
244 { field public "int ve;" }
245 { field public "int vx;" }
247 cp_test_ptype_class "ptype class vE" "" "class" "vE" ibid
248 cp_test_ptype_class "ptype g_vE" "" "class" "vE" ibid
252 # Single inheritance, print individual members.
254 proc test_print_si_members { } {
257 # Print all members of g_A using fully qualified form.
258 gdb_test "print g_A.A::a" "$vhn = 1"
259 gdb_test "print g_A.A::x" "$vhn = 2"
261 # Print members of g_A using nonambiguous compact form.
262 gdb_test "print g_A.a" "$vhn = 1"
263 gdb_test "print g_A.x" "$vhn = 2"
265 # Print all members of g_B using fully qualified form.
266 gdb_test "print g_B.A::a" "$vhn = 3"
267 gdb_test "print g_B.A::x" "$vhn = 4"
268 gdb_test "print g_B.B::b" "$vhn = 5"
269 gdb_test "print g_B.B::x" "$vhn = 6"
271 # Print members of g_B using nonambiguous compact form.
272 gdb_test "print g_B.a" "$vhn = 3"
273 gdb_test "print g_B.b" "$vhn = 5"
274 gdb_test "print g_B.x" "$vhn = 6"
276 # Print all members of g_C using fully qualified form.
277 gdb_test "print g_C.A::a" "$vhn = 7"
278 gdb_test "print g_C.A::x" "$vhn = 8"
279 gdb_test "print g_C.C::c" "$vhn = 9"
280 gdb_test "print g_C.C::x" "$vhn = 10"
282 # Print members of g_C using nonambiguous compact form.
283 gdb_test "print g_C.a" "$vhn = 7"
284 gdb_test "print g_C.c" "$vhn = 9"
285 gdb_test "print g_C.x" "$vhn = 10"
288 # Single inheritance, print complete classes.
290 proc test_print_si_classes { } {
293 # Print all members of g_A, g_B, g_C.
294 gdb_test "print g_A" "$vhn = \{a = 1, x = 2\}"
295 gdb_test "print g_B" "$vhn = \{<(class A|A)> = \{a = 3, x = 4\}, b = 5, x = 6\}"
296 gdb_test "print g_C" "$vhn = \{<(class A|A)> = \{a = 7, x = 8\}, c = 9, x = 10\}"
299 # Multiple inheritance, print individual members.
301 proc test_print_mi_members {} {
306 # Print all members of g_A.
307 gdb_test "print g_A.A::a" "$vhn = 1"
308 gdb_test "print g_A.A::x" "$vhn = 2"
310 # Print all members of g_B.
311 gdb_test "print g_B.A::a" "$vhn = 3"
312 gdb_test "print g_B.A::x" "$vhn = 4"
313 gdb_test "print g_B.B::b" "$vhn = 5"
314 gdb_test "print g_B.B::x" "$vhn = 6"
316 # Print all members of g_C.
317 gdb_test "print g_C.A::a" "$vhn = 7"
318 gdb_test "print g_C.A::x" "$vhn = 8"
319 gdb_test "print g_C.C::c" "$vhn = 9"
320 gdb_test "print g_C.C::x" "$vhn = 10"
322 # Print all members of g_D.
324 # g_D.A::a and g_D.A::x are ambiguous member accesses.
325 gdb_test "print g_D.A::a" "base class 'A' is ambiguous in type 'D'"
326 gdb_test "print g_D.C::a" "$vhn = 15"
327 gdb_test "print g_D.B::a" "$vhn = 11"
328 gdb_test "print g_D.A::x" "base class 'A' is ambiguous in type 'D'"
329 gdb_test "print g_D.B::b" "$vhn = 13"
330 gdb_test "print g_D.B::x" "$vhn = 14"
331 gdb_test "print g_D.C::c" "$vhn = 17"
332 gdb_test "print g_D.C::x" "$vhn = 18"
333 gdb_test "print g_D.D::d" "$vhn = 19"
334 gdb_test "print g_D.D::x" "$vhn = 20"
336 # Print all members of g_E.
337 # g_E.A::a and g_E.A::x are ambiguous.
339 gdb_test "print g_E.A::a" "base class 'A' is ambiguous in type 'E'"
340 gdb_test "print g_E.A::x" "base class 'A' is ambiguous in type 'E'"
341 gdb_test "print g_E.B::b" "$vhn = 23"
342 gdb_test "print g_E.B::x" "$vhn = 24"
343 gdb_test "print g_E.C::c" "$vhn = 27"
344 gdb_test "print g_E.C::x" "$vhn = 28"
345 gdb_test "print g_E.D::d" "$vhn = 29"
346 gdb_test "print g_E.D::x" "$vhn = 30"
347 gdb_test "print g_E.E::e" "$vhn = 31"
348 gdb_test "print g_E.E::x" "$vhn = 32"
351 # Multiple inheritance, print individual member types.
353 proc test_print_mi_member_types {} {
358 # Print the types of some members of g_D without qualifying them.
359 gdb_test "ptype g_D.b" "type = int"
360 gdb_test "ptype g_D.c" "type = int"
361 gdb_test "ptype g_D.d" "type = int"
363 # Print the types of qualified members; none of these tests pass today.
365 # Print all members of g_A.
366 gdb_test "ptype g_A.A::a" "type = int"
367 gdb_test "ptype g_A.A::x" "type = int"
369 # Print all members of g_B.
370 gdb_test "ptype g_B.A::a" "type = int"
371 gdb_test "ptype g_B.A::x" "type = int"
372 gdb_test "ptype g_B.B::b" "type = int"
373 gdb_test "ptype g_B.B::x" "type = int"
375 # Print all members of g_C.
376 gdb_test "ptype g_C.A::a" "type = int"
377 gdb_test "ptype g_C.A::x" "type = int"
378 gdb_test "ptype g_C.C::c" "type = int"
379 gdb_test "ptype g_C.C::x" "type = int"
381 # Print all members of g_D.
383 # g_D.A::a and g_D.A::x are ambiguous member accesses.
385 gdb_test "ptype g_D.A::a" "base class 'A' is ambiguous in type 'D'"
386 gdb_test "ptype g_D.A::x" "base class 'A' is ambiguous in type 'D'"
387 gdb_test "ptype g_D.B::b" "type = int"
388 gdb_test "ptype g_D.B::x" "type = int"
389 gdb_test "ptype g_D.C::c" "type = int"
390 gdb_test "ptype g_D.C::x" "type = int"
391 gdb_test "ptype g_D.D::d" "type = int"
392 gdb_test "ptype g_D.D::x" "type = int"
394 # Print all members of g_E.
395 # g_E.A::a and g_E.A::x are ambiguous.
397 gdb_test "ptype g_E.A::a" "base class 'A' is ambiguous in type 'E'"
398 gdb_test "ptype g_E.A::x" "base class 'A' is ambiguous in type 'E'"
399 gdb_test "ptype g_E.B::b" "type = int"
400 gdb_test "ptype g_E.B::x" "type = int"
401 gdb_test "ptype g_E.C::c" "type = int"
402 gdb_test "ptype g_E.C::x" "type = int"
403 gdb_test "ptype g_E.D::d" "type = int"
404 gdb_test "ptype g_E.D::x" "type = int"
405 gdb_test "ptype g_E.E::e" "type = int"
406 gdb_test "ptype g_E.E::x" "type = int"
409 # Multiple inheritance, print complete classes.
411 proc test_print_mi_classes { } {
414 # Print all members of g_D.
415 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\}"
417 # Print all members of g_E.
418 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\}"
421 # Single inheritance, print anonymous unions.
422 # GDB versions prior to 4.14 entered an infinite loop when printing
423 # the type of a class containing an anonymous union, and they were also
424 # incapable of printing the member of an anonymous union.
425 # We test the printing of the member first, and perform the other tests
426 # only if the test succeeds, to avoid the infinite loop.
428 # GDB HEAD 2004-01-27 with hp aCC A.03.45 crashes on the first test.
429 # -- chastain 2004-01-27
431 proc test_print_anon_union {} {
437 gdb_test "print g_anon_union.a" "$vhn = 2" "print anonymous union member"
439 set name "print variable of type anonymous union"
440 gdb_test_multiple "print g_anon_union" $name {
441 -re "$vhn = \{one = 1, \{a = 2, b = \[0-9\]+\}\}$nl$gdb_prompt $" {
446 set name "print type of anonymous union"
447 set re_tag "class_with_anon_union"
448 set re_class "(class $re_tag \{${ws}public:|struct $re_tag \{)"
449 set re_fields "int one;${ws}union \{${ws}int a;${ws}long( int)? b;${ws}\};"
450 gdb_test_multiple "ptype g_anon_union" $name {
451 -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" {
458 # Single virtual inheritance, print individual members.
460 proc test_print_svi_members { } {
463 # Print all members of g_vA.
464 gdb_test "print g_vA.vA::va" "$vhn = 1"
465 gdb_test "print g_vA.vA::vx" "$vhn = 2"
467 # Print members of g_vA using compact form.
468 gdb_test "print g_vA.va" "$vhn = 1"
469 gdb_test "print g_vA.vx" "$vhn = 2"
471 # Print all members of g_vB.
472 gdb_test "print g_vB.vA::va" "$vhn = 3"
473 gdb_test "print g_vB.vA::vx" "$vhn = 4"
474 gdb_test "print g_vB.vB::vb" "$vhn = 5"
475 gdb_test "print g_vB.vB::vx" "$vhn = 6"
477 # Print members of g_vB using compact form.
478 gdb_test "print g_vB.va" "$vhn = 3"
479 gdb_test "print g_vB.vb" "$vhn = 5"
480 gdb_test "print g_vB.vx" "$vhn = 6"
482 # Print all members of g_vC.
483 gdb_test "print g_vC.vA::va" "$vhn = 7"
484 gdb_test "print g_vC.vA::vx" "$vhn = 8"
485 gdb_test "print g_vC.vC::vc" "$vhn = 9"
486 gdb_test "print g_vC.vC::vx" "$vhn = 10"
488 # Print members of g_vC using compact form.
489 gdb_test "print g_vC.va" "$vhn = 7" "print g_vC.va"
490 gdb_test "print g_vC.vc" "$vhn = 9" "print g_vC.vc"
491 gdb_test "print g_vC.vx" "$vhn = 10" "print g_vC.vx"
494 # Single virtual inheritance, print complete classes.
496 proc test_print_svi_classes { } {
502 # Print all members of g_vA.
503 gdb_test "print g_vA" "$vhn = \{va = 1, vx = 2\}"
505 # Print all members of g_vB.
506 set re_vbptr_2 "(_vb.2vA|_vb.vA)"
507 set re_vbptr_3 "_vptr.vB"
509 set name "print g_vB"
510 gdb_test_multiple "print g_vB" $name {
511 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_2 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
512 # gcc 2.95.3 -gdwarf-2
513 # gcc 2.95.3 -gstabs+
516 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
517 # gcc 3.3.4 -gdwarf-2
518 # gcc 3.4.1 -gdwarf-2
520 # gcc HEAD 2004-07-31 -gdwarf-2
521 pass "$name (FIXME v3 vtbl ptr)"
523 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex <VTT for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" {
527 -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex <typeinfo for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" {
528 # gcc HEAD 2004-07-31 -gstabs+
533 # Print all members of g_vC.
534 set re_vbptr_2 "(_vb.2vA|_vb.vA)"
535 set re_vbptr_3 "_vptr.vC"
537 set name "print g_vC"
538 gdb_test_multiple "print g_vC" $name {
539 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_2 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
540 # gcc 2.95.3 -gdwarf-2
541 # gcc 2.95.3 -gstabs+
544 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
545 # gcc 3.3.4 -gdwarf-2
546 # gcc 3.4.1 -gdwarf-2
548 # gcc HEAD 2004-07-31 -gdwarf-2
549 pass "$name (FIXME v3 vtbl ptr)"
551 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex <VTT for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" {
555 -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex <typeinfo for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" {
556 # gcc HEAD 2004-07-31 -gstabs+
562 # Multiple virtual inheritance, print individual members.
564 proc test_print_mvi_members { } {
567 # Print all members of g_vD.
568 gdb_test "print g_vD.vA::va" "$vhn = 19"
569 gdb_test "print g_vD.vA::vx" "$vhn = 20"
570 gdb_test "print g_vD.vB::vb" "$vhn = 21"
571 gdb_test "print g_vD.vB::vx" "$vhn = 22"
572 gdb_test "print g_vD.vC::vc" "$vhn = 23"
573 gdb_test "print g_vD.vC::vx" "$vhn = 24"
574 gdb_test "print g_vD.vD::vd" "$vhn = 25"
575 gdb_test "print g_vD.vD::vx" "$vhn = 26"
577 # Print all members of g_vE.
578 gdb_test "print g_vE.vA::va" "$vhn = 0"
579 gdb_test "print g_vE.vA::vx" "$vhn = 0"
580 gdb_test "print g_vE.vB::vb" "$vhn = 0"
581 gdb_test "print g_vE.vB::vx" "$vhn = 0"
582 gdb_test "print g_vE.vC::vc" "$vhn = 0"
583 gdb_test "print g_vE.vC::vx" "$vhn = 0"
584 gdb_test "print g_vE.vD::vd" "$vhn = 0"
585 gdb_test "print g_vE.vD::vx" "$vhn = 0"
586 gdb_test "print g_vE.vE::ve" "$vhn = 27"
587 gdb_test "print g_vE.vE::vx" "$vhn = 28"
590 # Multiple virtual inheritance, print complete classes.
592 proc test_print_mvi_classes { } {
599 # Virtual base pointers for everybody.
601 set re_vbptr_2_vA "(_vb.2vA|_vb.vA)"
602 set re_vbptr_2_vB "(_vb.2vB|_vb.vB)"
603 set re_vbptr_2_vC "(_vb.2vC|_vb.vC)"
604 set re_vbptr_2_vD "(_vb.2vD|_vb.vD)"
605 set re_vbptr_3_vA "_vptr.vA"
606 set re_vbptr_3_vB "_vptr.vB"
607 set re_vbptr_3_vC "_vptr.vC"
608 set re_vbptr_3_vD "_vptr.vD"
609 set re_vbptr_3_vE "_vptr.vE"
611 # Print all members of g_vD.
613 set name "print g_vD"
614 gdb_test_multiple "print g_vD" $name {
615 -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 $" {
616 # gcc 2.95.3 -gdwarf-2
617 # gcc 2.95.3 -gstabs+
620 -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = ${hex}( <vtable for vD.*>)?, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = ${hex}( <vtable for vC.*>)?, vc = 23, vx = 24\}, $re_vbptr_3_vD = ${hex}( <vtable for vD.*>)?, vd = 25, vx = 26\}$nl$gdb_prompt $" {
621 # gcc 3.3.2 -gdwarf-2
622 # gcc HEAD 2004-01-21 -gdwarf-2
623 # gcc HEAD 2004-01-21 -gstabs+
624 pass "$name (FIXME v3 vtbl ptr)"
626 -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 $" {
632 # Print all members of g_vE.
634 set name "print g_vE"
635 gdb_test_multiple "print g_vE" $name {
636 -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 $" {
637 # gcc 2.95.3 -gdwarf-2
638 # gcc 2.95.3 -gstabs+
641 -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = ${hex}( <vtable for vE.*>)?, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = ${hex}( <vtable for vE.*>)?, vc = 0, vx = 0\}, $re_vbptr_3_vD = ${hex}( <vtable for vE.*>)?, vd = 0, vx = 0\}, $re_vbptr_3_vE = ${hex}( <vtable for vE.*>)?, ve = 27, vx = 28\}$nl$gdb_prompt $" {
642 # gcc 3.3.4 -gdwarf-2
644 # gcc 3.4.1 -gdwarf-2
646 # gcc HEAD 2004-07-31 -gdwarf-2
647 pass "$name (FIXME v3 vtbl ptr)"
649 -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 $" {
650 # gcc 3.2.7-rh -gstabs+
653 -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 $" {
654 # gcc HEAD 2004-07-31 -gstabs+
667 # Start with a fresh gdb.
671 gdb_reinitialize_dir $srcdir/$subdir
674 gdb_test_no_output "set width 0"
676 if { ![runto_main] } then {
677 perror "couldn't run to main"
681 gdb_test_no_output "set language c++"
687 if { ![runto 'inheritance2'] } then {
688 perror "couldn't run to inheritance2"
692 test_print_si_members
693 test_print_si_classes
694 test_print_mi_members
695 test_print_mi_member_types
696 test_print_mi_classes
697 test_print_anon_union
699 if { ![runto 'inheritance4'] } {
700 perror "couldn't run to inheritance4"
704 test_print_svi_members
705 test_print_svi_classes
706 test_print_mvi_members
707 test_print_mvi_classes