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