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