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++"] {
37 # if we are on HPUX and we are not compiled with gcc, then skip these tests.
39 if [istarget hppa*-*-hpux*] {
47 # Check to see if we have an executable to test. If not, then either we
48 # haven't tried to compile one, or the compilation failed for some reason.
49 # In either case, just notify the user and skip the tests in this file.
51 set src "${srcdir}/${subdir}/${srcfile}"
52 if { [gdb_compile "${src}" "${binfile}" executable {c++ debug}] != "" } {
53 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
56 proc gdb_virtfunc_init {} {
57 global srcdir subdir binfile
60 gdb_reinitialize_dir $srcdir/$subdir
63 send_gdb "set language c++\n"
64 gdb_expect -re "$gdb_prompt $"
65 send_gdb "set width 0\n"
66 gdb_expect -re "$gdb_prompt $"
69 proc gdb_virtfunc_restart {} {
73 runto 'test_calls(void)';
77 # Test printing of the types of various classes.
80 proc test_ptype_of_classes {} {
85 # This used to be a fail if it printed "struct" not "class". But
86 # since this struct doesn't use any special C++ features, it is
87 # considered right for GDB to print it as "struct".
90 -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 $" {
93 -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 $" {
94 pass "ptype VA (obsolescent gcc or gdb)"
96 -re ".*$gdb_prompt $" {
100 fail "ptype VA (timeout)"
104 send_gdb "ptype VB\n"
106 -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 $" {
109 -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 $" {
110 pass "ptype VB (obsolescent gcc or gdb)"
112 -re ".*$gdb_prompt $" {
116 fail "ptype VB (timeout)"
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 $" {
125 -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 $" {
126 pass "ptype V (obsolescent gcc or gdb)"
128 -re ".*$gdb_prompt $" {
132 fail "ptype V (timeout)"
138 -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}$nl$gdb_prompt $" {
141 -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}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}$nl$gdb_prompt $" {
165 pass "ptype B (obsolescent gcc or gdb)"
167 -re ".*$gdb_prompt $" {
171 fail "ptype B (timeout)"
177 -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 $" {
180 -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}$nl$gdb_prompt $" {
181 pass "ptype C (obsolescent gcc or gdb)"
183 -re ".*$gdb_prompt $" {
187 fail "ptype C (timeout)"
191 send_gdb "ptype AD\n"
193 -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 $" {
196 -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 $" {
197 pass "ptype AD (obsolescent gcc or gdb)"
199 -re ".*$gdb_prompt $" {
203 fail "ptype AD (timeout)"
209 -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 $" {
212 -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 $" {
213 pass "ptype D (obsolescent gcc or gdb)"
215 -re ".*$gdb_prompt $" {
219 fail "ptype D (timeout)"
225 -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 $" {
228 -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 $" {
229 pass "ptype E (obsolescent gcc or gdb)"
231 -re ".*$gdb_prompt $" {
235 fail "ptype E (timeout)"
239 send_gdb "ptype dd\n"
241 -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 $" {
244 -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 $" {
245 pass "ptype dd (obsolescent gcc or gdb)"
247 -re ".*$gdb_prompt $" {
251 fail "ptype dd (timeout)"
255 send_gdb "ptype ppd\n"
257 -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 $" {
260 -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 $" {
261 pass "ptype ppd (obsolescent gcc or gdb)"
263 -re ".*$gdb_prompt $" {
267 fail "ptype ppd (timeout)"
271 send_gdb "ptype pAd\n"
273 -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 $" {
276 -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 $" {
277 pass "ptype pAd (obsolescent gcc or gdb)"
279 -re ".*$gdb_prompt $" {
283 fail "ptype pAd (timeout)"
289 -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 $" {
292 -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 $" {
293 pass "ptype a (obsolescent gcc or gdb)"
295 -re ".*$gdb_prompt $" {
299 fail "ptype a (timeout)"
305 -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 $" {
308 -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 $" {
309 pass "ptype b (obsolescent gcc or gdb)"
311 -re ".*$gdb_prompt $" {
315 fail "ptype b (timeout)"
321 -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 $" {
324 -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 $" {
325 pass "ptype c (obsolescent gcc or gdb)"
327 -re ".*$gdb_prompt $" {
331 fail "ptype c (timeout)"
337 -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 $" {
340 -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 $" {
341 pass "ptype d (obsolescent gcc or gdb)"
343 -re ".*$gdb_prompt $" {
347 fail "ptype d (timeout)"
353 -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 $" {
356 -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 $" {
357 pass "ptype e (obsolescent gcc or gdb)"
359 -re ".*$gdb_prompt $" {
363 fail "ptype e (timeout)"
369 -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 $" {
372 -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 $" {
373 pass "ptype v (obsolescent gcc or gdb)"
375 -re ".*$gdb_prompt $" {
379 fail "ptype v (timeout)"
383 send_gdb "ptype vb\n"
385 -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 $" {
388 -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 $" {
389 pass "ptype vb (obsolescent gcc or gdb)"
391 -re ".*$gdb_prompt $" {
395 fail "ptype vb (timeout)"
399 send_gdb "ptype pAa\n"
401 -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 $" {
404 -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 $" {
405 pass "ptype pAa (obsolescent gcc or gdb)"
407 -re ".*$gdb_prompt $" {
411 fail "ptype pAa (timeout)"
415 send_gdb "ptype pAe\n"
417 -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 $" {
420 -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 $" {
421 pass "ptype pAe (obsolescent gcc or gdb)"
423 -re ".*$gdb_prompt $" {
427 fail "ptype pAe (timeout)"
431 send_gdb "ptype pBe\n"
433 -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 $" {
436 -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 $" {
437 pass "ptype pBe (obsolescent gcc or gdb)"
439 -re ".*$gdb_prompt $" {
443 fail "ptype pBe (timeout)"
447 send_gdb "ptype pDd\n"
449 -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 $" {
452 -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 $" {
453 pass "ptype pDd (obsolescent gcc or gdb)"
455 -re ".*$gdb_prompt $" {
459 fail "ptype pDd (timeout)"
463 send_gdb "ptype pDe\n"
465 -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 $" {
468 -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 $" {
469 pass "ptype pDe (obsolescent gcc or gdb)"
471 -re ".*$gdb_prompt $" {
475 fail "ptype pDe (timeout)"
479 send_gdb "ptype pVa\n"
481 -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 $" {
484 -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 $" {
485 pass "ptype pVa (obsolescent gcc or gdb)"
487 -re ".*$gdb_prompt $" {
491 fail "ptype pVa (timeout)"
495 send_gdb "ptype pVv\n"
497 -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 $" {
500 -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 $" {
501 pass "ptype pVv (obsolescent gcc or gdb)"
503 -re ".*$gdb_prompt $" {
507 fail "ptype pVv (timeout)"
511 send_gdb "ptype pVe\n"
513 -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 $" {
516 -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 $" {
517 pass "ptype pVe (obsolescent gcc or gdb)"
519 -re ".*$gdb_prompt $" {
523 fail "ptype pVe (timeout)"
527 send_gdb "ptype pVd\n"
529 -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 $" {
532 -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 $" {
533 pass "ptype pVd (obsolescent gcc or gdb)"
535 -re ".*$gdb_prompt $" {
539 fail "ptype pVd (timeout)"
543 send_gdb "ptype pADe\n"
545 -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 $" {
548 -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 $" {
549 pass "ptype pADe (obsolescent gcc or gdb)"
551 -re ".*$gdb_prompt $" {
555 fail "ptype pADe (timeout)"
559 send_gdb "ptype pEe\n"
561 -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 $" {
564 -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 $" {
565 pass "ptype pEe (obsolescent gcc or gdb)"
567 -re ".*$gdb_prompt $" {
571 fail "ptype pEe (timeout)"
575 send_gdb "ptype pVB\n"
577 -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 $" {
580 -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 $" {
581 pass "ptype pVB (obsolescent gcc or gdb)"
583 -re ".*$gdb_prompt $" {
587 fail "ptype pVB (timeout)"
593 # Test calling of virtual functions.
596 proc test_virtual_calls {} {
601 if [target_info exists gdb,cannot_call_functions] {
602 setup_xfail "*-*-*" 2416
603 fail "This target can not call functions"
607 send_gdb "print pAe->f()\n"
609 -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
610 -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
611 fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
614 -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
615 fail "print pAe->f() \
616 (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
619 -re ".*$gdb_prompt $" { fail "print pAe->f()" }
620 timeout { fail "print pAe->f() (timeout)" }
621 eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
624 send_gdb "print pAa->f()\n"
626 -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
627 -re ".*$gdb_prompt $" { fail "print pAa->f()" }
628 timeout { fail "print pAa->f() (timeout)" }
629 eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
632 send_gdb "print pDe->vg()\n"
633 # setup_xfail "*-*-*"
635 -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
636 -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
637 timeout { fail "print pDe->vg() (timeout)" }
638 eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
641 send_gdb "print pADe->vg()\n"
643 -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
644 -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
645 timeout { fail "print pADe->vg() (timeout)" }
646 eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
649 send_gdb "print pDd->vg()\n"
650 # setup_xfail "*-*-*"
652 -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
653 -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
654 timeout { fail "print pDd->vg() (timeout)" }
655 eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
658 send_gdb "print pEe->vvb()\n"
659 # setup_xfail "*-*-*"
661 -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
662 -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
663 timeout { fail "print pEe->vvb() (timeout)" }
664 eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
667 send_gdb "print pVB->vvb()\n"
669 -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
670 -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
671 timeout { fail "print pVB->vvb() (timeout)" }
672 eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
675 send_gdb "print pBe->vvb()\n"
676 # setup_xfail "*-*-*"
678 -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
679 -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
680 timeout { fail "print pBe->vvb() (timeout)" }
681 eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
684 send_gdb "print pDe->vvb()\n"
685 # setup_xfail "*-*-*"
687 -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
688 -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
689 timeout { fail "print pDe->vvb() (timeout)" }
690 eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
693 send_gdb "print pEe->vd()\n"
694 # setup_xfail "*-*-*"
696 -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
697 -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
698 timeout { fail "print pEe->vd() (timeout)" }
699 eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
702 send_gdb "print pEe->fvb()\n"
703 # setup_xfail "*-*-*"
705 -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
706 -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
707 timeout { fail "print pEe->fvb() (timeout)" }
708 eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
711 send_gdb "print pEe->D::vg()\n"
714 -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
715 -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
716 timeout { fail "print pEe->D::vg() (timeout)" }
717 eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
731 # Get the debug format for the compiled test case. If that
732 # format is DWARF 1 then just skip all the tests since none of
735 if [ runto_main ] then {
737 if [ setup_xfail_format "DWARF 1" ] then {
738 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
744 test_ptype_of_classes
746 if [ runto 'test_calls(void)' ] then {