1 # Copyright (C) 1992, 1994, 1997, 1999 Free Software Foundation, Inc.
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.
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.
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.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Fred Fish. (fnf@cygnus.com)
29 if { [skip_cplus_tests] } { continue }
31 set testfile "virtfunc"
32 set srcfile ${testfile}.cc
33 set binfile ${objdir}/${subdir}/${testfile}
35 if [get_compiler_info ${binfile} "c++"] {
41 set src "${srcdir}/${subdir}/${srcfile}"
42 if { [gdb_compile "${src}" "${binfile}" executable {c++ debug}] != "" } {
43 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
46 proc gdb_virtfunc_init {} {
47 global srcdir subdir binfile
50 gdb_reinitialize_dir $srcdir/$subdir
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 $"
59 proc gdb_virtfunc_restart {} {
63 runto 'test_calls(void)';
67 # Test printing of the types of various classes.
70 proc test_ptype_of_classes {} {
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".
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 $" {
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)"
86 -re ".*$gdb_prompt $" {
90 fail "ptype VA (timeout)"
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 $" {
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)"
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)"
105 -re ".*$gdb_prompt $" {
109 fail "ptype VB (timeout)"
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 $" {
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 $" {
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)"
124 -re ".*$gdb_prompt $" {
128 fail "ptype V (timeout)"
134 -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 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
140 -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 $" {
141 pass "ptype A (obsolescent gcc or gdb)"
143 -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 $" {
144 # This happens because the type is defined only after it is
146 fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
147 # Many of the rest of these tests have the same problem.
150 -re ".*$gdb_prompt $" {
154 fail "ptype A (timeout)"
160 -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 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
166 -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 $" {
167 pass "ptype B (obsolescent gcc or gdb)"
169 -re ".*$gdb_prompt $" {
173 fail "ptype B (timeout)"
179 -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 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
185 -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 $" {
186 pass "ptype C (obsolescent gcc or gdb)"
188 -re ".*$gdb_prompt $" {
192 fail "ptype C (timeout)"
196 send_gdb "ptype AD\n"
198 -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 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" {
202 pass "ptype AD (aCC)"
204 -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 $" {
205 pass "ptype AD (obsolescent gcc or gdb)"
207 -re ".*$gdb_prompt $" {
211 fail "ptype AD (timeout)"
217 -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 -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 -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 $" {
224 pass "ptype D (obsolescent gcc or gdb)"
226 -re ".*$gdb_prompt $" {
230 fail "ptype D (timeout)"
236 -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 -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 -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 $" {
243 pass "ptype E (obsolescent gcc or gdb)"
245 -re ".*$gdb_prompt $" {
249 fail "ptype E (timeout)"
253 send_gdb "ptype dd\n"
255 -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 -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 $" {
259 pass "ptype dd (aCC)"
261 -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 $" {
262 pass "ptype dd (obsolescent gcc or gdb)"
264 -re ".*$gdb_prompt $" {
268 fail "ptype dd (timeout)"
272 send_gdb "ptype ppd\n"
274 -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 -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 $" {
278 pass "ptype ppd (aCC)"
280 -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 $" {
281 pass "ptype ppd (obsolescent gcc or gdb)"
283 -re ".*$gdb_prompt $" {
287 fail "ptype ppd (timeout)"
291 send_gdb "ptype pAd\n"
293 -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 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
297 pass "ptype pAd (aCC)"
299 -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 $" {
300 pass "ptype pAd (obsolescent gcc or gdb)"
302 -re ".*$gdb_prompt $" {
306 fail "ptype pAd (timeout)"
312 -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 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
318 -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 $" {
319 pass "ptype a (obsolescent gcc or gdb)"
321 -re ".*$gdb_prompt $" {
325 fail "ptype a (timeout)"
331 -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 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
337 -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 $" {
338 pass "ptype b (obsolescent gcc or gdb)"
340 -re ".*$gdb_prompt $" {
344 fail "ptype b (timeout)"
350 -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 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
356 -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 $" {
357 pass "ptype c (obsolescent gcc or gdb)"
359 -re ".*$gdb_prompt $" {
363 fail "ptype c (timeout)"
369 -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 -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 -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 $" {
376 pass "ptype d (obsolescent gcc or gdb)"
378 -re ".*$gdb_prompt $" {
382 fail "ptype d (timeout)"
388 -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 -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 -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 $" {
395 pass "ptype e (obsolescent gcc or gdb)"
397 -re ".*$gdb_prompt $" {
401 fail "ptype e (timeout)"
407 -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 -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 -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 $" {
414 pass "ptype v (obsolescent gcc or gdb)"
416 -re ".*$gdb_prompt $" {
420 fail "ptype v (timeout)"
424 send_gdb "ptype vb\n"
426 -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 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}$nl$gdb_prompt $" {
430 pass "ptype vb (aCC)"
432 -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 $" {
433 pass "ptype vb (obsolescent gcc or gdb)"
435 -re ".*$gdb_prompt $" {
439 fail "ptype vb (timeout)"
443 send_gdb "ptype pAa\n"
445 -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 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
449 pass "ptype pAa (aCC)"
451 -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 $" {
452 pass "ptype pAa (obsolescent gcc or gdb)"
454 -re ".*$gdb_prompt $" {
458 fail "ptype pAa (timeout)"
462 send_gdb "ptype pAe\n"
464 -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 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
468 pass "ptype pAe (aCC)"
470 -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 $" {
471 pass "ptype pAe (obsolescent gcc or gdb)"
473 -re ".*$gdb_prompt $" {
477 fail "ptype pAe (timeout)"
481 send_gdb "ptype pBe\n"
483 -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 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
487 pass "ptype pBe (aCC)"
489 -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 $" {
490 pass "ptype pBe (obsolescent gcc or gdb)"
492 -re ".*$gdb_prompt $" {
496 fail "ptype pBe (timeout)"
500 send_gdb "ptype pDd\n"
502 -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 -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 $" {
506 pass "ptype pDd (aCC)"
508 -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 $" {
509 pass "ptype pDd (obsolescent gcc or gdb)"
511 -re ".*$gdb_prompt $" {
515 fail "ptype pDd (timeout)"
519 send_gdb "ptype pDe\n"
521 -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 -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 $" {
525 pass "ptype pDe (aCC)"
527 -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 $" {
528 pass "ptype pDe (obsolescent gcc or gdb)"
530 -re ".*$gdb_prompt $" {
534 fail "ptype pDe (timeout)"
538 send_gdb "ptype pVa\n"
540 -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 -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 $" {
544 pass "ptype pVa (aCC)"
546 -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 $" {
547 pass "ptype pVa (obsolescent gcc or gdb)"
549 -re ".*$gdb_prompt $" {
553 fail "ptype pVa (timeout)"
557 send_gdb "ptype pVv\n"
559 -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 -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 $" {
563 pass "ptype pVv (aCC)"
565 -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 $" {
566 pass "ptype pVv (obsolescent gcc or gdb)"
568 -re ".*$gdb_prompt $" {
572 fail "ptype pVv (timeout)"
576 send_gdb "ptype pVe\n"
578 -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 -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 $" {
582 pass "ptype pVe (aCC)"
584 -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 $" {
585 pass "ptype pVe (obsolescent gcc or gdb)"
587 -re ".*$gdb_prompt $" {
591 fail "ptype pVe (timeout)"
595 send_gdb "ptype pVd\n"
597 -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 -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 $" {
601 pass "ptype pVd (aCC)"
603 -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 $" {
604 pass "ptype pVd (obsolescent gcc or gdb)"
606 -re ".*$gdb_prompt $" {
610 fail "ptype pVd (timeout)"
614 send_gdb "ptype pADe\n"
616 -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 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
620 pass "ptype pADe (aCC)"
622 -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 $" {
623 pass "ptype pADe (obsolescent gcc or gdb)"
625 -re ".*$gdb_prompt $" {
629 fail "ptype pADe (timeout)"
633 send_gdb "ptype pEe\n"
635 -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 -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 $" {
639 pass "ptype pEe (aCC)"
641 -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 $" {
642 pass "ptype pEe (obsolescent gcc or gdb)"
644 -re ".*$gdb_prompt $" {
648 fail "ptype pEe (timeout)"
652 send_gdb "ptype pVB\n"
654 -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 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
658 pass "ptype pVB (aCC)"
660 -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 $" {
661 pass "ptype pVB (obsolescent gcc or gdb)"
663 -re ".*$gdb_prompt $" {
667 fail "ptype pVB (timeout)"
673 # Test calling of virtual functions.
676 proc test_virtual_calls {} {
682 if [target_info exists gdb,cannot_call_functions] {
683 setup_xfail "*-*-*" 2416
684 fail "This target can not call functions"
688 # FIXME: In fall 1998, GCC's virtual function type info was changed,
689 # which causes GDB to be unable to resolve these calls. Until the
690 # problem is fixed, XFAIL these tests. -sts 1999-08-02
692 if {$gcc_compiled} then { setup_xfail "*-*-*" }
694 send_gdb "print pAe->f()\n"
696 -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
697 -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
698 fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
701 -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
702 fail "print pAe->f() \
703 (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
706 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
707 setup_xfail hppa*-*-* CLLbs16899
708 fail "print pAe->f()"
710 -re ".*$gdb_prompt $" { fail "print pAe->f()" }
711 timeout { fail "print pAe->f() (timeout)" }
712 eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
715 if {$gcc_compiled} then { setup_xfail "*-*-*" }
717 send_gdb "print pAa->f()\n"
719 -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
720 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
721 setup_xfail hppa*-*-* CLLbs16899
722 fail "print pAa->f()"
724 -re ".*$gdb_prompt $" { fail "print pAa->f()" }
725 timeout { fail "print pAa->f() (timeout)" }
726 eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
729 if {$gcc_compiled} then { setup_xfail "*-*-*" }
731 send_gdb "print pDe->vg()\n"
733 -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
734 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
735 setup_xfail hppa*-*-* CLLbs16899
736 fail "print pDe->vg()"
738 -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
739 timeout { fail "print pDe->vg() (timeout)" }
740 eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
743 if {$gcc_compiled} then { setup_xfail "*-*-*" }
745 send_gdb "print pADe->vg()\n"
747 -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
748 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
749 setup_xfail hppa*-*-* CLLbs16899
750 fail "print pADe->vg()"
752 -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
753 timeout { fail "print pADe->vg() (timeout)" }
754 eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
757 if {$gcc_compiled} then { setup_xfail "*-*-*" }
759 send_gdb "print pDd->vg()\n"
761 -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
762 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
763 setup_xfail hppa*-*-* CLLbs16899
764 fail "print pDd->vg()"
766 -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
767 timeout { fail "print pDd->vg() (timeout)" }
768 eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
771 if {$gcc_compiled} then { setup_xfail "*-*-*" }
773 send_gdb "print pEe->vvb()\n"
775 -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
776 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
777 setup_xfail hppa*-*-* CLLbs16899
778 fail "print pEe->vvb()"
780 -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
781 timeout { fail "print pEe->vvb() (timeout)" }
782 eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
785 if {$gcc_compiled} then { setup_xfail "*-*-*" }
787 send_gdb "print pVB->vvb()\n"
789 -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
790 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
791 setup_xfail hppa*-*-* CLLbs16899
792 fail "print pVB->vvb()"
794 -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
795 timeout { fail "print pVB->vvb() (timeout)" }
796 eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
799 if {$gcc_compiled} then { setup_xfail "*-*-*" }
801 send_gdb "print pBe->vvb()\n"
803 -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
804 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
805 setup_xfail hppa*-*-* CLLbs16899
806 fail "print pBe->vvb()"
808 -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
809 timeout { fail "print pBe->vvb() (timeout)" }
810 eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
813 if {$gcc_compiled} then { setup_xfail "*-*-*" }
815 send_gdb "print pDe->vvb()\n"
817 -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
818 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
819 setup_xfail hppa*-*-* CLLbs16899
820 fail "print pDe->vvb()"
822 -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
823 timeout { fail "print pDe->vvb() (timeout)" }
824 eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
827 if {$gcc_compiled} then { setup_xfail "*-*-*" }
829 send_gdb "print pEe->vd()\n"
831 -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
832 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
833 setup_xfail hppa*-*-* CLLbs16899
834 fail "print pEe->vd()"
836 -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
837 timeout { fail "print pEe->vd() (timeout)" }
838 eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
841 if {$gcc_compiled} then { setup_xfail "*-*-*" }
843 send_gdb "print pEe->fvb()\n"
845 -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
846 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
847 setup_xfail hppa*-*-* CLLbs16899
848 fail "print pEe->fvb()"
850 -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
851 timeout { fail "print pEe->fvb() (timeout)" }
852 eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
855 if {$gcc_compiled} then { setup_xfail "*-*-*" }
857 send_gdb "print pEe->D::vg()\n"
860 -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
861 -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
862 timeout { fail "print pEe->D::vg() (timeout)" }
863 eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
877 # Get the debug format for the compiled test case. If that
878 # format is DWARF 1 then just skip all the tests since none of
881 if [ runto_main ] then {
883 if [ setup_xfail_format "DWARF 1" ] then {
884 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
890 test_ptype_of_classes
892 if [ runto 'test_calls(void)' ] then {