b023944f95118ef6d1806026a37bab0f4042a0e8
[external/binutils.git] / gdb / testsuite / gdb.c++ / virtfunc.exp
1 # Copyright (C) 1992, 1994, 1997, 1999 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # This file was written by Fred Fish. (fnf@cygnus.com)
21
22 set ws "\[\r\n\t \]+"
23 set nl "\[\r\n\]+"
24
25 if $tracelevel then {
26         strace $tracelevel
27 }
28
29 if { [skip_cplus_tests] } { continue }
30
31 set testfile "virtfunc"
32 set srcfile ${testfile}.cc
33 set binfile ${objdir}/${subdir}/${testfile}
34
35 if [get_compiler_info ${binfile} "c++"] {
36     return -1
37 }
38
39 source ${binfile}.ci
40
41 set src "${srcdir}/${subdir}/${srcfile}"
42 if  { [gdb_compile "${src}" "${binfile}" executable {c++ debug}] != "" } {
43      gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
44 }
45
46 proc gdb_virtfunc_init {} {
47     global srcdir subdir binfile
48     global gdb_prompt
49
50     gdb_reinitialize_dir $srcdir/$subdir
51     gdb_load $binfile
52
53     send_gdb "set language c++\n"
54     gdb_expect -re "$gdb_prompt $"
55     send_gdb "set width 0\n"
56     gdb_expect -re "$gdb_prompt $"
57 }
58
59 proc gdb_virtfunc_restart {} {
60     gdb_exit;
61     gdb_start;
62     gdb_virtfunc_init;
63     runto 'test_calls(void)';
64 }
65
66 #
67 #  Test printing of the types of various classes.
68 #
69
70 proc test_ptype_of_classes {} {
71     global gdb_prompt
72     global ws
73     global nl
74
75     # This used to be a fail if it printed "struct" not "class".  But
76     # since this struct doesn't use any special C++ features, it is
77     # considered right for GDB to print it as "struct".
78     send_gdb "ptype VA\n"
79     gdb_expect {
80         -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 $" {
81             pass "ptype VA"
82         }
83         -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 $" {
84             pass "ptype VA (obsolescent gcc or gdb)"
85         }
86         -re ".*$gdb_prompt $" {
87             fail "ptype VA"
88         }
89         timeout {
90             fail "ptype VA (timeout)"
91         }
92     }
93
94     send_gdb "ptype VB\n"
95     gdb_expect {
96         -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 $" {
97             pass "ptype VB"
98         }
99         -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}.*$gdb_prompt $" {
100             pass "ptype VB (aCC)"
101         }
102         -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 $" {
103             pass "ptype VB (obsolescent gcc or gdb)"
104         }
105         -re ".*$gdb_prompt $" {
106             fail "ptype VB"
107         }
108         timeout {
109             fail "ptype VB (timeout)"
110         }
111     }
112
113     send_gdb "ptype V\n"
114     gdb_expect {
115         -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 $" {
116             pass "ptype V"
117         }
118         -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 $" {
119             pass "ptype V (aCC)"
120         }
121         -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 $" {
122             pass "ptype V (obsolescent gcc or gdb)"
123         }
124         -re ".*$gdb_prompt $" {
125             fail "ptype V"
126         }
127         timeout {
128             fail "ptype V (timeout)"
129         }
130     }
131
132     send_gdb "ptype A\n"
133     gdb_expect {
134         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+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 $" {
135             pass "ptype A"
136         }
137         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
138             pass "ptype A (aCC)"
139         }
140         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+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 $" {
141             pass "ptype A (obsolescent gcc or gdb)"
142         }
143         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}$nl$gdb_prompt $" {
144             # This happens because the type is defined only after it is
145             # too late.
146             fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
147             # Many of the rest of these tests have the same problem.
148             return 0
149         }
150         -re ".*$gdb_prompt $" {
151             fail "ptype A"
152         }
153         timeout {
154             fail "ptype A (timeout)"
155         }
156     }
157
158     send_gdb "ptype B\n"
159     gdb_expect {
160         -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 $" {
161             pass "ptype B"
162         }
163         -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
164             pass "ptype B (aCC)"
165         }
166         -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 $" {
167             pass "ptype B (obsolescent gcc or gdb)"
168         }
169         -re ".*$gdb_prompt $" {
170             fail "ptype B"
171         }
172         timeout {
173             fail "ptype B (timeout)"
174         }
175     }
176
177     send_gdb "ptype C\n"
178     gdb_expect {
179         -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
180             pass "ptype C"
181         }
182         -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
183             pass "ptype C (aCC)"
184         }
185         -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
186             pass "ptype C (obsolescent gcc or gdb)"
187         }
188         -re ".*$gdb_prompt $" {
189             fail "ptype C"
190         }
191         timeout {
192             fail "ptype C (timeout)"
193         }
194     }
195
196     send_gdb "ptype AD\n"
197     gdb_expect {
198         -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 $" {
199             pass "ptype AD"
200         }
201         -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" {
202             pass "ptype AD (aCC)"
203         }
204         -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 $" {
205             pass "ptype AD (obsolescent gcc or gdb)"
206         }
207         -re ".*$gdb_prompt $" {
208             fail "ptype AD"
209         }
210         timeout {
211             fail "ptype AD (timeout)"
212         }
213     }
214
215     send_gdb "ptype D\n"
216     gdb_expect {
217         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
218             pass "ptype D"
219         }
220         -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 $" {
221             pass "ptype D (aCC)"
222         }
223         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
224             pass "ptype D (obsolescent gcc or gdb)"
225         }
226         -re ".*$gdb_prompt $" {
227             fail "ptype D"
228         }
229         timeout {
230             fail "ptype D (timeout)"
231         }
232     }
233
234     send_gdb "ptype E\n"
235     gdb_expect {
236         -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 $" {
237             pass "ptype E"
238         }
239         -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 $" {
240             pass "ptype E (aCC)"
241         }
242         -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 $" {
243             pass "ptype E (obsolescent gcc or gdb)"
244         }
245         -re ".*$gdb_prompt $" {
246             fail "ptype E"
247         }
248         timeout {
249             fail "ptype E (timeout)"
250         }
251     }
252
253     send_gdb "ptype dd\n"
254     gdb_expect {
255         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
256             pass "ptype dd"
257         }
258         -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 $" {
259             pass "ptype dd (aCC)"
260         }
261         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
262             pass "ptype dd (obsolescent gcc or gdb)"
263         }
264         -re ".*$gdb_prompt $" {
265             fail "ptype dd"
266         }
267         timeout {
268             fail "ptype dd (timeout)"
269         }
270     }
271
272     send_gdb "ptype ppd\n"
273     gdb_expect {
274         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
275             pass "ptype ppd"
276         }
277         -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 $" {
278             pass "ptype ppd (aCC)"
279         }
280         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
281             pass "ptype ppd (obsolescent gcc or gdb)"
282         }
283         -re ".*$gdb_prompt $" {
284             fail "ptype ppd"
285         }
286         timeout {
287             fail "ptype ppd (timeout)"
288         }
289     }
290
291     send_gdb "ptype pAd\n"
292     gdb_expect {
293         -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 $" {
294             pass "ptype pAd"
295         }
296         -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
297             pass "ptype pAd (aCC)"
298         }
299         -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 $" {
300             pass "ptype pAd (obsolescent gcc or gdb)"
301         }
302         -re ".*$gdb_prompt $" {
303             fail "ptype pAd"
304         }
305         timeout {
306             fail "ptype pAd (timeout)"
307         }
308     }
309
310     send_gdb "ptype a\n"
311     gdb_expect {
312         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
313             pass "ptype a"
314         }
315         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
316             pass "ptype a (aCC)"
317         }
318         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
319             pass "ptype a (obsolescent gcc or gdb)"
320         }
321         -re ".*$gdb_prompt $" {
322             fail "ptype a"
323         }
324         timeout {
325             fail "ptype a (timeout)"
326         }
327     }
328
329     send_gdb "ptype b\n"
330     gdb_expect {
331         -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 $" {
332             pass "ptype b"
333         }
334         -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
335             pass "ptype b (aCC)"
336         }
337         -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 $" {
338             pass "ptype b (obsolescent gcc or gdb)"
339         }
340         -re ".*$gdb_prompt $" {
341             fail "ptype b"
342         }
343         timeout {
344             fail "ptype b (timeout)"
345         }
346     }
347
348     send_gdb "ptype c\n"
349     gdb_expect {
350         -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
351             pass "ptype c"
352         }
353         -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
354             pass "ptype c (aCC)"
355         }
356         -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
357             pass "ptype c (obsolescent gcc or gdb)"
358         }
359         -re ".*$gdb_prompt $" {
360             fail "ptype c"
361         }
362         timeout {
363             fail "ptype c (timeout)"
364         }
365     }
366
367     send_gdb "ptype d\n"
368     gdb_expect {
369         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
370             pass "ptype d"
371         }
372         -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 $" {
373             pass "ptype d (aCC)"
374         }
375         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
376             pass "ptype d (obsolescent gcc or gdb)"
377         }
378         -re ".*$gdb_prompt $" {
379             fail "ptype d"
380         }
381         timeout {
382             fail "ptype d (timeout)"
383         }
384     }
385
386     send_gdb "ptype e\n"
387     gdb_expect {
388         -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 $" {
389             pass "ptype e"
390         }
391         -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 $" {
392             pass "ptype e (aCC)"
393         }
394         -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 $" {
395             pass "ptype e (obsolescent gcc or gdb)"
396         }
397         -re ".*$gdb_prompt $" {
398             fail "ptype e"
399         }
400         timeout {
401             fail "ptype e (timeout)"
402         }
403     }
404
405     send_gdb "ptype v\n"
406     gdb_expect {
407         -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 $" {
408             pass "ptype v"
409         }
410         -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 $" {
411             pass "ptype v (aCC)"
412         }
413         -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 $" {
414             pass "ptype v (obsolescent gcc or gdb)"
415         }
416         -re ".*$gdb_prompt $" {
417             fail "ptype v"
418         }
419         timeout {
420             fail "ptype v (timeout)"
421         }
422     }
423
424     send_gdb "ptype vb\n"
425     gdb_expect {
426         -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 $" {
427             pass "ptype vb"
428         }
429         -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}$nl$gdb_prompt $" {
430             pass "ptype vb (aCC)"
431         }
432         -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 $" {
433             pass "ptype vb (obsolescent gcc or gdb)"
434         }
435         -re ".*$gdb_prompt $" {
436             fail "ptype vb"
437         }
438         timeout {
439             fail "ptype vb (timeout)"
440         }
441     }
442
443     send_gdb "ptype pAa\n"
444     gdb_expect {
445         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
446             pass "ptype pAa"
447         }
448         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
449             pass "ptype pAa (aCC)"
450         }
451         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
452             pass "ptype pAa (obsolescent gcc or gdb)"
453         }
454         -re ".*$gdb_prompt $" {
455             fail "ptype pAa"
456         }
457         timeout {
458             fail "ptype pAa (timeout)"
459         }
460     }
461
462     send_gdb "ptype pAe\n"
463     gdb_expect {
464         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
465             pass "ptype pAe"
466         }
467         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
468             pass "ptype pAe (aCC)"
469         }
470         -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
471             pass "ptype pAe (obsolescent gcc or gdb)"
472         }
473         -re ".*$gdb_prompt $" {
474             fail "ptype pAe"
475         }
476         timeout {
477             fail "ptype pAe (timeout)"
478         }
479     }
480
481     send_gdb "ptype pBe\n"
482     gdb_expect {
483         -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 $" {
484             pass "ptype pBe"
485         }
486         -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
487             pass "ptype pBe (aCC)"
488         }
489         -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 $" {
490             pass "ptype pBe (obsolescent gcc or gdb)"
491         }
492         -re ".*$gdb_prompt $" {
493             fail "ptype pBe"
494         }
495         timeout {
496             fail "ptype pBe (timeout)"
497         }
498     }
499
500     send_gdb "ptype pDd\n"
501     gdb_expect {
502         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
503             pass "ptype pDd"
504         }
505         -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 $" {
506             pass "ptype pDd (aCC)"
507         }
508         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
509             pass "ptype pDd (obsolescent gcc or gdb)"
510         }
511         -re ".*$gdb_prompt $" {
512             fail "ptype pDd"
513         }
514         timeout {
515             fail "ptype pDd (timeout)"
516         }
517     }
518
519     send_gdb "ptype pDe\n"
520     gdb_expect {
521         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
522             pass "ptype pDe"
523         }
524         -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 $" {
525             pass "ptype pDe (aCC)"
526         }
527         -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.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 $" {
528             pass "ptype pDe (obsolescent gcc or gdb)"
529         }
530         -re ".*$gdb_prompt $" {
531             fail "ptype pDe"
532         }
533         timeout {
534             fail "ptype pDe (timeout)"
535         }
536     }
537
538     send_gdb "ptype pVa\n"
539     gdb_expect {
540         -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 $" {
541             pass "ptype pVa"
542         }
543         -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 $" {
544             pass "ptype pVa (aCC)"
545         }
546         -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 $" {
547             pass "ptype pVa (obsolescent gcc or gdb)"
548         }
549         -re ".*$gdb_prompt $" {
550             fail "ptype pVa"
551         }
552         timeout {
553             fail "ptype pVa (timeout)"
554         }
555     }
556
557     send_gdb "ptype pVv\n"
558     gdb_expect {
559         -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 $" {
560             pass "ptype pVv"
561         }
562         -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 $" {
563             pass "ptype pVv (aCC)"
564         }
565         -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 $" {
566             pass "ptype pVv (obsolescent gcc or gdb)"
567         }
568         -re ".*$gdb_prompt $" {
569             fail "ptype pVv"
570         }
571         timeout {
572             fail "ptype pVv (timeout)"
573         }
574     }
575
576     send_gdb "ptype pVe\n"
577     gdb_expect {
578         -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 $" {
579             pass "ptype pVe"
580         }
581         -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 $" {
582             pass "ptype pVe (aCC)"
583         }
584         -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 $" {
585             pass "ptype pVe (obsolescent gcc or gdb)"
586         }
587         -re ".*$gdb_prompt $" {
588             fail "ptype pVe"
589         }
590         timeout {
591             fail "ptype pVe (timeout)"
592         }
593     }
594
595     send_gdb "ptype pVd\n"
596     gdb_expect {
597         -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 $" {
598             pass "ptype pVd"
599         }
600         -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 $" {
601             pass "ptype pVd (aCC)"
602         }
603         -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 $" {
604             pass "ptype pVd (obsolescent gcc or gdb)"
605         }
606         -re ".*$gdb_prompt $" {
607             fail "ptype pVd"
608         }
609         timeout {
610             fail "ptype pVd (timeout)"
611         }
612     }
613
614     send_gdb "ptype pADe\n"
615     gdb_expect {
616         -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 $" {
617             pass "ptype pADe"
618         }
619         -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
620             pass "ptype pADe (aCC)"
621         }
622         -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 $" {
623             pass "ptype pADe (obsolescent gcc or gdb)"
624         }
625         -re ".*$gdb_prompt $" {
626             fail "ptype pADe"
627         }
628         timeout {
629             fail "ptype pADe (timeout)"
630         }
631     }
632
633     send_gdb "ptype pEe\n"
634     gdb_expect {
635         -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 $" {
636             pass "ptype pEe"
637         }
638         -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 $" {
639             pass "ptype pEe (aCC)"
640         }
641         -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 $" {
642             pass "ptype pEe (obsolescent gcc or gdb)"
643         }
644         -re ".*$gdb_prompt $" {
645             fail "ptype pEe"
646         }
647         timeout {
648             fail "ptype pEe (timeout)"
649         }
650     }
651
652     send_gdb "ptype pVB\n"
653     gdb_expect {
654         -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 $" {
655             pass "ptype pVB"
656         }
657         -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
658             pass "ptype pVB (aCC)"
659         }
660         -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 $" {
661             pass "ptype pVB (obsolescent gcc or gdb)"
662         }
663         -re ".*$gdb_prompt $" {
664             fail "ptype pVB"
665         }
666         timeout {
667             fail "ptype pVB (timeout)"
668         }
669     }
670 }
671
672 #
673 #  Test calling of virtual functions.
674 #
675
676 proc test_virtual_calls {} {
677     global gdb_prompt
678     global GDB
679     global nl
680     global gcc_compiled
681
682     if [target_info exists gdb,cannot_call_functions] {
683         setup_xfail "*-*-*" 2416
684         fail "This target can not call functions"
685         return 0
686     }
687
688     # FIXME: In fall 1998, GCC's virtual function type info was changed,
689     # which causes GDB to be unable to resolve these calls.  Until the
690     # problem is fixed, XFAIL these tests. -sts 1999-08-02
691
692     if {$gcc_compiled} then { setup_xfail "*-*-*" }
693
694     send_gdb "print pAe->f()\n"
695     gdb_expect {
696         -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
697         -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
698             fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
699             return 0
700         }
701         -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
702             fail "print pAe->f() \
703 (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
704             return 0
705         }
706         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
707             setup_xfail hppa*-*-* CLLbs16899
708             fail "print pAe->f()"
709         }
710         -re ".*$gdb_prompt $" { fail "print pAe->f()" }
711         timeout { fail "print pAe->f() (timeout)" }
712         eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
713     }
714
715     if {$gcc_compiled} then { setup_xfail "*-*-*" }
716
717     send_gdb "print pAa->f()\n"
718     gdb_expect {
719         -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
720         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
721             setup_xfail hppa*-*-*  CLLbs16899
722             fail "print pAa->f()"
723         }
724         -re ".*$gdb_prompt $" { fail "print pAa->f()" }
725         timeout { fail "print pAa->f() (timeout)" }
726         eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
727     }
728
729     if {$gcc_compiled} then { setup_xfail "*-*-*" }
730
731     send_gdb "print pDe->vg()\n"
732     gdb_expect {
733         -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
734         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
735             setup_xfail hppa*-*-*  CLLbs16899
736             fail "print pDe->vg()"
737         }
738         -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
739         timeout { fail "print pDe->vg() (timeout)" }
740         eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
741     }
742
743     if {$gcc_compiled} then { setup_xfail "*-*-*" }
744
745     send_gdb "print pADe->vg()\n"
746     gdb_expect {
747         -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
748         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
749             setup_xfail hppa*-*-*  CLLbs16899
750             fail "print pADe->vg()"
751         }
752         -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
753         timeout { fail "print pADe->vg() (timeout)" }
754         eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
755     }
756
757     if {$gcc_compiled} then { setup_xfail "*-*-*" }
758
759     send_gdb "print pDd->vg()\n"
760     gdb_expect {
761         -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
762         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
763             setup_xfail hppa*-*-*  CLLbs16899
764             fail "print pDd->vg()"
765         }
766         -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
767         timeout { fail "print pDd->vg() (timeout)" }
768         eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
769     }
770
771     if {$gcc_compiled} then { setup_xfail "*-*-*" }
772
773     send_gdb "print pEe->vvb()\n"
774     gdb_expect {
775         -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
776         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
777             setup_xfail hppa*-*-*  CLLbs16899
778             fail "print pEe->vvb()"
779         }
780         -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
781         timeout { fail "print pEe->vvb() (timeout)" }
782         eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
783     }
784
785     if {$gcc_compiled} then { setup_xfail "*-*-*" }
786
787     send_gdb "print pVB->vvb()\n"
788     gdb_expect {
789         -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
790         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
791             setup_xfail hppa*-*-*  CLLbs16899
792             fail "print pVB->vvb()"
793         }
794         -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
795         timeout { fail "print pVB->vvb() (timeout)" }
796         eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
797     }
798
799     if {$gcc_compiled} then { setup_xfail "*-*-*" }
800
801     send_gdb "print pBe->vvb()\n"
802     gdb_expect {
803         -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
804         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
805             setup_xfail hppa*-*-*  CLLbs16899
806             fail "print pBe->vvb()"
807         }
808         -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
809         timeout { fail "print pBe->vvb() (timeout)" }
810         eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
811     }
812
813     if {$gcc_compiled} then { setup_xfail "*-*-*" }
814
815     send_gdb "print pDe->vvb()\n"
816     gdb_expect {
817         -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
818         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
819             setup_xfail hppa*-*-*  CLLbs16899
820             fail "print pDe->vvb()"
821         }
822         -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
823         timeout { fail "print pDe->vvb() (timeout)" }
824         eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
825     }
826
827     if {$gcc_compiled} then { setup_xfail "*-*-*" }
828
829     send_gdb "print pEe->vd()\n"
830     gdb_expect {
831         -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
832         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
833             setup_xfail hppa*-*-*  CLLbs16899
834             fail "print pEe->vd()"
835         }
836         -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
837         timeout { fail "print pEe->vd() (timeout)" }
838         eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
839     }
840
841     if {$gcc_compiled} then { setup_xfail "*-*-*" }
842
843     send_gdb "print pEe->fvb()\n"
844     gdb_expect {
845         -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
846         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
847             setup_xfail hppa*-*-*  CLLbs16899
848             fail "print pEe->fvb()"
849         }
850         -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
851         timeout { fail "print pEe->fvb() (timeout)" }
852         eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
853     }
854
855     if {$gcc_compiled} then { setup_xfail "*-*-*" }
856
857     send_gdb "print pEe->D::vg()\n"
858     setup_xfail "*-*-*"
859     gdb_expect {
860         -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
861         -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
862         timeout { fail "print pEe->D::vg() (timeout)" }
863         eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
864     }
865 }
866
867 proc do_tests {} {
868     global prms_id
869     global bug_id
870
871     set prms_id 0
872     set bug_id 0
873
874     gdb_start;
875     gdb_virtfunc_init;
876
877     # Get the debug format for the compiled test case.  If that
878     # format is DWARF 1 then just skip all the tests since none of
879     # them will pass.
880
881     if [ runto_main ] then {
882         get_debug_format
883         if [ setup_xfail_format "DWARF 1" ] then {
884             fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
885             return
886         }
887         clear_xfail "*-*-*"
888     }
889
890     test_ptype_of_classes
891
892     if [ runto 'test_calls(void)' ] then {
893         test_virtual_calls
894     }
895 }
896
897 do_tests