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