summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/inherit.exp
blob: 993bfb159cb1510f3577fd23ea96d56407501fe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003
# Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu

# This file was written by Fred Fish. (fnf@cygnus.com)

set ws "\[\r\n\t \]+"
set nl "\[\r\n\]+"

# The format of a g++ virtual base pointer.
set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"

if $tracelevel then {
	strace $tracelevel
}

if { [skip_cplus_tests] } { continue }

# Note - create separate "inherit" executable from misc.cc

set testfile "inherit"
set srcfile misc.cc
set binfile ${objdir}/${subdir}/${testfile}


# Create and source the file that provides information about the compiler
# used to compile the test case.

if [get_compiler_info ${binfile} "c++"] {
    return -1
}

if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}

#
# Single inheritance, print individual members.
#

proc test_print_si_members {} {
    # Print all members of g_A using fully qualified form.

    gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"

    gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"

    # Print members of g_A using nonambiguous compact form.

    gdb_test "print g_A.a" ".* = 1" "print g_A.a"

    gdb_test "print g_A.x" ".* = 2" "print g_A.x"

    # Print all members of g_B using fully qualified form.

    gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"

    gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"

    gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"

    gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"

    # Print members of g_B using nonambiguous compact form.

    gdb_test "print g_B.a" ".* = 3" "print g_B.a"

    gdb_test "print g_B.b" ".* = 5" "print g_B.b"

    gdb_test "print g_B.x" ".* = 6" "print g_B.x"

    # Print all members of g_C using fully qualified form.

    gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"

    gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"

    gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"

    gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"

    # Print members of g_C using nonambiguous compact form.

    gdb_test "print g_C.a" ".* = 7" "print g_C.a"

    gdb_test "print g_C.c" ".* = 9" "print g_C.c"

    gdb_test "print g_C.x" ".* = 10" "print g_C.x"
}

#
# Single inheritance, print type definitions.
#

proc test_ptype_si {} {
    global gdb_prompt
    global ws
    global nl
    global hp_aCC_compiler

    # Print class A as a type.

    send_gdb "ptype A\n"
    gdb_expect {
	-re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
	    pass "ptype A (FIXME)"
	}
	-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
	    setup_xfail "*-*-*"
	    fail "ptype A (FIXME)"
	}
	-re ".*$gdb_prompt $" { fail "ptype A" }
	timeout { fail "ptype A (timeout)" ; return }
    }

    # Print class A as an explicit class.

    send_gdb "ptype class A\n"
    gdb_expect {
	-re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
	    pass "ptype class A (FIXME)"
	}
	-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
            if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
	    fail "ptype class A (FIXME)"
	}
	-re ".*$gdb_prompt $" { fail "ptype class A" }
	timeout { fail "ptype class A (timeout)" ; return }
    }

    # Print type of an object of type A.

    send_gdb "ptype g_A\n"
    gdb_expect {
	-re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
	    pass "ptype g_A (FIXME)"
	}
	-re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
            if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
	    fail "ptype g_A (FIXME)"
	}
	-re ".*$gdb_prompt $" { fail "ptype g_A" }
	timeout { fail "ptype g_A (timeout)" ; return }
    }

    # Print class B as a type.

    gdb_test "ptype B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype B"

    # Print class B as an explicit class.

    gdb_test "ptype class B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype class B"

    # Print type of an object of type B.

    gdb_test "ptype g_B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype g_B"

    # Print class C as a type.

    gdb_test "ptype C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype C"

    # Print class C as an explicit class.

    gdb_test "ptype class C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype class C"

    # Print type of an object of type g_C.

    gdb_test "ptype g_C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype g_C"

    # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of
    # cygnus-2.3.3-930417.  PR 2819.
    send_gdb "ptype tagless_struct\n"
    gdb_expect {
	-re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype tagless struct"
	}
	-re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" {
	    pass "ptype tagless struct"
	}
	-re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {
	    pass "ptype tagless struct (obsolete gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype tagless struct"
	}
	timeout {
	    fail "ptype tagless struct (timeout)"
	}
    }

    send_gdb "ptype v_tagless\n"
    gdb_expect {
	-re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype variable of type tagless struct"
	}
	-re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" {
	    pass "ptype tagless struct"
	}
	-re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {
	    pass "ptype variable of type tagless struct (obsolete gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype variable of type tagless struct"
	}
	timeout {
	    fail "ptype variable of type tagless struct (timeout)"
	}
    }
}

#
# Single inheritance, print complete classes.
#

