1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001
2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Please email any bugs, comments, and/or additions to this file to:
19 # bug-gdb@prep.ai.mit.edu
21 # This file was written by Fred Fish. (fnf@cygnus.com)
30 if { [skip_cplus_tests] } { continue }
32 set testfile "virtfunc"
33 set srcfile ${testfile}.cc
34 set binfile ${objdir}/${subdir}/${testfile}
36 if [get_compiler_info ${binfile} "c++"] {
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."
47 proc gdb_virtfunc_init {} {
48 global srcdir subdir binfile
51 gdb_reinitialize_dir $srcdir/$subdir
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 $"
60 proc gdb_virtfunc_restart {} {
68 # Test printing of the types of various classes.
71 proc test_ptype_of_classes {} {
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".
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 $" {
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)"
87 -re ".*$gdb_prompt $" {
91 fail "ptype VA (timeout)"
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 $" {
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)"
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)"
106 -re ".*$gdb_prompt $" {
110 fail "ptype VB (timeout)"
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 $" {
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 $" {
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)"
125 -re ".*$gdb_prompt $" {
129 fail "ptype V (timeout)"
133 # The format of a g++ virtual base pointer.
134 set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"
138 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
141 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
144 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
145 pass "ptype A (obsolescent gcc or gdb)"
147 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}$nl$gdb_prompt $" {
148 # This happens because the type is defined only after it is
150 fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
151 # Many of the rest of these tests have the same problem.
154 -re ".*$gdb_prompt $" {
158 fail "ptype A (timeout)"
164 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
167 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
170 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
171 pass "ptype B (obsolescent gcc or gdb)"
173 -re ".*$gdb_prompt $" {
177 fail "ptype B (timeout)"
183 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
186 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
189 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
190 pass "ptype C (obsolescent gcc or gdb)"
192 -re ".*$gdb_prompt $" {
196 fail "ptype C (timeout)"
200 send_gdb "ptype AD\n"
202 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\}$nl$gdb_prompt $" {
205 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" {
206 pass "ptype AD (aCC)"
208 -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
209 pass "ptype AD (obsolescent gcc or gdb)"
211 -re ".*$gdb_prompt $" {
215 fail "ptype AD (timeout)"
221 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
224 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
227 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
228 pass "ptype D (obsolescent gcc or gdb)"
230 -re ".*$gdb_prompt $" {
234 fail "ptype D (timeout)"
240 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
243 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
246 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
247 pass "ptype E (obsolescent gcc or gdb)"
249 -re ".*$gdb_prompt $" {
253 fail "ptype E (timeout)"
257 send_gdb "ptype dd\n"
259 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
262 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
263 pass "ptype dd (aCC)"
265 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
266 pass "ptype dd (obsolescent gcc or gdb)"
268 -re ".*$gdb_prompt $" {
272 fail "ptype dd (timeout)"
276 send_gdb "ptype ppd\n"
278 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
281 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
282 pass "ptype ppd (aCC)"
284 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
285 pass "ptype ppd (obsolescent gcc or gdb)"
287 -re ".*$gdb_prompt $" {
291 fail "ptype ppd (timeout)"
295 send_gdb "ptype pAd\n"
297 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
300 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
301 pass "ptype pAd (aCC)"
303 -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
304 pass "ptype pAd (obsolescent gcc or gdb)"
306 -re ".*$gdb_prompt $" {
310 fail "ptype pAd (timeout)"
316 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
319 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
322 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
323 pass "ptype a (obsolescent gcc or gdb)"
325 -re ".*$gdb_prompt $" {
329 fail "ptype a (timeout)"
335 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
338 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
341 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
342 pass "ptype b (obsolescent gcc or gdb)"
344 -re ".*$gdb_prompt $" {
348 fail "ptype b (timeout)"
354 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
357 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
360 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
361 pass "ptype c (obsolescent gcc or gdb)"
363 -re ".*$gdb_prompt $" {
367 fail "ptype c (timeout)"
373 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
376 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
379 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
380 pass "ptype d (obsolescent gcc or gdb)"
382 -re ".*$gdb_prompt $" {
386 fail "ptype d (timeout)"
392 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
395 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
398 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
399 pass "ptype e (obsolescent gcc or gdb)"
401 -re ".*$gdb_prompt $" {
405 fail "ptype e (timeout)"
411 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
414 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
417 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
418 pass "ptype v (obsolescent gcc or gdb)"
420 -re ".*$gdb_prompt $" {
424 fail "ptype v (timeout)"
428 send_gdb "ptype vb\n"
430 -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}$nl$gdb_prompt $" {
433 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}$nl$gdb_prompt $" {
434 pass "ptype vb (aCC)"
436 -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
437 pass "ptype vb (obsolescent gcc or gdb)"
439 -re ".*$gdb_prompt $" {
443 fail "ptype vb (timeout)"
447 send_gdb "ptype pAa\n"
449 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
452 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
453 pass "ptype pAa (aCC)"
455 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
456 pass "ptype pAa (obsolescent gcc or gdb)"
458 -re ".*$gdb_prompt $" {
462 fail "ptype pAa (timeout)"
466 send_gdb "ptype pAe\n"
468 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
471 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
472 pass "ptype pAe (aCC)"
474 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
475 pass "ptype pAe (obsolescent gcc or gdb)"
477 -re ".*$gdb_prompt $" {
481 fail "ptype pAe (timeout)"
485 send_gdb "ptype pBe\n"
487 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
490 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
491 pass "ptype pBe (aCC)"
493 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
494 pass "ptype pBe (obsolescent gcc or gdb)"
496 -re ".*$gdb_prompt $" {
500 fail "ptype pBe (timeout)"
504 send_gdb "ptype pDd\n"
506 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
509 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
510 pass "ptype pDd (aCC)"
512 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
513 pass "ptype pDd (obsolescent gcc or gdb)"
515 -re ".*$gdb_prompt $" {
519 fail "ptype pDd (timeout)"
523 send_gdb "ptype pDe\n"
525 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
528 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
529 pass "ptype pDe (aCC)"
531 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
532 pass "ptype pDe (obsolescent gcc or gdb)"
534 -re ".*$gdb_prompt $" {
538 fail "ptype pDe (timeout)"
542 send_gdb "ptype pVa\n"
544 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
547 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
548 pass "ptype pVa (aCC)"
550 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
551 pass "ptype pVa (obsolescent gcc or gdb)"
553 -re ".*$gdb_prompt $" {
557 fail "ptype pVa (timeout)"
561 send_gdb "ptype pVv\n"
563 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
566 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
567 pass "ptype pVv (aCC)"
569 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
570 pass "ptype pVv (obsolescent gcc or gdb)"
572 -re ".*$gdb_prompt $" {
576 fail "ptype pVv (timeout)"
580 send_gdb "ptype pVe\n"
582 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
585 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
586 pass "ptype pVe (aCC)"
588 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
589 pass "ptype pVe (obsolescent gcc or gdb)"
591 -re ".*$gdb_prompt $" {
595 fail "ptype pVe (timeout)"
599 send_gdb "ptype pVd\n"
601 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
604 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
605 pass "ptype pVd (aCC)"
607 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
608 pass "ptype pVd (obsolescent gcc or gdb)"
610 -re ".*$gdb_prompt $" {
614 fail "ptype pVd (timeout)"
618 send_gdb "ptype pADe\n"
620 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
623 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
624 pass "ptype pADe (aCC)"
626 -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
627 pass "ptype pADe (obsolescent gcc or gdb)"
629 -re ".*$gdb_prompt $" {
633 fail "ptype pADe (timeout)"
637 send_gdb "ptype pEe\n"
639 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
642 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
643 pass "ptype pEe (aCC)"
645 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
646 pass "ptype pEe (obsolescent gcc or gdb)"
648 -re ".*$gdb_prompt $" {
652 fail "ptype pEe (timeout)"
656 send_gdb "ptype pVB\n"
658 -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
661 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
662 pass "ptype pVB (aCC)"
664 -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
665 pass "ptype pVB (obsolescent gcc or gdb)"
667 -re ".*$gdb_prompt $" {
671 fail "ptype pVB (timeout)"
677 # Test calling of virtual functions.
680 proc test_virtual_calls {} {
686 if [target_info exists gdb,cannot_call_functions] {
687 setup_xfail "*-*-*" 2416
688 fail "This target can not call functions"
692 # FIXME: In fall 1998, GCC's virtual function type info was changed,
693 # which causes GDB to be unable to resolve these calls. Until the
694 # problem is fixed, XFAIL these tests. -sts 1999-08-02
696 if {$gcc_compiled} then { setup_xfail "*-*-*" }
698 send_gdb "print pAe->f()\n"
700 -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
701 -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
702 fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
705 -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
706 fail "print pAe->f() \
707 (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
710 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
711 setup_xfail hppa*-*-* CLLbs16899
712 fail "print pAe->f()"
714 -re ".*$gdb_prompt $" { fail "print pAe->f()" }
715 timeout { fail "print pAe->f() (timeout)" }
716 eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
719 if {$gcc_compiled} then { setup_xfail "*-*-*" }
721 send_gdb "print pAa->f()\n"
723 -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
724 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
725 setup_xfail hppa*-*-* CLLbs16899
726 fail "print pAa->f()"
728 -re ".*$gdb_prompt $" { fail "print pAa->f()" }
729 timeout { fail "print pAa->f() (timeout)" }
730 eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
733 if {$gcc_compiled} then { setup_xfail "*-*-*" }
735 send_gdb "print pDe->vg()\n"
737 -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
738 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
739 setup_xfail hppa*-*-* CLLbs16899
740 fail "print pDe->vg()"
742 -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
743 timeout { fail "print pDe->vg() (timeout)" }
744 eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
747 if {$gcc_compiled} then { setup_xfail "*-*-*" }
749 send_gdb "print pADe->vg()\n"
751 -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
752 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
753 setup_xfail hppa*-*-* CLLbs16899
754 fail "print pADe->vg()"
756 -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
757 timeout { fail "print pADe->vg() (timeout)" }
758 eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
761 if {$gcc_compiled} then { setup_xfail "*-*-*" }
763 send_gdb "print pDd->vg()\n"
765 -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
766 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
767 setup_xfail hppa*-*-* CLLbs16899
768 fail "print pDd->vg()"
770 -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
771 timeout { fail "print pDd->vg() (timeout)" }
772 eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
775 if {$gcc_compiled} then { setup_xfail "*-*-*" }
777 send_gdb "print pEe->vvb()\n"
779 -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
780 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
781 setup_xfail hppa*-*-* CLLbs16899
782 fail "print pEe->vvb()"
784 -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
785 timeout { fail "print pEe->vvb() (timeout)" }
786 eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
789 if {$gcc_compiled} then { setup_xfail "*-*-*" }
791 send_gdb "print pVB->vvb()\n"
793 -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
794 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
795 setup_xfail hppa*-*-* CLLbs16899
796 fail "print pVB->vvb()"
798 -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
799 timeout { fail "print pVB->vvb() (timeout)" }
800 eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
803 if {$gcc_compiled} then { setup_xfail "*-*-*" }
805 send_gdb "print pBe->vvb()\n"
807 -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
808 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
809 setup_xfail hppa*-*-* CLLbs16899
810 fail "print pBe->vvb()"
812 -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
813 timeout { fail "print pBe->vvb() (timeout)" }
814 eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
817 if {$gcc_compiled} then { setup_xfail "*-*-*" }
819 send_gdb "print pDe->vvb()\n"
821 -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
822 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
823 setup_xfail hppa*-*-* CLLbs16899
824 fail "print pDe->vvb()"
826 -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
827 timeout { fail "print pDe->vvb() (timeout)" }
828 eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
831 if {$gcc_compiled} then { setup_xfail "*-*-*" }
833 send_gdb "print pEe->vd()\n"
835 -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
836 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
837 setup_xfail hppa*-*-* CLLbs16899
838 fail "print pEe->vd()"
840 -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
841 timeout { fail "print pEe->vd() (timeout)" }
842 eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
845 if {$gcc_compiled} then { setup_xfail "*-*-*" }
847 send_gdb "print pEe->fvb()\n"
849 -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
850 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
851 setup_xfail hppa*-*-* CLLbs16899
852 fail "print pEe->fvb()"
854 -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
855 timeout { fail "print pEe->fvb() (timeout)" }
856 eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
859 if {$gcc_compiled} then { setup_xfail "*-*-*" }
861 send_gdb "print pEe->D::vg()\n"
864 -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
865 -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
866 timeout { fail "print pEe->D::vg() (timeout)" }
867 eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
881 # Get the debug format for the compiled test case. If that
882 # format is DWARF 1 then just skip all the tests since none of
885 if [ runto_main ] then {
887 if [ setup_xfail_format "DWARF 1" ] then {
888 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
894 test_ptype_of_classes
896 if [ runto 'test_calls' ] then {