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