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