proc test_print_si_classes {} {
    # Print all members of g_A.

    gdb_test "print g_A" ".* = \{a = 1, x = 2\}" "print g_A"

    # Print all members of g_B.

    gdb_test "print g_B" ".* = \{\<(class |)A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B"

    # Print all members of g_C.

    gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C"
}

#
# Single inheritance, print anonymous unions.
# GDB versions prior to 4.14 entered an infinite loop when printing
# the type of a class containing an anonymous union, and they were also
# incapable of printing the member of an anonymous union.
# We test the printing of the member first, and perform the other tests
# only if the test succeeds, to avoid the infinite loop.
#

proc test_print_anon_union {} {
    global gdb_prompt
    global ws
    global nl

    gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member"
    send_gdb "print g_anon_union\n"
    gdb_expect {
	-re ".* = \{one = 1, ( = |)\{a = 2, b = 2\}\}$nl$gdb_prompt $" {
	    pass "print variable of type anonymous union"
	}
	-re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" {
	    pass "print variable of type anonymous union (obsolete gcc or gdb)"
	}
	-re ".*$nl$gdb_prompt $" {
	    fail "print variable of type anonymous union"
	}
	timeout {
	    fail "print variableof type anonymous union (timeout)"
	}
    }
    send_gdb "ptype g_anon_union\n"
    gdb_expect {
	-re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "print type of anonymous union"
	}
	-re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}int a;${ws}long int b;${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
	    pass "print type of anonymous union"
	}
	-re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}int a;${ws}long int b;${ws}\};${ws}\}$nl$gdb_prompt $" {
	    pass "print type of anonymous union"
	}
	-re "type = (struct|class).*\{.*int one;.*union \{.*int a;.*(long|long int|int) b;.*\};.*\}$nl$gdb_prompt $" {
	    pass "print type of anonymous union (obsolete gcc or gdb)"
	}
	-re ".*$nl$gdb_prompt $" {
	    fail "print type of anonymous union"
	}
	timeout {
	    fail "print type of anonymous union (timeout)"
	}
    }
}

#
# Multiple inheritance, print individual members.
#

proc test_print_mi_members {} {
    global gdb_prompt
    global nl
    global hp_aCC_compiler

    # Print all members of g_A.

    gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"
    
    gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"

    # Print all members of g_B.

    gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"

    gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"

    gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"

    gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"

    # Print all members of g_C.

    gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"

    gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"

    gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"

    gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"

    # Print all members of g_D.

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    send_gdb "print g_D.A::a\n"
    gdb_expect {	
	-re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 15$nl$gdb_prompt $" {
	    pass "print g_D.A::a"
	}
	-re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 11$nl$gdb_prompt $" {
	    pass "print g_D.A::a (using B)"
	}
	-re ".* = 15$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_D.A::a"
	}
	-re ".* = 11$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_D.A::a"
	}
	-re ".*$gdb_prompt $" { fail "print g_D.A::a" }
	timeout { fail "print g_D.A::a (timeout)" ; return }
    }

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    send_gdb "print g_D.A::x\n"
    gdb_expect {
	-re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 16$nl$gdb_prompt $" {
	    pass "print g_D.A::x"
	}
	-re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 12$nl$gdb_prompt $" {
	    pass "print g_D.A::x (using B)"
	}
	-re ".* = 16$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_D.A::x"
	}
	-re ".* = 12$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_D.A::x"
	}
	-re ".*$gdb_prompt $" { fail "print g_D.A::x" }
	timeout { fail "print g_D.A::x (timeout)" ; return }
    }

    gdb_test "print g_D.B::b" ".* = 13" "print g_D.B::b"

    gdb_test "print g_D.B::x" ".* = 14" "print g_D.B::x"

    gdb_test "print g_D.C::c" ".* = 17" "print g_D.C::c"

    gdb_test "print g_D.C::x" ".* = 18" "print g_D.C::x"

    gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d"

    gdb_test "print g_D.D::x" ".* = 20" "print g_D.D::x"

    # Print all members of g_E.

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    send_gdb "print g_E.A::a\n"
    gdb_expect {
	-re ".* = 21$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_E.A::a"
	}
	-re ".* = 25$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_E.A::a"
	}
	-re ".*$gdb_prompt $" { fail "print g_E.A::a" }
	timeout { fail "print g_E.A::a (timeout)" ; return }
    }

    # The following is ambiguous, and gdb should detect this.
    # For now, accept gdb's behavior as an expected failure if it
    # simply prints either member correctly.

    send_gdb "print g_E.A::x\n"
    gdb_expect {
	-re "warning: A ambiguous; using E::D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 26$nl$gdb_prompt $" {
	    pass "print g_E.A::x"
	}
	-re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 22$nl$gdb_prompt $" {
	    pass "print g_E.A::x (using B)"
	}
	-re ".* = 26$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_E.A::x"
	}
	-re ".* = 22$nl$gdb_prompt $" {
	    kfail "gdb/68" "print g_E.A::x"
	}
	-re ".*$gdb_prompt $" { fail "print g_E.A::x" }
	timeout { fail "print g_E.A::x (timeout)" ; return }
    }

    gdb_test "print g_E.B::b" ".* = 23" "print g_E.B::b"

    gdb_test "print g_E.B::x" ".* = 24" "print g_E.B::x"

    gdb_test "print g_E.C::c" ".* = 27" "print g_E.C::c"

    gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x"

    gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d"

    gdb_test "print g_E.D::x" ".* = 30" "print g_E.D::x"

    gdb_test "print g_E.E::e" ".* = 31" "print g_E.E::e"

    gdb_test "print g_E.E::x" ".* = 32" "print g_E.E::x"
}

