]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.c++/virtfunc.exp
5bc50a2a81b8589d403573ea78016d6dc4acb200
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.c++ / 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 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 send_gdb "print pAe->f()\n"
747 gdb_expect {
748 -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
749 -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
750 fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
751 return 0
752 }
753 -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
754 fail "print pAe->f() \
755 (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
756 return 0
757 }
758 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
759 setup_xfail hppa*-*-* CLLbs16899
760 fail "print pAe->f()"
761 }
762 -re ".*$gdb_prompt $" { fail "print pAe->f()" }
763 timeout { fail "print pAe->f() (timeout)" }
764 eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
765 }
766
767 send_gdb "print pAa->f()\n"
768 gdb_expect {
769 -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
770 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
771 setup_xfail hppa*-*-* CLLbs16899
772 fail "print pAa->f()"
773 }
774 -re ".*$gdb_prompt $" { fail "print pAa->f()" }
775 timeout { fail "print pAa->f() (timeout)" }
776 eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
777 }
778
779 send_gdb "print pDe->vg()\n"
780 gdb_expect {
781 -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
782 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
783 setup_xfail hppa*-*-* CLLbs16899
784 fail "print pDe->vg()"
785 }
786 -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
787 timeout { fail "print pDe->vg() (timeout)" }
788 eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
789 }
790
791 send_gdb "print pADe->vg()\n"
792 gdb_expect {
793 -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
794 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
795 setup_xfail hppa*-*-* CLLbs16899
796 fail "print pADe->vg()"
797 }
798 -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
799 timeout { fail "print pADe->vg() (timeout)" }
800 eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
801 }
802
803 send_gdb "print pDd->vg()\n"
804 gdb_expect {
805 -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
806 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
807 setup_xfail hppa*-*-* CLLbs16899
808 fail "print pDd->vg()"
809 }
810 -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
811 timeout { fail "print pDd->vg() (timeout)" }
812 eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
813 }
814
815 send_gdb "print pEe->vvb()\n"
816 gdb_expect {
817 -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
818 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
819 setup_xfail hppa*-*-* CLLbs16899
820 fail "print pEe->vvb()"
821 }
822 -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
823 timeout { fail "print pEe->vvb() (timeout)" }
824 eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
825 }
826
827 send_gdb "print pVB->vvb()\n"
828 gdb_expect {
829 -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
830 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
831 setup_xfail hppa*-*-* CLLbs16899
832 fail "print pVB->vvb()"
833 }
834 -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
835 timeout { fail "print pVB->vvb() (timeout)" }
836 eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
837 }
838
839 send_gdb "print pBe->vvb()\n"
840 gdb_expect {
841 -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
842 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
843 setup_xfail hppa*-*-* CLLbs16899
844 fail "print pBe->vvb()"
845 }
846 -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
847 timeout { fail "print pBe->vvb() (timeout)" }
848 eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
849 }
850
851 send_gdb "print pDe->vvb()\n"
852 gdb_expect {
853 -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
854 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
855 setup_xfail hppa*-*-* CLLbs16899
856 fail "print pDe->vvb()"
857 }
858 -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
859 timeout { fail "print pDe->vvb() (timeout)" }
860 eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
861 }
862
863 send_gdb "print pEe->vd()\n"
864 gdb_expect {
865 -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
866 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
867 setup_xfail hppa*-*-* CLLbs16899
868 fail "print pEe->vd()"
869 }
870 -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
871 timeout { fail "print pEe->vd() (timeout)" }
872 eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
873 }
874
875 send_gdb "print pEe->fvb()\n"
876 gdb_expect {
877 -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
878 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
879 setup_xfail hppa*-*-* CLLbs16899
880 fail "print pEe->fvb()"
881 }
882 -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
883 timeout { fail "print pEe->fvb() (timeout)" }
884 eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
885 }
886
887 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
888 # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2.
889 #
890 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
891 # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gstabs+.
892 #
893 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
894 # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gdwarf-2.
895 #
896 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
897 # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gstabs+.
898 #
899 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
900 # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gdwarf-2.
901 #
902 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
903 # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gstabs+.
904 #
905 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
906 # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gdwarf-2.
907 #
908 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
909 # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gstabs+.
910 #
911 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
912 # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gdwarf-2.
913 #
914 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
915 # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gstabs+.
916 #
917 # -- chastain 2002-02-20
918
919 if {$gcc_compiled} then { setup_xfail "*-*-*" }
920
921 send_gdb "print pEe->D::vg()\n"
922 setup_xfail "*-*-*"
923 gdb_expect {
924 -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
925 -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
926 timeout { fail "print pEe->D::vg() (timeout)" }
927 eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
928 }
929 }
930
931 proc do_tests {} {
932 global prms_id
933 global bug_id
934
935 set prms_id 0
936 set bug_id 0
937
938 gdb_start;
939 gdb_virtfunc_init;
940
941 # Get the debug format for the compiled test case. If that
942 # format is DWARF 1 then just skip all the tests since none of
943 # them will pass.
944
945 if [ runto_main ] then {
946 get_debug_format
947 if [ setup_xfail_format "DWARF 1" ] then {
948 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
949 return
950 }
951 clear_xfail "*-*-*"
952 }
953
954 test_ptype_of_classes
955
956 if [ runto 'test_calls' ] then {
957 test_virtual_calls
958 }
959 }
960
961 do_tests