2003-08-22 Michael Chastain <mec@shout.net>
[external/binutils.git] / gdb / testsuite / gdb.cp / virtfunc.exp
1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003
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 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${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';
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|const VA) ?&\\);${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|const VB) ?&\\);${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|const V) ?&\\);${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     # The format of a g++ virtual base pointer.
133     set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"
134
135     send_gdb "ptype A\n"
136     gdb_expect {
137         -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 $" {
138             pass "ptype A"
139         }
140         -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 $" {
141             pass "ptype A"
142         }
143         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
144             pass "ptype A (aCC)"
145         }
146         -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 $" {
147             pass "ptype A (obsolescent gcc or gdb)"
148         }
149         -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 $" {
150             # This happens because the type is defined only after it is
151             # too late.
152             fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
153             # Many of the rest of these tests have the same problem.
154             return 0
155         }
156         -re ".*$gdb_prompt $" {
157             fail "ptype A"
158         }
159         timeout {
160             fail "ptype A (timeout)"
161         }
162     }
163
164     send_gdb "ptype B\n"
165     gdb_expect {
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"
168         }
169         -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 $" {
170             pass "ptype B"
171         }
172         -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
173             pass "ptype B (aCC)"
174         }
175         -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 $" {
176             pass "ptype B (obsolescent gcc or gdb)"
177         }
178         -re ".*$gdb_prompt $" {
179             fail "ptype B"
180         }
181         timeout {
182             fail "ptype B (timeout)"
183         }
184     }
185
186     send_gdb "ptype C\n"
187     gdb_expect {
188         -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 $" {
189             pass "ptype C"
190         }
191         -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 $" {
192             pass "ptype C"
193         }
194         -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
195             pass "ptype C (aCC)"
196         }
197         -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 $" {
198             pass "ptype C (obsolescent gcc or gdb)"
199         }
200         -re ".*$gdb_prompt $" {
201             fail "ptype C"
202         }
203         timeout {
204             fail "ptype C (timeout)"
205         }
206     }
207
208     send_gdb "ptype AD\n"
209     gdb_expect {
210         -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 $" {
211             pass "ptype AD"
212         }
213         -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
214             pass "ptype AD (aCC)"
215         }
216         -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 $" {
217             pass "ptype AD (obsolescent gcc or gdb)"
218         }
219         -re ".*$gdb_prompt $" {
220             fail "ptype AD"
221         }
222         timeout {
223             fail "ptype AD (timeout)"
224         }
225     }
226
227     send_gdb "ptype D\n"
228     gdb_expect {
229         -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 $" {
230             pass "ptype D"
231         }
232         -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 $" {
233             pass "ptype D"
234         }
235         -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 $" {
236             pass "ptype D (aCC)"
237         }
238         -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 $" {
239             pass "ptype D (obsolescent gcc or gdb)"
240         }
241         -re ".*$gdb_prompt $" {
242             fail "ptype D"
243         }
244         timeout {
245             fail "ptype D (timeout)"
246         }
247     }
248
249     send_gdb "ptype E\n"
250     gdb_expect {
251         -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 $" {
252             pass "ptype E"
253         }
254         -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 $" {
255             pass "ptype E"
256         }
257         -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 $" {
258             pass "ptype E (aCC)"
259         }
260         -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 $" {
261             pass "ptype E (obsolescent gcc or gdb)"
262         }
263         -re ".*$gdb_prompt $" {
264             fail "ptype E"
265         }
266         timeout {
267             fail "ptype E (timeout)"
268         }
269     }
270
271     send_gdb "ptype dd\n"
272     gdb_expect {
273         -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 $" {
274             pass "ptype dd"
275         }
276         -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 $" {
277             pass "ptype dd"
278         }
279         -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 $" {
280             pass "ptype dd (aCC)"
281         }
282         -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 $" {
283             pass "ptype dd (obsolescent gcc or gdb)"
284         }
285         -re ".*$gdb_prompt $" {
286             fail "ptype dd"
287         }
288         timeout {
289             fail "ptype dd (timeout)"
290         }
291     }
292
293     send_gdb "ptype ppd\n"
294     gdb_expect {
295         -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 $" {
296             pass "ptype ppd"
297         }
298         -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 $" {
299             pass "ptype ppd"
300         }
301         -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 $" {
302             pass "ptype ppd (aCC)"
303         }
304         -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 $" {
305             pass "ptype ppd (obsolescent gcc or gdb)"
306         }
307         -re ".*$gdb_prompt $" {
308             fail "ptype ppd"
309         }
310         timeout {
311             fail "ptype ppd (timeout)"
312         }
313     }
314
315     send_gdb "ptype pAd\n"
316     gdb_expect {
317         -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 $" {
318             pass "ptype pAd"
319         }
320         -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
321             pass "ptype pAd (aCC)"
322         }
323         -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 $" {
324             pass "ptype pAd (obsolescent gcc or gdb)"
325         }
326         -re ".*$gdb_prompt $" {
327             fail "ptype pAd"
328         }
329         timeout {
330             fail "ptype pAd (timeout)"
331         }
332     }
333
334     send_gdb "ptype a\n"
335     gdb_expect {
336         -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 $" {
337             pass "ptype a"
338         }
339         -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 $" {
340             pass "ptype a"
341         }
342         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
343             pass "ptype a (aCC)"
344         }
345         -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 $" {
346             pass "ptype a (obsolescent gcc or gdb)"
347         }
348         -re ".*$gdb_prompt $" {
349             fail "ptype a"
350         }
351         timeout {
352             fail "ptype a (timeout)"
353         }
354     }
355
356     send_gdb "ptype b\n"
357     gdb_expect {
358         -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 $" {
359             pass "ptype b"
360         }
361         -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 $" {
362             pass "ptype b"
363         }
364         -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
365             pass "ptype b (aCC)"
366         }
367         -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 $" {
368             pass "ptype b (obsolescent gcc or gdb)"
369         }
370         -re ".*$gdb_prompt $" {
371             fail "ptype b"
372         }
373         timeout {
374             fail "ptype b (timeout)"
375         }
376     }
377
378     send_gdb "ptype c\n"
379     gdb_expect {
380         -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 $" {
381             pass "ptype c"
382         }
383         -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 $" {
384             pass "ptype c"
385         }
386         -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
387             pass "ptype c (aCC)"
388         }
389         -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 $" {
390             pass "ptype c (obsolescent gcc or gdb)"
391         }
392         -re ".*$gdb_prompt $" {
393             fail "ptype c"
394         }
395         timeout {
396             fail "ptype c (timeout)"
397         }
398     }
399
400     send_gdb "ptype d\n"
401     gdb_expect {
402         -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 $" {
403             pass "ptype d"
404         }
405         -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 $" {
406             pass "ptype d"
407         }
408         -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 $" {
409             pass "ptype d (aCC)"
410         }
411         -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 $" {
412             pass "ptype d (obsolescent gcc or gdb)"
413         }
414         -re ".*$gdb_prompt $" {
415             fail "ptype d"
416         }
417         timeout {
418             fail "ptype d (timeout)"
419         }
420     }
421
422     send_gdb "ptype e\n"
423     gdb_expect {
424         -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 $" {
425             pass "ptype e"
426         }
427         -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 $" {
428             pass "ptype e"
429         }
430         -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 $" {
431             pass "ptype e (aCC)"
432         }
433         -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 $" {
434             pass "ptype e (obsolescent gcc or gdb)"
435         }
436         -re ".*$gdb_prompt $" {
437             fail "ptype e"
438         }
439         timeout {
440             fail "ptype e (timeout)"
441         }
442     }
443
444     send_gdb "ptype v\n"
445     gdb_expect {
446         -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 $" {
447             pass "ptype v"
448         }
449         -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 $" {
450             pass "ptype v (aCC)"
451         }
452         -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 $" {
453             pass "ptype v (obsolescent gcc or gdb)"
454         }
455         -re ".*$gdb_prompt $" {
456             fail "ptype v"
457         }
458         timeout {
459             fail "ptype v (timeout)"
460         }
461     }
462
463     send_gdb "ptype vb\n"
464     gdb_expect {
465         -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 $" {
466             pass "ptype vb"
467         }
468         -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
469             pass "ptype vb (aCC)"
470         }
471         -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 $" {
472             pass "ptype vb (obsolescent gcc or gdb)"
473         }
474         -re ".*$gdb_prompt $" {
475             fail "ptype vb"
476         }
477         timeout {
478             fail "ptype vb (timeout)"
479         }
480     }
481
482     send_gdb "ptype pAa\n"
483     gdb_expect {
484         -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 $" {
485             pass "ptype pAa"
486         }
487         -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 $" {
488             pass "ptype pAa"
489         }
490         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
491             pass "ptype pAa (aCC)"
492         }
493         -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 $" {
494             pass "ptype pAa (obsolescent gcc or gdb)"
495         }
496         -re ".*$gdb_prompt $" {
497             fail "ptype pAa"
498         }
499         timeout {
500             fail "ptype pAa (timeout)"
501         }
502     }
503
504     send_gdb "ptype pAe\n"
505     gdb_expect {
506         -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 $" {
507             pass "ptype pAe"
508         }
509         -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 $" {
510             pass "ptype pAe"
511         }
512         -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
513             pass "ptype pAe (aCC)"
514         }
515         -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 $" {
516             pass "ptype pAe (obsolescent gcc or gdb)"
517         }
518         -re ".*$gdb_prompt $" {
519             fail "ptype pAe"
520         }
521         timeout {
522             fail "ptype pAe (timeout)"
523         }
524     }
525
526     send_gdb "ptype pBe\n"
527     gdb_expect {
528         -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 $" {
529             pass "ptype pBe"
530         }
531         -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 $" {
532             pass "ptype pBe"
533         }
534         -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
535             pass "ptype pBe (aCC)"
536         }
537         -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 $" {
538             pass "ptype pBe (obsolescent gcc or gdb)"
539         }
540         -re ".*$gdb_prompt $" {
541             fail "ptype pBe"
542         }
543         timeout {
544             fail "ptype pBe (timeout)"
545         }
546     }
547
548     send_gdb "ptype pDd\n"
549     gdb_expect {
550         -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 $" {
551             pass "ptype pDd"
552         }
553         -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 $" {
554             pass "ptype pDd"
555         }
556         -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 $" {
557             pass "ptype pDd (aCC)"
558         }
559         -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 $" {
560             pass "ptype pDd (obsolescent gcc or gdb)"
561         }
562         -re ".*$gdb_prompt $" {
563             fail "ptype pDd"
564         }
565         timeout {
566             fail "ptype pDd (timeout)"
567         }
568     }
569
570     send_gdb "ptype pDe\n"
571     gdb_expect {
572         -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 $" {
573             pass "ptype pDe"
574         }
575         -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 $" {
576             pass "ptype pDe"
577         }
578         -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 $" {
579             pass "ptype pDe (aCC)"
580         }
581         -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 $" {
582             pass "ptype pDe (obsolescent gcc or gdb)"
583         }
584         -re ".*$gdb_prompt $" {
585             fail "ptype pDe"
586         }
587         timeout {
588             fail "ptype pDe (timeout)"
589         }
590     }
591
592     send_gdb "ptype pVa\n"
593     gdb_expect {
594         -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 $" {
595             pass "ptype pVa"
596         }
597         -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 $" {
598             pass "ptype pVa (aCC)"
599         }
600         -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 $" {
601             pass "ptype pVa (obsolescent gcc or gdb)"
602         }
603         -re ".*$gdb_prompt $" {
604             fail "ptype pVa"
605         }
606         timeout {
607             fail "ptype pVa (timeout)"
608         }
609     }
610
611     send_gdb "ptype pVv\n"
612     gdb_expect {
613         -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 $" {
614             pass "ptype pVv"
615         }
616         -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 $" {
617             pass "ptype pVv (aCC)"
618         }
619         -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 $" {
620             pass "ptype pVv (obsolescent gcc or gdb)"
621         }
622         -re ".*$gdb_prompt $" {
623             fail "ptype pVv"
624         }
625         timeout {
626             fail "ptype pVv (timeout)"
627         }
628     }
629
630     send_gdb "ptype pVe\n"
631     gdb_expect {
632         -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 $" {
633             pass "ptype pVe"
634         }
635         -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 $" {
636             pass "ptype pVe (aCC)"
637         }
638         -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 $" {
639             pass "ptype pVe (obsolescent gcc or gdb)"
640         }
641         -re ".*$gdb_prompt $" {
642             fail "ptype pVe"
643         }
644         timeout {
645             fail "ptype pVe (timeout)"
646         }
647     }
648
649     send_gdb "ptype pVd\n"
650     gdb_expect {
651         -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 $" {
652             pass "ptype pVd"
653         }
654         -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 $" {
655             pass "ptype pVd (aCC)"
656         }
657         -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 $" {
658             pass "ptype pVd (obsolescent gcc or gdb)"
659         }
660         -re ".*$gdb_prompt $" {
661             fail "ptype pVd"
662         }
663         timeout {
664             fail "ptype pVd (timeout)"
665         }
666     }
667
668     send_gdb "ptype pADe\n"
669     gdb_expect {
670         -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 $" {
671             pass "ptype pADe"
672         }
673         -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
674             pass "ptype pADe (aCC)"
675         }
676         -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 $" {
677             pass "ptype pADe (obsolescent gcc or gdb)"
678         }
679         -re ".*$gdb_prompt $" {
680             fail "ptype pADe"
681         }
682         timeout {
683             fail "ptype pADe (timeout)"
684         }
685     }
686
687     send_gdb "ptype pEe\n"
688     gdb_expect {
689         -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 $" {
690             pass "ptype pEe"
691         }
692         -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 $" {
693             pass "ptype pEe"
694         }
695         -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 $" {
696             pass "ptype pEe (aCC)"
697         }
698         -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 $" {
699             pass "ptype pEe (obsolescent gcc or gdb)"
700         }
701         -re ".*$gdb_prompt $" {
702             fail "ptype pEe"
703         }
704         timeout {
705             fail "ptype pEe (timeout)"
706         }
707     }
708
709     send_gdb "ptype pVB\n"
710     gdb_expect {
711         -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 $" {
712             pass "ptype pVB"
713         }
714         -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
715             pass "ptype pVB (aCC)"
716         }
717         -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 $" {
718             pass "ptype pVB (obsolescent gcc or gdb)"
719         }
720         -re ".*$gdb_prompt $" {
721             fail "ptype pVB"
722         }
723         timeout {
724             fail "ptype pVB (timeout)"
725         }
726     }
727 }
728
729 #
730 #  Test calling of virtual functions.
731 #
732
733 proc test_virtual_calls {} {
734     global gdb_prompt
735     global GDB
736     global nl
737     global gcc_compiled
738
739     if [target_info exists gdb,cannot_call_functions] {
740         setup_xfail "*-*-*" 2416
741         fail "This target can not call functions"
742         return 0
743     }
744
745     send_gdb "print pAe->f()\n"
746     gdb_expect {
747         -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
748         -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
749             fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
750             return 0
751         }
752         -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
753             fail "print pAe->f() \
754 (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
755             return 0
756         }
757         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
758             setup_xfail hppa*-*-* CLLbs16899
759             fail "print pAe->f()"
760         }
761         -re ".*$gdb_prompt $" { fail "print pAe->f()" }
762         timeout { fail "print pAe->f() (timeout)" }
763         eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
764     }
765
766     send_gdb "print pAa->f()\n"
767     gdb_expect {
768         -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
769         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
770             setup_xfail hppa*-*-*  CLLbs16899
771             fail "print pAa->f()"
772         }
773         -re ".*$gdb_prompt $" { fail "print pAa->f()" }
774         timeout { fail "print pAa->f() (timeout)" }
775         eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
776     }
777
778     send_gdb "print pDe->vg()\n"
779     gdb_expect {
780         -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
781         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
782             setup_xfail hppa*-*-*  CLLbs16899
783             fail "print pDe->vg()"
784         }
785         -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
786         timeout { fail "print pDe->vg() (timeout)" }
787         eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
788     }
789
790     send_gdb "print pADe->vg()\n"
791     gdb_expect {
792         -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
793         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
794             setup_xfail hppa*-*-*  CLLbs16899
795             fail "print pADe->vg()"
796         }
797         -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
798         timeout { fail "print pADe->vg() (timeout)" }
799         eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
800     }
801
802     send_gdb "print pDd->vg()\n"
803     gdb_expect {
804         -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
805         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
806             setup_xfail hppa*-*-*  CLLbs16899
807             fail "print pDd->vg()"
808         }
809         -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
810         timeout { fail "print pDd->vg() (timeout)" }
811         eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
812     }
813
814     send_gdb "print pEe->vvb()\n"
815     gdb_expect {
816         -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
817         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
818             setup_xfail hppa*-*-*  CLLbs16899
819             fail "print pEe->vvb()"
820         }
821         -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
822         timeout { fail "print pEe->vvb() (timeout)" }
823         eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
824     }
825
826     send_gdb "print pVB->vvb()\n"
827     gdb_expect {
828         -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
829         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
830             setup_xfail hppa*-*-*  CLLbs16899
831             fail "print pVB->vvb()"
832         }
833         -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
834         timeout { fail "print pVB->vvb() (timeout)" }
835         eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
836     }
837
838     send_gdb "print pBe->vvb()\n"
839     gdb_expect {
840         -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
841         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
842             setup_xfail hppa*-*-*  CLLbs16899
843             fail "print pBe->vvb()"
844         }
845         -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
846         timeout { fail "print pBe->vvb() (timeout)" }
847         eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
848     }
849
850     send_gdb "print pDe->vvb()\n"
851     gdb_expect {
852         -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
853         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
854             setup_xfail hppa*-*-*  CLLbs16899
855             fail "print pDe->vvb()"
856         }
857         -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
858         timeout { fail "print pDe->vvb() (timeout)" }
859         eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
860     }
861
862     send_gdb "print pEe->vd()\n"
863     gdb_expect {
864         -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
865         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
866             setup_xfail hppa*-*-*  CLLbs16899
867             fail "print pEe->vd()"
868         }
869         -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
870         timeout { fail "print pEe->vd() (timeout)" }
871         eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
872     }
873
874     send_gdb "print pEe->fvb()\n"
875     gdb_expect {
876         -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
877         -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
878             setup_xfail hppa*-*-*  CLLbs16899
879             fail "print pEe->fvb()"
880         }
881         -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
882         timeout { fail "print pEe->fvb() (timeout)" }
883         eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
884     }
885
886     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
887     # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2.
888     #
889     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
890     # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gstabs+.
891     #
892     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
893     # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gdwarf-2.
894     #
895     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
896     # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gstabs+.
897     #
898     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
899     # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gdwarf-2.
900     #
901     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
902     # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gstabs+.
903     #
904     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
905     # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gdwarf-2.
906     #
907     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
908     # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gstabs+.
909     #
910     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
911     # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gdwarf-2.
912     #
913     # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
914     # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gstabs+.
915     #
916     # -- chastain 2002-02-20
917
918     send_gdb "print pEe->D::vg()\n"
919     gdb_expect {
920         -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
921         -re "Attempt to take address of value not located in memory.\r\n$gdb_prompt $"
922         { kfail "gdb/1064" "print pEe->D::vg()" }
923         -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
924         timeout { fail "print pEe->D::vg() (timeout)" }
925         eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
926     }
927 }
928
929 proc do_tests {} {
930     global prms_id
931     global bug_id
932
933     set prms_id 0
934     set bug_id 0
935
936     gdb_start;
937     gdb_virtfunc_init;
938
939     runto_main
940
941     test_ptype_of_classes
942
943     if [ runto 'test_calls' ] then {
944         test_virtual_calls
945     }
946 }
947
948 do_tests