#
# Multiple inheritance, print type definitions.
#

proc test_ptype_mi {} {
    global nl

    gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D"

    gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D"

    gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D"

    gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E"

    gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E"

    gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E"
}

#
# Multiple inheritance, print complete classes.
#

proc test_print_mi_classes {} {
    # Print all members of g_D.

    gdb_test "print g_D" ".* = \{\<(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\}" "print g_D"

    # Print all members of g_E.

    gdb_test "print g_E" ".* = \{\<(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\}" "print g_E"
}

#
# Single virtual inheritance, print individual members.
#

proc test_print_svi_members {} {
    global gdb_prompt
    global decimal
    global nl

    # Print all members of g_vA.

    gdb_test "print g_vA.vA::va" ".* = 1" "print g_vA.vA::va"

    gdb_test "print g_vA.vA::vx" ".* = 2" "print g_vA.vA::vx"

    # Print members of g_vA using compact form.

    gdb_test "print g_vA.va" ".* = 1" "print g_vA.va"

    gdb_test "print g_vA.vx" ".* = 2" "print g_vA.vx"

    # Print all members of g_vB.

    send_gdb "print g_vB.vA::va\n"
    gdb_expect {
	-re ".* = 3$nl$gdb_prompt $" { pass "print g_vB.vA::va" }
	-re ".*virtual baseclass botch.*$gdb_prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vB.vA::va (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$gdb_prompt $" { fail "print g_vB.vA::va" }
	timeout { fail "print g_vB.vA::va (timeout)" ; return }
    }

    gdb_test "print g_vB.vA::vx" ".* = 4" "print g_vB.vA::vx"

    gdb_test "print g_vB.vB::vb" ".* = 5" "print g_vB.vB::vb"

    gdb_test "print g_vB.vB::vx" ".* = 6" "print g_vB.vB::vx"

    # Print members of g_vB using compact form.

    gdb_test "print g_vB.va" ".* = 3" "print g_vB.va"

    gdb_test "print g_vB.vb" ".* = 5" "print g_vB.vb"

    gdb_test "print g_vB.vx" ".* = 6" "print g_vB.vx"

    # Print all members of g_vC.

    gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va"

    gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx"

    gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc"

    gdb_test "print g_vC.vC::vx" ".* = 10" "print g_vC.vC::vx"

    # Print members of g_vC using compact form.

    gdb_test "print g_vC.va" ".* = 7" "print g_vC.va"

    gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc"

    gdb_test "print g_vC.vx" ".* = 10" "print g_vC.vx"
}

#
# Single virtual inheritance, print type definitions.
#

