aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.c++/virtfunc.exp
blob: 3e2bbdefd607712acf7a3eb14807a901586fd678 (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
# Copyright (C) 1992, 1994, 1997, 1999 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\]+"

if $tracelevel then {
	strace $tracelevel
}

if { [skip_cplus_tests] } { continue }

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

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

source ${binfile}.ci

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

proc gdb_virtfunc_init {} {
    global srcdir subdir binfile
    global gdb_prompt

    gdb_reinitialize_dir $srcdir/$subdir
    gdb_load $binfile

    send_gdb "set language c++\n"
    gdb_expect -re "$gdb_prompt $"
    send_gdb "set width 0\n"
    gdb_expect -re "$gdb_prompt $"
}

proc gdb_virtfunc_restart {} {
    gdb_exit;
    gdb_start;
    gdb_virtfunc_init;
    runto 'test_calls(void)';
}

#
#  Test printing of the types of various classes.
#

proc test_ptype_of_classes {} {
    global gdb_prompt
    global ws
    global nl

    # This used to be a fail if it printed "struct" not "class".  But
    # since this struct doesn't use any special C++ features, it is
    # considered right for GDB to print it as "struct".
    send_gdb "ptype VA\n"
    gdb_expect {
	-re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;${ws}VA & operator=\\(VA const &\\);${ws}VA\\(VA const &\\);${ws}VA\\(void\\);${ws}\}.*$gdb_prompt $" {
	    pass "ptype VA"
	}
	-re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;((${ws}VA & operator=\\(VA const &\\);)|(${ws}VA\\(VA const &\\);)|(${ws}VA\\(void\\);))*${ws}\}.*$gdb_prompt $" {
	    pass "ptype VA (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype VA"
	}
	timeout {
	    fail "ptype VA (timeout)"
	}
    }

    send_gdb "ptype VB\n"
    gdb_expect {
	-re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}.*$gdb_prompt $" {
	    pass "ptype VB"
	}
	-re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}.*$gdb_prompt $" {
	    pass "ptype VB (aCC)"
	}
	-re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}.*$gdb_prompt $" {
	    pass "ptype VB (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype VB"
	}
	timeout {
	    fail "ptype VB (timeout)"
	}
    }

    send_gdb "ptype V\n"
    gdb_expect {
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype V"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype V (aCC)"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype V (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype V"
	}
	timeout {
	    fail "ptype V (timeout)"
	}
    }

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

    send_gdb "ptype A\n"
    gdb_expect {
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype A"
	}
        -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
            pass "ptype A (aCC)"
        }
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype A (obsolescent gcc or gdb)"
	}
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}$nl$gdb_prompt $" {
	    # This happens because the type is defined only after it is
	    # too late.
	    fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
	    # Many of the rest of these tests have the same problem.
	    return 0
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype A"
	}
	timeout {
	    fail "ptype A (timeout)"
	}
    }

    send_gdb "ptype B\n"
    gdb_expect {
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype B"
	}
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype B (aCC)"
	}
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype B (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype B"
	}
	timeout {
	    fail "ptype B (timeout)"
	}
    }

    send_gdb "ptype C\n"
    gdb_expect {
	-re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype C"
	}
        -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
            pass "ptype C (aCC)"
        }
	-re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype C (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype C"
	}
	timeout {
	    fail "ptype C (timeout)"
	}
    }

    send_gdb "ptype AD\n"
    gdb_expect {
	-re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype AD"
	}
	-re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype AD (aCC)"
	}
	-re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype AD (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype AD"
	}
	timeout {
	    fail "ptype AD (timeout)"
	}
    }

    send_gdb "ptype D\n"
    gdb_expect {
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype D"
	}
        -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
            pass "ptype D (aCC)"
        }
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype D (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype D"
	}
	timeout {
	    fail "ptype D (timeout)"
	}
    }

    send_gdb "ptype E\n"
    gdb_expect {
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype E"
	}
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype E (aCC)"
	}
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype E (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype E"
	}
	timeout {
	    fail "ptype E (timeout)"
	}
    }

    send_gdb "ptype dd\n"
    gdb_expect {
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype dd"
	}
        -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
            pass "ptype dd (aCC)"
        }
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype dd (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype dd"
	}
	timeout {
	    fail "ptype dd (timeout)"
	}
    }

    send_gdb "ptype ppd\n"
    gdb_expect {
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype ppd"
	}
        -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
            pass "ptype ppd (aCC)"
        }
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype ppd (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype ppd"
	}
	timeout {
	    fail "ptype ppd (timeout)"
	}
    }

    send_gdb "ptype pAd\n"
    gdb_expect {
	-re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pAd"
	}
	-re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pAd (aCC)"
	}
	-re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pAd (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pAd"
	}
	timeout {
	    fail "ptype pAd (timeout)"
	}
    }

    send_gdb "ptype a\n"
    gdb_expect {
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype a"
	}
        -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
            pass "ptype a (aCC)"
        }
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype a (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype a"
	}
	timeout {
	    fail "ptype a (timeout)"
	}
    }

    send_gdb "ptype b\n"
    gdb_expect {
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype b"
	}
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype b (aCC)"
	}
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype b (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype b"
	}
	timeout {
	    fail "ptype b (timeout)"
	}
    }

    send_gdb "ptype c\n"
    gdb_expect {
	-re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype c"
	}
        -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
            pass "ptype c (aCC)"
        }
	-re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype c (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype c"
	}
	timeout {
	    fail "ptype c (timeout)"
	}
    }

    send_gdb "ptype d\n"
    gdb_expect {
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype d"
	}
        -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
            pass "ptype d (aCC)"
        }
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype d (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype d"
	}
	timeout {
	    fail "ptype d (timeout)"
	}
    }

    send_gdb "ptype e\n"
    gdb_expect {
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype e"
	}
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype e (aCC)"
	}
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype e (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype e"
	}
	timeout {
	    fail "ptype e (timeout)"
	}
    }

    send_gdb "ptype v\n"
    gdb_expect {
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype v"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype v (aCC)"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype v (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype v"
	}
	timeout {
	    fail "ptype v (timeout)"
	}
    }

    send_gdb "ptype vb\n"
    gdb_expect {
	-re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype vb"
	}
	-re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}$nl$gdb_prompt $" {
	    pass "ptype vb (aCC)"
	}
	-re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
	    pass "ptype vb (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype vb"
	}
	timeout {
	    fail "ptype vb (timeout)"
	}
    }

    send_gdb "ptype pAa\n"
    gdb_expect {
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pAa"
	}
        -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
            pass "ptype pAa (aCC)"
        }
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pAa (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pAa"
	}
	timeout {
	    fail "ptype pAa (timeout)"
	}
    }

    send_gdb "ptype pAe\n"
    gdb_expect {
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pAe"
	}
        -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
            pass "ptype pAe (aCC)"
	}
	-re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pAe (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pAe"
	}
	timeout {
	    fail "ptype pAe (timeout)"
	}
    }

    send_gdb "ptype pBe\n"
    gdb_expect {
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pBe"
	}
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pBe (aCC)"
	}
	-re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pBe (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pBe"
	}
	timeout {
	    fail "ptype pBe (timeout)"
	}
    }

    send_gdb "ptype pDd\n"
    gdb_expect {
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pDd"
	}
        -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
            pass "ptype pDd (aCC)"
        }
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pDd (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pDd"
	}
	timeout {
	    fail "ptype pDd (timeout)"
	}
    }

    send_gdb "ptype pDe\n"
    gdb_expect {
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pDe"
	}
        -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
            pass "ptype pDe (aCC)"
        }
	-re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pDe (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pDe"
	}
	timeout {
	    fail "ptype pDe (timeout)"
	}
    }

    send_gdb "ptype pVa\n"
    gdb_expect {
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVa"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVa (aCC)"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVa (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pVa"
	}
	timeout {
	    fail "ptype pVa (timeout)"
	}
    }

    send_gdb "ptype pVv\n"
    gdb_expect {
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVv"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVv (aCC)"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVv (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pVv"
	}
	timeout {
	    fail "ptype pVv (timeout)"
	}
    }

    send_gdb "ptype pVe\n"
    gdb_expect {
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVe"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVe (aCC)"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVe (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pVe"
	}
	timeout {
	    fail "ptype pVe (timeout)"
	}
    }

    send_gdb "ptype pVd\n"
    gdb_expect {
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVd"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVd (aCC)"
	}
	-re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVd (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pVd"
	}
	timeout {
	    fail "ptype pVd (timeout)"
	}
    }

    send_gdb "ptype pADe\n"
    gdb_expect {
	-re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pADe"
	}
	-re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pADe (aCC)"
	}
	-re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pADe (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pADe"
	}
	timeout {
	    fail "ptype pADe (timeout)"
	}
    }

    send_gdb "ptype pEe\n"
    gdb_expect {
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pEe"
	}
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pEe (aCC)"
	}
	-re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pEe (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pEe"
	}
	timeout {
	    fail "ptype pEe (timeout)"
	}
    }

    send_gdb "ptype pVB\n"
    gdb_expect {
	-re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVB"
	}
	-re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVB (aCC)"
	}
	-re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
	    pass "ptype pVB (obsolescent gcc or gdb)"
	}
	-re ".*$gdb_prompt $" {
	    fail "ptype pVB"
	}
	timeout {
	    fail "ptype pVB (timeout)"
	}
    }
}

