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)"
132 # The format of a g++ virtual base pointer.
133 set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"
137 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
140 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
143 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
144 pass "ptype A (obsolescent gcc or gdb)"
146 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}$nl$gdb_prompt $" {
147 # This happens because the type is defined only after it is
149 fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
150 # Many of the rest of these tests have the same problem.
153 -re ".*$gdb_prompt $" {
157 fail "ptype A (timeout)"
163 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
166 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
169 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
170 pass "ptype B (obsolescent gcc or gdb)"
172 -re ".*$gdb_prompt $" {
176 fail "ptype B (timeout)"
182 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
185 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
188 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
189 pass "ptype C (obsolescent gcc or gdb)"
191 -re ".*$gdb_prompt $" {
195 fail "ptype C (timeout)"
199 send_gdb "ptype AD\n"
201 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\}$nl$gdb_prompt $" {
204 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\}$nl$gdb_prompt $" {
205 pass "ptype AD (aCC)"
207 -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
208 pass "ptype AD (obsolescent gcc or gdb)"
210 -re ".*$gdb_prompt $" {
214 fail "ptype AD (timeout)"
220 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
223 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
226 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
227 pass "ptype D (obsolescent gcc or gdb)"
229 -re ".*$gdb_prompt $" {
233 fail "ptype D (timeout)"
239 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
242 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
245 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
246 pass "ptype E (obsolescent gcc or gdb)"
248 -re ".*$gdb_prompt $" {
252 fail "ptype E (timeout)"
256 send_gdb "ptype dd\n"
258 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
261 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
262 pass "ptype dd (aCC)"
264 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
265 pass "ptype dd (obsolescent gcc or gdb)"
267 -re ".*$gdb_prompt $" {
271 fail "ptype dd (timeout)"
275 send_gdb "ptype ppd\n"
277 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
280 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
281 pass "ptype ppd (aCC)"
283 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
284 pass "ptype ppd (obsolescent gcc or gdb)"
286 -re ".*$gdb_prompt $" {
290 fail "ptype ppd (timeout)"
294 send_gdb "ptype pAd\n"
296 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
299 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
300 pass "ptype pAd (aCC)"
302 -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
303 pass "ptype pAd (obsolescent gcc or gdb)"
305 -re ".*$gdb_prompt $" {
309 fail "ptype pAd (timeout)"
315 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
318 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
321 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
322 pass "ptype a (obsolescent gcc or gdb)"
324 -re ".*$gdb_prompt $" {
328 fail "ptype a (timeout)"
334 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
337 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\}$nl$gdb_prompt $" {
340 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
341 pass "ptype b (obsolescent gcc or gdb)"
343 -re ".*$gdb_prompt $" {
347 fail "ptype b (timeout)"
353 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
356 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
359 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
360 pass "ptype c (obsolescent gcc or gdb)"
362 -re ".*$gdb_prompt $" {
366 fail "ptype c (timeout)"
372 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
375 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}$nl$gdb_prompt $" {
378 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
379 pass "ptype d (obsolescent gcc or gdb)"
381 -re ".*$gdb_prompt $" {
385 fail "ptype d (timeout)"
391 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
394 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
397 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
398 pass "ptype e (obsolescent gcc or gdb)"
400 -re ".*$gdb_prompt $" {
404 fail "ptype e (timeout)"
410 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}$nl$gdb_prompt $" {
413 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\}$nl$gdb_prompt $" {
416 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
417 pass "ptype v (obsolescent gcc or gdb)"
419 -re ".*$gdb_prompt $" {
423 fail "ptype v (timeout)"
427 send_gdb "ptype vb\n"
429 -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}$nl$gdb_prompt $" {
432 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\}$nl$gdb_prompt $" {
433 pass "ptype vb (aCC)"
435 -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
436 pass "ptype vb (obsolescent gcc or gdb)"
438 -re ".*$gdb_prompt $" {
442 fail "ptype vb (timeout)"
446 send_gdb "ptype pAa\n"
448 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
451 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
452 pass "ptype pAa (aCC)"
454 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
455 pass "ptype pAa (obsolescent gcc or gdb)"
457 -re ".*$gdb_prompt $" {
461 fail "ptype pAa (timeout)"
465 send_gdb "ptype pAe\n"
467 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
470 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
471 pass "ptype pAe (aCC)"
473 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
474 pass "ptype pAe (obsolescent gcc or gdb)"
476 -re ".*$gdb_prompt $" {
480 fail "ptype pAe (timeout)"
484 send_gdb "ptype pBe\n"
486 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
489 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
490 pass "ptype pBe (aCC)"
492 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
493 pass "ptype pBe (obsolescent gcc or gdb)"
495 -re ".*$gdb_prompt $" {
499 fail "ptype pBe (timeout)"
503 send_gdb "ptype pDd\n"
505 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
508 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
509 pass "ptype pDd (aCC)"
511 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
512 pass "ptype pDd (obsolescent gcc or gdb)"
514 -re ".*$gdb_prompt $" {
518 fail "ptype pDd (timeout)"
522 send_gdb "ptype pDe\n"
524 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
527 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
528 pass "ptype pDe (aCC)"
530 -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
531 pass "ptype pDe (obsolescent gcc or gdb)"
533 -re ".*$gdb_prompt $" {
537 fail "ptype pDe (timeout)"
541 send_gdb "ptype pVa\n"
543 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
546 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
547 pass "ptype pVa (aCC)"
549 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
550 pass "ptype pVa (obsolescent gcc or gdb)"
552 -re ".*$gdb_prompt $" {
556 fail "ptype pVa (timeout)"
560 send_gdb "ptype pVv\n"
562 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
565 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
566 pass "ptype pVv (aCC)"
568 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
569 pass "ptype pVv (obsolescent gcc or gdb)"
571 -re ".*$gdb_prompt $" {
575 fail "ptype pVv (timeout)"
579 send_gdb "ptype pVe\n"
581 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
584 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
585 pass "ptype pVe (aCC)"
587 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
588 pass "ptype pVe (obsolescent gcc or gdb)"
590 -re ".*$gdb_prompt $" {
594 fail "ptype pVe (timeout)"
598 send_gdb "ptype pVd\n"
600 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
603 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}int f \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
604 pass "ptype pVd (aCC)"
606 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
607 pass "ptype pVd (obsolescent gcc or gdb)"
609 -re ".*$gdb_prompt $" {
613 fail "ptype pVd (timeout)"
617 send_gdb "ptype pADe\n"
619 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
622 -re "type = class AD \{${ws}public:${ws}virtual int vg \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
623 pass "ptype pADe (aCC)"
625 -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
626 pass "ptype pADe (obsolescent gcc or gdb)"
628 -re ".*$gdb_prompt $" {
632 fail "ptype pADe (timeout)"
636 send_gdb "ptype pEe\n"
638 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
641 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}virtual int f \\(void\\);${ws}virtual int vg \\(void\\);${ws}virtual int vv \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
642 pass "ptype pEe (aCC)"
644 -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
645 pass "ptype pEe (obsolescent gcc or gdb)"
647 -re ".*$gdb_prompt $" {
651 fail "ptype pEe (timeout)"
655 send_gdb "ptype pVB\n"
657 -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
660 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\(void\\);${ws}virtual int vvb \\(void\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
661 pass "ptype pVB (aCC)"
663 -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
664 pass "ptype pVB (obsolescent gcc or gdb)"
666 -re ".*$gdb_prompt $" {
670 fail "ptype pVB (timeout)"
676 # Test calling of virtual functions.
679 proc test_virtual_calls {} {
685 if [target_info exists gdb,cannot_call_functions] {
686 setup_xfail "*-*-*" 2416
687 fail "This target can not call functions"
691 # FIXME: In fall 1998, GCC's virtual function type info was changed,
692 # which causes GDB to be unable to resolve these calls. Until the
693 # problem is fixed, XFAIL these tests. -sts 1999-08-02
695 if {$gcc_compiled} then { setup_xfail "*-*-*" }
697 send_gdb "print pAe->f()\n"
699 -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
700 -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
701 fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
704 -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
705 fail "print pAe->f() \
706 (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
709 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
710 setup_xfail hppa*-*-* CLLbs16899
711 fail "print pAe->f()"
713 -re ".*$gdb_prompt $" { fail "print pAe->f()" }
714 timeout { fail "print pAe->f() (timeout)" }
715 eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
718 if {$gcc_compiled} then { setup_xfail "*-*-*" }
720 send_gdb "print pAa->f()\n"
722 -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
723 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
724 setup_xfail hppa*-*-* CLLbs16899
725 fail "print pAa->f()"
727 -re ".*$gdb_prompt $" { fail "print pAa->f()" }
728 timeout { fail "print pAa->f() (timeout)" }
729 eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
732 if {$gcc_compiled} then { setup_xfail "*-*-*" }
734 send_gdb "print pDe->vg()\n"
736 -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
737 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
738 setup_xfail hppa*-*-* CLLbs16899
739 fail "print pDe->vg()"
741 -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
742 timeout { fail "print pDe->vg() (timeout)" }
743 eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
746 if {$gcc_compiled} then { setup_xfail "*-*-*" }
748 send_gdb "print pADe->vg()\n"
750 -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
751 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
752 setup_xfail hppa*-*-* CLLbs16899
753 fail "print pADe->vg()"
755 -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
756 timeout { fail "print pADe->vg() (timeout)" }
757 eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
760 if {$gcc_compiled} then { setup_xfail "*-*-*" }
762 send_gdb "print pDd->vg()\n"
764 -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
765 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
766 setup_xfail hppa*-*-* CLLbs16899
767 fail "print pDd->vg()"
769 -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
770 timeout { fail "print pDd->vg() (timeout)" }
771 eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
774 if {$gcc_compiled} then { setup_xfail "*-*-*" }
776 send_gdb "print pEe->vvb()\n"
778 -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
779 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
780 setup_xfail hppa*-*-* CLLbs16899
781 fail "print pEe->vvb()"
783 -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
784 timeout { fail "print pEe->vvb() (timeout)" }
785 eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
788 if {$gcc_compiled} then { setup_xfail "*-*-*" }
790 send_gdb "print pVB->vvb()\n"
792 -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
793 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
794 setup_xfail hppa*-*-* CLLbs16899
795 fail "print pVB->vvb()"
797 -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
798 timeout { fail "print pVB->vvb() (timeout)" }
799 eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
802 if {$gcc_compiled} then { setup_xfail "*-*-*" }
804 send_gdb "print pBe->vvb()\n"
806 -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
807 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
808 setup_xfail hppa*-*-* CLLbs16899
809 fail "print pBe->vvb()"
811 -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
812 timeout { fail "print pBe->vvb() (timeout)" }
813 eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
816 if {$gcc_compiled} then { setup_xfail "*-*-*" }
818 send_gdb "print pDe->vvb()\n"
820 -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
821 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
822 setup_xfail hppa*-*-* CLLbs16899
823 fail "print pDe->vvb()"
825 -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
826 timeout { fail "print pDe->vvb() (timeout)" }
827 eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
830 if {$gcc_compiled} then { setup_xfail "*-*-*" }
832 send_gdb "print pEe->vd()\n"
834 -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
835 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
836 setup_xfail hppa*-*-* CLLbs16899
837 fail "print pEe->vd()"
839 -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
840 timeout { fail "print pEe->vd() (timeout)" }
841 eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
844 if {$gcc_compiled} then { setup_xfail "*-*-*" }
846 send_gdb "print pEe->fvb()\n"
848 -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
849 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
850 setup_xfail hppa*-*-* CLLbs16899
851 fail "print pEe->fvb()"
853 -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
854 timeout { fail "print pEe->fvb() (timeout)" }
855 eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
858 if {$gcc_compiled} then { setup_xfail "*-*-*" }
860 send_gdb "print pEe->D::vg()\n"
863 -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
864 -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
865 timeout { fail "print pEe->D::vg() (timeout)" }
866 eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
880 # Get the debug format for the compiled test case. If that
881 # format is DWARF 1 then just skip all the tests since none of
884 if [ runto_main ] then {
886 if [ setup_xfail_format "DWARF 1" ] then {
887 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
893 test_ptype_of_classes
895 if [ runto 'test_calls(void)' ] then {