proc test_ptype_vi {} {
    global gdb_prompt
    global ws
    global nl
    global vbptr

    # This class does not use any C++-specific features, so it's fine for
    # it to print as "struct".
    send_gdb "ptype vA\n"
    gdb_expect {
	-re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype vA"
	}
	-re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
	    pass "ptype vA"
	}
	-re ".*$gdb_prompt $" { fail "ptype vA" }
	timeout { fail "ptype vA (timeout)" ; return }
    }

    # This class does not use any C++-specific features, so it's fine for
    # it to print as "struct".
    send_gdb "ptype class vA\n"
    gdb_expect {
	-re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype class vA"
	}
	-re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
	    pass "ptype class vA"
	}
	-re ".*$gdb_prompt $" { fail "ptype class vA" }
	timeout { fail "ptype class vA (timeout)" ; return }
    }

    # This class does not use any C++-specific features, so it's fine for
    # it to print as "struct".
    send_gdb "ptype g_vA\n"
    gdb_expect {
	-re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype g_vA"
	}
	-re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
	    pass "ptype g_vA"
	}
	-re ".*$gdb_prompt $" { fail "ptype g_vA" }
	timeout { fail "ptype g_vA (timeout)" ; return }
    }

    send_gdb "ptype vB\n"
    gdb_expect {
	-re "ptype vB${nl}type = class vB : public virtual vA \{$nl  private:${ws}vA \\*${vbptr}vA;$nl  public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype vB"
	}
	-re "ptype vB${nl}type = class vB : public virtual vA \{$nl  public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype vB (aCC)"
	}
	-re ".*$gdb_prompt $" { fail "ptype vB" }
	timeout { fail "ptype vB (timeout)" }
    }

    send_gdb "ptype class vB\n"
    gdb_expect {
	-re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype class vB"
	}
	-re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype class vB (aCC)"
	}
	-re ".*$gdb_prompt $" { fail "ptype class vB" }
	timeout { fail "ptype class vB (timeout)" }
    }

    send_gdb "ptype g_vB\n"
    gdb_expect {
	-re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype g_vB"
	}
	-re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
	    pass "ptype g_vB (aCC)"
	}
	-re ".*$gdb_prompt $" { fail "ptype g_vB" }
	timeout { fail "ptype g_vB (timeout)" }
    }

    send_gdb "ptype vC\n"
    gdb_expect {
	-re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
            pass "ptype vC"
	}
	-re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
            pass "ptype vC (aCC)"
	}
	-re ".*$gdb_prompt $" { fail "ptype vC" }
	timeout { fail "ptype vC (timeout)" }
    }

    send_gdb "ptype class vC\n"
    gdb_expect {
	-re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
            pass "ptype class vC"
	}
	-re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
            pass "ptype class vC (aCC)"
	}
	-re ".*$gdb_prompt $" { fail "ptype class vC" }
	timeout { fail "ptype class vC (timeout)" }
    }

    send_gdb "ptype g_vC\n"
    gdb_expect {
	-re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
            pass "ptype g_vC"
	}
	-re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
            pass "ptype g_vC (aCC)"
	}
	-re ".*$gdb_prompt $" { fail "ptype g_vC" }
	timeout { fail "ptype g_vC (timeout)" }
    }
}

#
# Single virtual inheritance, print complete classes.
#

proc test_print_svi_classes {} {
    global gdb_prompt
    global hex
    global decimal
    global nl
    global vbptr

    # Print all members of g_vA.

    gdb_test "print g_vA" ".* = \{va = 1, vx = 2\}" "print g_vA"

    # Print all members of g_vB.

    send_gdb "print g_vB\n"
    gdb_expect {
	-re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" {
           pass "print g_vB (aCC)"
	}
	-re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, __vfp = $hex\}$nl$gdb_prompt $" {
	    pass "print g_vB (aCC)"
	}
	-re ".* = \{\<vA\> = \{va = 3, vx = 4\}, ${vbptr}vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
	    pass "print g_vB"
	}
	-re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vptr.vB = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
	    pass "print g_vB (FIXME v3 vtbl ptr)"
	}
	-re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vptr.vB = $hex <VTT for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" {
	    # Happens with gcc 3.3 -gstabs+
	    # Does not happen with gcc 3.2.3 -gstabs+.
	    # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+.
	    # -- chastain 2003-06-29
	    pass "print g_vB"
	}

	-re ".*invalid address 0x0.*$gdb_prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vB (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$gdb_prompt $" { fail "print g_vB" }
	timeout { fail "print g_vB (timeout)" ; return }
    }

    # Print all members of g_vC.

    send_gdb "print g_vC\n"
    gdb_expect {
	-re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" {
	    pass "print g_vC (aCC)"
	}
	-re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, __vfp = $hex\}$nl$gdb_prompt $" {
	    pass "print g_vC (aCC)"
	}
	-re ".* = \{\<vA\> = \{va = 7, vx = 8\}, ${vbptr}vA = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
	    pass "print g_vC"
	}
	-re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vptr.vC = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
	    pass "print g_vC (FIXME v3 vtbl ptr)"
	}
	-re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vptr.vC = $hex <VTT for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" {
	    # Happens with gcc 3.3 -gstabs+
	    # Does not happen with gcc 3.2.3 -gstabs+.
	    # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+.
	    # -- chastain 2003-06-29
	    pass "print g_vC"
	}
	-re ".*$gdb_prompt $" { fail "print g_vC" }
	timeout { fail "print g_vC (timeout)" }
    }
}

