1 # Copyright (C) 1992, 1994, 1997 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 set testfile "virtfunc"
30 set srcfile ${testfile}.cc
31 set binfile ${objdir}/${subdir}/${testfile}
33 if [get_compiler_info ${binfile} "c++"] {
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.
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 {} {
64 runto 'test_calls(void)';
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)"
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 $" {
138 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
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)"
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
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.
151 -re ".*$gdb_prompt $" {
155 fail "ptype A (timeout)"
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 $" {
164 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
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)"
170 -re ".*$gdb_prompt $" {
174 fail "ptype B (timeout)"
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 $" {
183 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
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)"
189 -re ".*$gdb_prompt $" {
193 fail "ptype C (timeout)"
197 send_gdb "ptype AD\n"
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 $" {
202 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" {
203 pass "ptype AD (aCC)"
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)"
208 -re ".*$gdb_prompt $" {
212 fail "ptype AD (timeout)"
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 $" {
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 $" {
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)"
227 -re ".*$gdb_prompt $" {
231 fail "ptype D (timeout)"
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 $" {
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 $" {
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)"
246 -re ".*$gdb_prompt $" {
250 fail "ptype E (timeout)"
254 send_gdb "ptype dd\n"
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 $" {
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)"
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)"
265 -re ".*$gdb_prompt $" {
269 fail "ptype dd (timeout)"
273 send_gdb "ptype ppd\n"
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 $" {
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)"
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)"
284 -re ".*$gdb_prompt $" {
288 fail "ptype ppd (timeout)"
292 send_gdb "ptype pAd\n"
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 $" {
297 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
298 pass "ptype pAd (aCC)"
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)"
303 -re ".*$gdb_prompt $" {
307 fail "ptype pAd (timeout)"
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 $" {
316 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
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)"
322 -re ".*$gdb_prompt $" {
326 fail "ptype a (timeout)"
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 $" {
335 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
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)"
341 -re ".*$gdb_prompt $" {
345 fail "ptype b (timeout)"
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 $" {
354 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
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)"
360 -re ".*$gdb_prompt $" {
364 fail "ptype c (timeout)"
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 $" {
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 $" {
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)"
379 -re ".*$gdb_prompt $" {
383 fail "ptype d (timeout)"
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 $" {
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 $" {
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)"
398 -re ".*$gdb_prompt $" {
402 fail "ptype e (timeout)"
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 $" {
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 $" {
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)"
417 -re ".*$gdb_prompt $" {
421 fail "ptype v (timeout)"
425 send_gdb "ptype vb\n"
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 $" {
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)"
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)"
436 -re ".*$gdb_prompt $" {
440 fail "ptype vb (timeout)"
444 send_gdb "ptype pAa\n"
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 $" {
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)"
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)"
455 -re ".*$gdb_prompt $" {
459 fail "ptype pAa (timeout)"
463 send_gdb "ptype pAe\n"
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 $" {
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)"
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)"
474 -re ".*$gdb_prompt $" {
478 fail "ptype pAe (timeout)"
482 send_gdb "ptype pBe\n"
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 $" {
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)"
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)"
493 -re ".*$gdb_prompt $" {
497 fail "ptype pBe (timeout)"
501 send_gdb "ptype pDd\n"
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 $" {
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)"
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)"
512 -re ".*$gdb_prompt $" {
516 fail "ptype pDd (timeout)"
520 send_gdb "ptype pDe\n"
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 $" {
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)"
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)"
531 -re ".*$gdb_prompt $" {
535 fail "ptype pDe (timeout)"
539 send_gdb "ptype pVa\n"
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 $" {
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)"
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)"
550 -re ".*$gdb_prompt $" {
554 fail "ptype pVa (timeout)"
558 send_gdb "ptype pVv\n"
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 $" {
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)"
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)"
569 -re ".*$gdb_prompt $" {
573 fail "ptype pVv (timeout)"
577 send_gdb "ptype pVe\n"
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 $" {
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)"
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)"
588 -re ".*$gdb_prompt $" {
592 fail "ptype pVe (timeout)"
596 send_gdb "ptype pVd\n"
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 $" {
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)"
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)"
607 -re ".*$gdb_prompt $" {
611 fail "ptype pVd (timeout)"
615 send_gdb "ptype pADe\n"
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 $" {
620 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
621 pass "ptype pADe (aCC)"
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)"
626 -re ".*$gdb_prompt $" {
630 fail "ptype pADe (timeout)"
634 send_gdb "ptype pEe\n"
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 $" {
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)"
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)"
645 -re ".*$gdb_prompt $" {
649 fail "ptype pEe (timeout)"
653 send_gdb "ptype pVB\n"
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 $" {
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)"
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)"
664 -re ".*$gdb_prompt $" {
668 fail "ptype pVB (timeout)"
674 # Test calling of virtual functions.
677 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 send_gdb "print pAe->f()\n"
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)"
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)"
700 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
701 setup_xfail hppa*-*-* CLLbs16899
702 fail "print pAe->f()"
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 }
709 send_gdb "print pAa->f()\n"
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()"
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 }
721 send_gdb "print pDe->vg()\n"
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()"
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 }
733 send_gdb "print pADe->vg()\n"
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()"
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 }
745 send_gdb "print pDd->vg()\n"
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()"
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 }
757 send_gdb "print pEe->vvb()\n"
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()"
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 }
769 send_gdb "print pVB->vvb()\n"
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()"
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 }
781 send_gdb "print pBe->vvb()\n"
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()"
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 }
793 send_gdb "print pDe->vvb()\n"
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()"
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 }
805 send_gdb "print pEe->vd()\n"
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()"
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 }
817 send_gdb "print pEe->fvb()\n"
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()"
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 }
829 send_gdb "print pEe->D::vg()\n"
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 }
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
853 if [ runto_main ] then {
855 if [ setup_xfail_format "DWARF 1" ] then {
856 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
862 test_ptype_of_classes
864 if [ runto 'test_calls(void)' ] then {