#
#  Test calling of virtual functions.
#

proc test_virtual_calls {} {
    global gdb_prompt
    global GDB
    global nl
    global gcc_compiled

    if [target_info exists gdb,cannot_call_functions] {
	setup_xfail "*-*-*" 2416
	fail "This target can not call functions"
	return 0
    }

    # FIXME: In fall 1998, GCC's virtual function type info was changed,
    # which causes GDB to be unable to resolve these calls.  Until the
    # problem is fixed, XFAIL these tests. -sts 1999-08-02

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pAe->f()\n"
    gdb_expect {
	-re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
	-re "Cannot invoke functions on this machine.*$gdb_prompt $" {
	    fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
	    return 0
	}
	-re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
	    fail "print pAe->f() \
(known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
	    return 0
	}
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-* CLLbs16899
            fail "print pAe->f()"
	}
	-re ".*$gdb_prompt $" { fail "print pAe->f()" }
	timeout { fail "print pAe->f() (timeout)" }
	eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pAa->f()\n"
    gdb_expect {
	-re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pAa->f()"
	}
	-re ".*$gdb_prompt $" { fail "print pAa->f()" }
	timeout { fail "print pAa->f() (timeout)" }
	eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pDe->vg()\n"
    gdb_expect {
	-re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pDe->vg()"
	}
	-re ".*$gdb_prompt $" { fail "print pDe->vg()" }
	timeout { fail "print pDe->vg() (timeout)" }
	eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pADe->vg()\n"
    gdb_expect {
	-re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pADe->vg()"
	}
	-re ".*$gdb_prompt $" { fail "print pADe->vg()" }
	timeout { fail "print pADe->vg() (timeout)" }
	eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pDd->vg()\n"
    gdb_expect {
	-re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pDd->vg()"
	}
	-re ".*$gdb_prompt $" { fail "print pDd->vg()" }
	timeout { fail "print pDd->vg() (timeout)" }
	eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pEe->vvb()\n"
    gdb_expect {
	-re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pEe->vvb()"
	}
	-re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
	timeout { fail "print pEe->vvb() (timeout)" }
	eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pVB->vvb()\n"
    gdb_expect {
	-re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pVB->vvb()"
	}
	-re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
	timeout { fail "print pVB->vvb() (timeout)" }
	eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pBe->vvb()\n"
    gdb_expect {
	-re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pBe->vvb()"
	}
	-re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
	timeout { fail "print pBe->vvb() (timeout)" }
	eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pDe->vvb()\n"
    gdb_expect {
	-re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pDe->vvb()"
	}
	-re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
	timeout { fail "print pDe->vvb() (timeout)" }
	eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pEe->vd()\n"
    gdb_expect {
	-re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pEe->vd()"
	}
	-re ".*$gdb_prompt $" { fail "print pEe->vd()" }
	timeout { fail "print pEe->vd() (timeout)" }
	eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pEe->fvb()\n"
    gdb_expect {
	-re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
        -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
	    setup_xfail hppa*-*-*  CLLbs16899
	    fail "print pEe->fvb()"
	}
	-re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
	timeout { fail "print pEe->fvb() (timeout)" }
	eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }

    if {$gcc_compiled} then { setup_xfail "*-*-*" }

    send_gdb "print pEe->D::vg()\n"
    setup_xfail "*-*-*"
    gdb_expect {
	-re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
	-re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
	timeout { fail "print pEe->D::vg() (timeout)" }
	eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
    }
}

proc do_tests {} {
    global prms_id
    global bug_id

    set prms_id 0
    set bug_id 0

    gdb_start;
    gdb_virtfunc_init;

    # Get the debug format for the compiled test case.  If that
    # format is DWARF 1 then just skip all the tests since none of
    # them will pass.

    if [ runto_main ] then {
	get_debug_format
	if [ setup_xfail_format "DWARF 1" ] then {
	    fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
	    return
	}
	clear_xfail "*-*-*"
    }

    test_ptype_of_classes

    if [ runto 'test_calls(void)' ] then {
	test_virtual_calls
    }
}

do_tests