#
# Multiple virtual inheritance, print individual members.
#

proc test_print_mvi_members {} {
    global gdb_prompt
    global decimal
    global nl

    # Print all members of g_vD.

    send_gdb "print g_vD.vA::va\n"
    gdb_expect {
	-re ".* = 19$nl$gdb_prompt $" { pass "print g_vD.vA::va" }
	-re ".*virtual baseclass botch.*$gdb_prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vD.vA::va (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$gdb_prompt $" { fail "print g_vD.vA::va" }
	timeout { fail "print g_vD.vA::va (timeout)" ; return }
    }

    gdb_test "print g_vD.vA::vx" ".* = 20" "print g_vD.vA::vx"

    gdb_test "print g_vD.vB::vb" ".* = 21" "print g_vD.vB::vb"

    gdb_test "print g_vD.vB::vx" ".* = 22" "print g_vD.vB::vx"

    gdb_test "print g_vD.vC::vc" ".* = 23" "print g_vD.vC::vc"

    gdb_test "print g_vD.vC::vx" ".* = 24" "print g_vD.vC::vx"

    gdb_test "print g_vD.vD::vd" ".* = 25" "print g_vD.vD::vd"

    gdb_test "print g_vD.vD::vx" ".* = 26" "print g_vD.vD::vx"

    # Print all members of g_vE.

    gdb_test "print g_vE.vA::va" ".* = 0" "print g_vE.vA::va"

    gdb_test "print g_vE.vA::vx" ".* = 0" "print g_vE.vA::vx"

    gdb_test "print g_vE.vB::vb" ".* = 0" "print g_vE.vB::vb"

    gdb_test "print g_vE.vB::vx" ".* = 0" "print g_vE.vB::vx"

    gdb_test "print g_vE.vC::vc" ".* = 0" "print g_vE.vC::vc"

    gdb_test "print g_vE.vC::vx" ".* = 0" "print g_vE.vC::vx"

    gdb_test "print g_vE.vD::vd" ".* = 0" "print g_vE.vD::vd"

    gdb_test "print g_vE.vD::vx" ".* = 0" "print g_vE.vD::vx"

    gdb_test "print g_vE.vE::ve" ".* = 27" "print g_vE.vE::ve"

    gdb_test "print g_vE.vE::vx" ".* = 28" "print g_vE.vE::vx"
}

#
# Multiple virtual inheritance, print type definitions.
#

proc test_ptype_mvi {} {
    global gdb_prompt
    global ws
    global nl
    global vbptr

    send_gdb "ptype vD\n"
    gdb_expect {
	-re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
	    pass "ptype vD"
	}
        -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" {
	    pass "ptype vD"
	}
	-re ".*$gdb_prompt $" { fail "ptype vD" }
	timeout { fail "(timeout) ptype vD" }
    }

    send_gdb "ptype class vD\n"
    gdb_expect {
	-re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
	    pass "ptype class vD"
	}
	-re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" {
	    pass "ptype class vD"
	}
	-re ".*$gdb_prompt $" { fail "ptype class vD" }
	timeout { fail "(timeout) ptype class vD" }
    }

    send_gdb "ptype g_vD\n"
    gdb_expect {
	-re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
	    pass "ptype g_vD"
	}
	-re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
	    pass "ptype g_vD"
	}
	-re ".*$gdb_prompt $" { fail "ptype g_vD" }
	timeout { fail "(timeout) ptype g_vD" }
    }

    send_gdb "ptype vE\n"
    gdb_expect {
	-re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
	    pass "ptype vE"
	}
	-re ".*class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
	    pass "ptype vE"
	}
	-re ".*$gdb_prompt $" { fail "ptype vE" }
	timeout { fail "(timeout) ptype vE" }
    }

    send_gdb "ptype class vE\n"
    gdb_expect {
	-re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
	    pass "ptype class vE"
	}
	-re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
	    pass "ptype class vE"
	}
	-re ".*$gdb_prompt $" { fail "ptype class vE" }
	timeout { fail "(timeout) ptype class vE" }
    }

    send_gdb "ptype g_vE\n"
    gdb_expect {
	-re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
	    pass "ptype g_vE"
	}
	-re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
	    pass "ptype g_vE"
	}
	-re ".*$gdb_prompt $" { fail "ptype g_vE" }
	timeout { fail "(timeout) ptype g_vE" }
    }
}

#
# Multiple virtual inheritance, print complete classes.
#

proc test_print_mvi_classes {} {
    global gdb_prompt
    global hex
    global decimal
    global nl
    global vbptr

    # Print all members of g_vD.

    send_gdb "print g_vD\n"
    gdb_expect {
	-re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \<class vC\> = \{vc = 23, vx = 24, Virtual table at $hex\}, vd = 25, vx = 26, Virtual table at $hex\}$nl$gdb_prompt $" {
	    pass "print g_vD (aCC)"
	}
	-re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, __vfp = $hex\}, \<class vC\> = \{vc = 23, vx = 24, __vfp = $hex\}, vd = 25, vx = 26, __vfp = $hex\}$nl$gdb_prompt $" {
	    pass "print g_vD (aCC)"
	}
	-re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, ${vbptr}vA = $hex, vb = 21, vx = 22\}, \<vC\> = \{${vbptr}vA = $hex, vc = 23, vx = 24\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
	    pass "print g_vD"
	}
	-re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vptr.vC = $hex, vc = 23, vx = 24\}, _vptr.vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
	    pass "print g_vD (FIXME v3 vtbl ptr)"
	}
	-re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vptr.vC = $hex <VTT for vD>, vc = 23, vx = 24\}, _vptr.vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
	    # Happens with gcc 3.3 -gstabs+
	    # Does not happen with gcc 3.2.3 -gstabs+.
	    # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+.
	    # -- chastain 2003-06-29
	    pass "print g_vD"
	}
	-re ".*invalid address 0x0.*$gdb_prompt $" {
	    # Does not happen with gcc cygnus-2.4.5-930828
	    fail "print g_vD (known bug with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$gdb_prompt $" { fail "print g_vD" }
	timeout { fail "print g_vD (timeout)" ; return }
    }

    # Print all members of g_vE.

    send_gdb "print g_vE\n"
    gdb_expect {
	-re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \<class vC\> = \{vc = 0, vx = 0, Virtual table at $hex\}, vd = 0, vx = 0, Virtual table at $hex\}, ve = 27, vx = 28, Virtual table at $hex\}$nl$gdb_prompt $" {
	    pass "print g_vE (aCC)"
	}
	-re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, __vfp = $hex\}, \<class vC\> = \{vc = 0, vx = 0, __vfp = $hex\}, vd = 0, vx = 0, __vfp = $hex\}, ve = 27, vx = 28, __vfp = $hex\}$nl$gdb_prompt $" {
	    pass "print g_vE (aCC)"
	}
	-re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, ${vbptr}vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{${vbptr}vA = $hex, vc = 0, vx = 0\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 0, vx = 0\}, ${vbptr}vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
	    pass "print g_vE"
	}
	-re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vptr.vB = $hex *(\<VTT for vD\>)?, vb = 0, vx = 0\}, \<vC\> = \{_vptr.vC = $hex *(\<VTT for vD\>)?, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
	    pass "print g_vE (FIXME v3 vtbl ptr)"
	}
	-re ".*$gdb_prompt $" { fail "print g_vE" }
	timeout { fail "print g_vE (timeout)" }
    }
}

proc do_tests {} {
    global prms_id
    global bug_id
    global subdir
    global objdir
    global srcdir
    global binfile

    set prms_id 0
    set bug_id 0

    # Start with a fresh gdb.

    gdb_exit
    gdb_start
    gdb_reinitialize_dir $srcdir/$subdir
    gdb_load $binfile

    gdb_test "set language c++" ""
    gdb_test "set width 0" ""

    # Get the debug format for the compiled test case.

    if { ![ runto_main] } {
	gdb_suppress_tests;
    }

    test_ptype_si
    test_ptype_mi
    test_ptype_vi
    test_ptype_mvi

    gdb_stop_suppressing_tests;
    
    if { ![ runto 'inheritance2' ] } {
	gdb_suppress_tests;
    }

    test_print_si_members
    test_print_si_classes
    test_print_mi_members
    test_print_mi_classes
    test_print_anon_union

    gdb_stop_suppressing_tests;

    if { ![ runto 'inheritance4' ] } {
	gdb_suppress_tests;
    }

    test_print_svi_members
    test_print_svi_classes
    test_print_mvi_members
    test_print_mvi_classes
}

do_tests