2002-02-20 Michael Chastain <mec@shout.net>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.c++ / virtfunc.exp
CommitLineData
1bc05c3a 1# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002
b6ba6518 2# Free Software Foundation, Inc.
c906108c
SS
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-gdb@prep.ai.mit.edu
20
21# This file was written by Fred Fish. (fnf@cygnus.com)
22
23set ws "\[\r\n\t \]+"
24set nl "\[\r\n\]+"
25
26if $tracelevel then {
27 strace $tracelevel
28}
29
d4f3574e
SS
30if { [skip_cplus_tests] } { continue }
31
c906108c
SS
32set testfile "virtfunc"
33set srcfile ${testfile}.cc
34set binfile ${objdir}/${subdir}/${testfile}
35
36if [get_compiler_info ${binfile} "c++"] {
37 return -1
38}
39
96baa820 40source ${binfile}.ci
c906108c 41
c906108c
SS
42set src "${srcdir}/${subdir}/${srcfile}"
43if { [gdb_compile "${src}" "${binfile}" executable {c++ debug}] != "" } {
44 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
45}
46
47proc gdb_virtfunc_init {} {
48 global srcdir subdir binfile
49 global gdb_prompt
50
51 gdb_reinitialize_dir $srcdir/$subdir
52 gdb_load $binfile
53
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 $"
58}
59
60proc gdb_virtfunc_restart {} {
61 gdb_exit;
62 gdb_start;
63 gdb_virtfunc_init;
1fa449a4 64 runto 'test_calls';
c906108c
SS
65}
66
67#
68# Test printing of the types of various classes.
69#
70
71proc test_ptype_of_classes {} {
72 global gdb_prompt
73 global ws
74 global nl
75
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".
79 send_gdb "ptype VA\n"
80 gdb_expect {
1bc05c3a 81 -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;${ws}VA & operator=\\(VA const ?&\\);${ws}VA\\((VA const|const VA) ?&\\);${ws}VA\\((void|)\\);${ws}\}.*$gdb_prompt $" {
c906108c
SS
82 pass "ptype VA"
83 }
63f50499 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 $" {
c906108c
SS
85 pass "ptype VA (obsolescent gcc or gdb)"
86 }
87 -re ".*$gdb_prompt $" {
88 fail "ptype VA"
89 }
90 timeout {
91 fail "ptype VA (timeout)"
92 }
93 }
94
95 send_gdb "ptype VB\n"
96 gdb_expect {
1bc05c3a 97 -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const ?&\\);${ws}VB\\((VB const|const VB) ?&\\);${ws}VB\\((void|)\\);${ws}int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);${ws}\}.*$gdb_prompt $" {
c906108c
SS
98 pass "ptype VB"
99 }
63f50499 100 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\}.*$gdb_prompt $" {
a0b3c4fd
JM
101 pass "ptype VB (aCC)"
102 }
63f50499 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 $" {
c906108c
SS
104 pass "ptype VB (obsolescent gcc or gdb)"
105 }
106 -re ".*$gdb_prompt $" {
107 fail "ptype VB"
108 }
109 timeout {
110 fail "ptype VB (timeout)"
111 }
112 }
113
114 send_gdb "ptype V\n"
115 gdb_expect {
1bc05c3a 116 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
c906108c
SS
117 pass "ptype V"
118 }
63f50499 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 $" {
a0b3c4fd
JM
120 pass "ptype V (aCC)"
121 }
63f50499 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 $" {
c906108c
SS
123 pass "ptype V (obsolescent gcc or gdb)"
124 }
125 -re ".*$gdb_prompt $" {
126 fail "ptype V"
127 }
128 timeout {
129 fail "ptype V (timeout)"
130 }
131 }
132
c2d11a7d
JM
133 # The format of a g++ virtual base pointer.
134 set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"
135
c906108c
SS
136 send_gdb "ptype A\n"
137 gdb_expect {
63f50499 138 -re "type = class A : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
c906108c
SS
139 pass "ptype A"
140 }
3e36a0f4 141 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
5178b9d6
DJ
142 pass "ptype A"
143 }
63f50499 144 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
a0b3c4fd
JM
145 pass "ptype A (aCC)"
146 }
63f50499 147 -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 $" {
c906108c
SS
148 pass "ptype A (obsolescent gcc or gdb)"
149 }
c2d11a7d 150 -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 $" {
c906108c
SS
151 # This happens because the type is defined only after it is
152 # too late.
153 fail "ptype A (known failure with gcc cygnus-2.4.5-930417)"
154 # Many of the rest of these tests have the same problem.
155 return 0
156 }
157 -re ".*$gdb_prompt $" {
158 fail "ptype A"
159 }
160 timeout {
161 fail "ptype A (timeout)"
162 }
163 }
164
165 send_gdb "ptype B\n"
166 gdb_expect {
63f50499 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 $" {
c906108c
SS
168 pass "ptype B"
169 }
3e36a0f4 170 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
5178b9d6
DJ
171 pass "ptype B"
172 }
63f50499 173 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
a0b3c4fd
JM
174 pass "ptype B (aCC)"
175 }
63f50499 176 -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 $" {
c906108c
SS
177 pass "ptype B (obsolescent gcc or gdb)"
178 }
179 -re ".*$gdb_prompt $" {
180 fail "ptype B"
181 }
182 timeout {
183 fail "ptype B (timeout)"
184 }
185 }
186
187 send_gdb "ptype C\n"
188 gdb_expect {
63f50499 189 -re "type = class C : public virtual V \{${ws}private:${ws}V \\*${vbptr}V;${ws}public:${ws}int c;${ws}C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);${ws}\}$nl$gdb_prompt $" {
c906108c
SS
190 pass "ptype C"
191 }
3e36a0f4 192 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}C & operator=\\(C const ?&\\);${ws}C\\((C const|const C) ?&\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
5178b9d6
DJ
193 pass "ptype C"
194 }
a0b3c4fd
JM
195 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
196 pass "ptype C (aCC)"
197 }
63f50499 198 -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 $" {
c906108c
SS
199 pass "ptype C (obsolescent gcc or gdb)"
200 }
201 -re ".*$gdb_prompt $" {
202 fail "ptype C"
203 }
204 timeout {
205 fail "ptype C (timeout)"
206 }
207 }
208
209 send_gdb "ptype AD\n"
210 gdb_expect {
1bc05c3a 211 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const ?&\\);${ws}AD\\((AD const|const AD) ?&\\);${ws}AD\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
c906108c
SS
212 pass "ptype AD"
213 }
63f50499 214 -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
a0b3c4fd
JM
215 pass "ptype AD (aCC)"
216 }
63f50499 217 -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 $" {
c906108c
SS
218 pass "ptype AD (obsolescent gcc or gdb)"
219 }
220 -re ".*$gdb_prompt $" {
221 fail "ptype AD"
222 }
223 timeout {
224 fail "ptype AD (timeout)"
225 }
226 }
227
228 send_gdb "ptype D\n"
229 gdb_expect {
63f50499 230 -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 $" {
c906108c
SS
231 pass "ptype D"
232 }
3e36a0f4 233 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
5178b9d6
DJ
234 pass "ptype D"
235 }
63f50499 236 -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 $" {
a0b3c4fd
JM
237 pass "ptype D (aCC)"
238 }
63f50499 239 -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 $" {
c906108c
SS
240 pass "ptype D (obsolescent gcc or gdb)"
241 }
242 -re ".*$gdb_prompt $" {
243 fail "ptype D"
244 }
245 timeout {
246 fail "ptype D (timeout)"
247 }
248 }
249
250 send_gdb "ptype E\n"
251 gdb_expect {
63f50499 252 -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 $" {
c906108c
SS
253 pass "ptype E"
254 }
3e36a0f4 255 -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\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
5178b9d6
DJ
256 pass "ptype E"
257 }
63f50499 258 -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 $" {
a0b3c4fd
JM
259 pass "ptype E (aCC)"
260 }
63f50499 261 -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 $" {
c906108c
SS
262 pass "ptype E (obsolescent gcc or gdb)"
263 }
264 -re ".*$gdb_prompt $" {
265 fail "ptype E"
266 }
267 timeout {
268 fail "ptype E (timeout)"
269 }
270 }
271
272 send_gdb "ptype dd\n"
273 gdb_expect {
63f50499 274 -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 $" {
c906108c
SS
275 pass "ptype dd"
276 }
3e36a0f4 277 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
6a167575 278 pass "ptype dd"
5178b9d6 279 }
63f50499 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 $" {
a0b3c4fd
JM
281 pass "ptype dd (aCC)"
282 }
63f50499 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 $" {
c906108c
SS
284 pass "ptype dd (obsolescent gcc or gdb)"
285 }
286 -re ".*$gdb_prompt $" {
287 fail "ptype dd"
288 }
289 timeout {
290 fail "ptype dd (timeout)"
291 }
292 }
293
294 send_gdb "ptype ppd\n"
295 gdb_expect {
63f50499 296 -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 $" {
c906108c
SS
297 pass "ptype ppd"
298 }
3e36a0f4 299 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
6a167575
DJ
300 pass "ptype ppd"
301 }
63f50499 302 -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 $" {
a0b3c4fd
JM
303 pass "ptype ppd (aCC)"
304 }
63f50499 305 -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 $" {
c906108c
SS
306 pass "ptype ppd (obsolescent gcc or gdb)"
307 }
308 -re ".*$gdb_prompt $" {
309 fail "ptype ppd"
310 }
311 timeout {
312 fail "ptype ppd (timeout)"
313 }
314 }
315
316 send_gdb "ptype pAd\n"
317 gdb_expect {
1bc05c3a 318 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const ?&\\);${ws}AD\\((AD const|const AD) ?&\\);${ws}AD\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
319 pass "ptype pAd"
320 }
63f50499 321 -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
a0b3c4fd
JM
322 pass "ptype pAd (aCC)"
323 }
63f50499 324 -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 $" {
c906108c
SS
325 pass "ptype pAd (obsolescent gcc or gdb)"
326 }
327 -re ".*$gdb_prompt $" {
328 fail "ptype pAd"
329 }
330 timeout {
331 fail "ptype pAd (timeout)"
332 }
333 }
334
335 send_gdb "ptype a\n"
336 gdb_expect {
63f50499 337 -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 $" {
c906108c
SS
338 pass "ptype a"
339 }
3e36a0f4 340 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
6a167575
DJ
341 pass "ptype a"
342 }
63f50499 343 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
a0b3c4fd
JM
344 pass "ptype a (aCC)"
345 }
63f50499 346 -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 $" {
c906108c
SS
347 pass "ptype a (obsolescent gcc or gdb)"
348 }
349 -re ".*$gdb_prompt $" {
350 fail "ptype a"
351 }
352 timeout {
353 fail "ptype a (timeout)"
354 }
355 }
356
357 send_gdb "ptype b\n"
358 gdb_expect {
63f50499 359 -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 $" {
c906108c
SS
360 pass "ptype b"
361 }
3e36a0f4 362 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
6a167575
DJ
363 pass "ptype b"
364 }
63f50499 365 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
a0b3c4fd
JM
366 pass "ptype b (aCC)"
367 }
63f50499 368 -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 $" {
c906108c
SS
369 pass "ptype b (obsolescent gcc or gdb)"
370 }
371 -re ".*$gdb_prompt $" {
372 fail "ptype b"
373 }
374 timeout {
375 fail "ptype b (timeout)"
376 }
377 }
378
379 send_gdb "ptype c\n"
380 gdb_expect {
63f50499 381 -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 $" {
c906108c
SS
382 pass "ptype c"
383 }
3e36a0f4 384 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}C & operator=\\(C const ?&\\);${ws}C\\((C const|const C) ?&\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
6a167575
DJ
385 pass "ptype c"
386 }
a0b3c4fd
JM
387 -re "type = class C : public virtual V \{${ws}public:${ws}int c;${ws}\}$nl$gdb_prompt $" {
388 pass "ptype c (aCC)"
389 }
63f50499 390 -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 $" {
c906108c
SS
391 pass "ptype c (obsolescent gcc or gdb)"
392 }
393 -re ".*$gdb_prompt $" {
394 fail "ptype c"
395 }
396 timeout {
397 fail "ptype c (timeout)"
398 }
399 }
400
401 send_gdb "ptype d\n"
402 gdb_expect {
63f50499 403 -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 $" {
6a167575
DJ
404 pass "ptype d"
405 }
3e36a0f4 406 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
c906108c
SS
407 pass "ptype d"
408 }
63f50499 409 -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 $" {
a0b3c4fd
JM
410 pass "ptype d (aCC)"
411 }
63f50499 412 -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 $" {
c906108c
SS
413 pass "ptype d (obsolescent gcc or gdb)"
414 }
415 -re ".*$gdb_prompt $" {
416 fail "ptype d"
417 }
418 timeout {
419 fail "ptype d (timeout)"
420 }
421 }
422
423 send_gdb "ptype e\n"
424 gdb_expect {
63f50499 425 -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 $" {
c906108c
SS
426 pass "ptype e"
427 }
3e36a0f4 428 -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\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
5178b9d6
DJ
429 pass "ptype e"
430 }
63f50499 431 -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 $" {
a0b3c4fd
JM
432 pass "ptype e (aCC)"
433 }
63f50499 434 -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 $" {
c906108c
SS
435 pass "ptype e (obsolescent gcc or gdb)"
436 }
437 -re ".*$gdb_prompt $" {
438 fail "ptype e"
439 }
440 timeout {
441 fail "ptype e (timeout)"
442 }
443 }
444
445 send_gdb "ptype v\n"
446 gdb_expect {
1bc05c3a 447 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
c906108c
SS
448 pass "ptype v"
449 }
63f50499 450 -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 $" {
a0b3c4fd
JM
451 pass "ptype v (aCC)"
452 }
63f50499 453 -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 $" {
c906108c
SS
454 pass "ptype v (obsolescent gcc or gdb)"
455 }
456 -re ".*$gdb_prompt $" {
457 fail "ptype v"
458 }
459 timeout {
460 fail "ptype v (timeout)"
461 }
462 }
463
464 send_gdb "ptype vb\n"
465 gdb_expect {
1bc05c3a 466 -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const ?&\\);${ws}VB\\((VB const|const VB) ?&\\);${ws}VB\\((void|)\\);${ws}int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);${ws}\}$nl$gdb_prompt $" {
c906108c
SS
467 pass "ptype vb"
468 }
63f50499 469 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\}$nl$gdb_prompt $" {
a0b3c4fd
JM
470 pass "ptype vb (aCC)"
471 }
63f50499 472 -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 $" {
c906108c
SS
473 pass "ptype vb (obsolescent gcc or gdb)"
474 }
475 -re ".*$gdb_prompt $" {
476 fail "ptype vb"
477 }
478 timeout {
479 fail "ptype vb (timeout)"
480 }
481 }
482
483 send_gdb "ptype pAa\n"
484 gdb_expect {
63f50499 485 -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 $" {
c906108c
SS
486 pass "ptype pAa"
487 }
3e36a0f4 488 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
5178b9d6
DJ
489 pass "ptype pAa"
490 }
63f50499 491 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
a0b3c4fd
JM
492 pass "ptype pAa (aCC)"
493 }
63f50499 494 -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 $" {
c906108c
SS
495 pass "ptype pAa (obsolescent gcc or gdb)"
496 }
497 -re ".*$gdb_prompt $" {
498 fail "ptype pAa"
499 }
500 timeout {
501 fail "ptype pAa (timeout)"
502 }
503 }
504
505 send_gdb "ptype pAe\n"
506 gdb_expect {
63f50499 507 -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 $" {
c906108c
SS
508 pass "ptype pAe"
509 }
3e36a0f4 510 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}A & operator=\\(A const ?&\\);${ws}A\\((A const|const A) ?&\\);${ws}A\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
5178b9d6
DJ
511 pass "ptype pAe"
512 }
63f50499 513 -re "type = class A : public virtual V \{${ws}private:${ws}int a;${ws}public:${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
a0b3c4fd
JM
514 pass "ptype pAe (aCC)"
515 }
63f50499 516 -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 $" {
c906108c
SS
517 pass "ptype pAe (obsolescent gcc or gdb)"
518 }
519 -re ".*$gdb_prompt $" {
520 fail "ptype pAe"
521 }
522 timeout {
523 fail "ptype pAe (timeout)"
524 }
525 }
526
527 send_gdb "ptype pBe\n"
528 gdb_expect {
63f50499 529 -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 $" {
c906108c
SS
530 pass "ptype pBe"
531 }
3e36a0f4 532 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const ?&\\);${ws}B\\((B const|const B) ?&\\);${ws}B\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
5178b9d6
DJ
533 pass "ptype pBe"
534 }
63f50499 535 -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}virtual int f \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
a0b3c4fd
JM
536 pass "ptype pBe (aCC)"
537 }
63f50499 538 -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 $" {
c906108c
SS
539 pass "ptype pBe (obsolescent gcc or gdb)"
540 }
541 -re ".*$gdb_prompt $" {
542 fail "ptype pBe"
543 }
544 timeout {
545 fail "ptype pBe (timeout)"
546 }
547 }
548
549 send_gdb "ptype pDd\n"
550 gdb_expect {
63f50499 551 -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 $" {
c906108c
SS
552 pass "ptype pDd"
553 }
3e36a0f4 554 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
5178b9d6
DJ
555 pass "ptype pDd"
556 }
63f50499 557 -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 $" {
a0b3c4fd
JM
558 pass "ptype pDd (aCC)"
559 }
63f50499 560 -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 $" {
c906108c
SS
561 pass "ptype pDd (obsolescent gcc or gdb)"
562 }
563 -re ".*$gdb_prompt $" {
564 fail "ptype pDd"
565 }
566 timeout {
567 fail "ptype pDd (timeout)"
568 }
569 }
570
571 send_gdb "ptype pDe\n"
572 gdb_expect {
63f50499 573 -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 $" {
c906108c
SS
574 pass "ptype pDe"
575 }
3e36a0f4 576 -re "type = class D : public AD, public virtual V \{${ws}public:${ws}int d;${ws}D & operator=\\(D const ?&\\);${ws}D\\((D const|const D) ?&\\);${ws}D\\((void|)\\);${ws}static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
5178b9d6
DJ
577 pass "ptype pDe"
578 }
63f50499 579 -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 $" {
a0b3c4fd
JM
580 pass "ptype pDe (aCC)"
581 }
63f50499 582 -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 $" {
c906108c
SS
583 pass "ptype pDe (obsolescent gcc or gdb)"
584 }
585 -re ".*$gdb_prompt $" {
586 fail "ptype pDe"
587 }
588 timeout {
589 fail "ptype pDe (timeout)"
590 }
591 }
592
593 send_gdb "ptype pVa\n"
594 gdb_expect {
1bc05c3a 595 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
596 pass "ptype pVa"
597 }
63f50499 598 -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 $" {
a0b3c4fd
JM
599 pass "ptype pVa (aCC)"
600 }
63f50499 601 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const ?&\\);)|(${ws}V\\(V const ?&\\);)|(${ws}V\\((void|)\\);)|(${ws}int f\\((void|)\\);)|(${ws}virtual int vv\\((void|)\\);))*${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
602 pass "ptype pVa (obsolescent gcc or gdb)"
603 }
604 -re ".*$gdb_prompt $" {
605 fail "ptype pVa"
606 }
607 timeout {
608 fail "ptype pVa (timeout)"
609 }
610 }
611
612 send_gdb "ptype pVv\n"
613 gdb_expect {
1bc05c3a 614 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
615 pass "ptype pVv"
616 }
63f50499 617 -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 $" {
a0b3c4fd
JM
618 pass "ptype pVv (aCC)"
619 }
63f50499 620 -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 $" {
c906108c
SS
621 pass "ptype pVv (obsolescent gcc or gdb)"
622 }
623 -re ".*$gdb_prompt $" {
624 fail "ptype pVv"
625 }
626 timeout {
627 fail "ptype pVv (timeout)"
628 }
629 }
630
631 send_gdb "ptype pVe\n"
632 gdb_expect {
1bc05c3a 633 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
634 pass "ptype pVe"
635 }
63f50499 636 -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 $" {
a0b3c4fd
JM
637 pass "ptype pVe (aCC)"
638 }
63f50499 639 -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 $" {
c906108c
SS
640 pass "ptype pVe (obsolescent gcc or gdb)"
641 }
642 -re ".*$gdb_prompt $" {
643 fail "ptype pVe"
644 }
645 timeout {
646 fail "ptype pVe (timeout)"
647 }
648 }
649
650 send_gdb "ptype pVd\n"
651 gdb_expect {
1bc05c3a 652 -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const ?&\\);${ws}V\\((V const|const V) ?&\\);${ws}V\\((void|)\\);${ws}int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
653 pass "ptype pVd"
654 }
63f50499 655 -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 $" {
a0b3c4fd
JM
656 pass "ptype pVd (aCC)"
657 }
63f50499 658 -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 $" {
c906108c
SS
659 pass "ptype pVd (obsolescent gcc or gdb)"
660 }
661 -re ".*$gdb_prompt $" {
662 fail "ptype pVd"
663 }
664 timeout {
665 fail "ptype pVd (timeout)"
666 }
667 }
668
669 send_gdb "ptype pADe\n"
670 gdb_expect {
1bc05c3a 671 -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const ?&\\);${ws}AD\\((AD const|const AD) ?&\\);${ws}AD\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
672 pass "ptype pADe"
673 }
63f50499 674 -re "type = class AD \{${ws}public:${ws}virtual int vg \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
a0b3c4fd
JM
675 pass "ptype pADe (aCC)"
676 }
63f50499 677 -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 $" {
c906108c
SS
678 pass "ptype pADe (obsolescent gcc or gdb)"
679 }
680 -re ".*$gdb_prompt $" {
681 fail "ptype pADe"
682 }
683 timeout {
684 fail "ptype pADe (timeout)"
685 }
686 }
687
688 send_gdb "ptype pEe\n"
689 gdb_expect {
63f50499 690 -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 $" {
c906108c
SS
691 pass "ptype pEe"
692 }
3e36a0f4 693 -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\\((E const|const E) ?&\\);${ws}E\\((void|)\\);${ws}virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
5178b9d6
DJ
694 pass "ptype pEe"
695 }
63f50499 696 -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 $" {
a0b3c4fd
JM
697 pass "ptype pEe (aCC)"
698 }
63f50499 699 -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 $" {
c906108c
SS
700 pass "ptype pEe (obsolescent gcc or gdb)"
701 }
702 -re ".*$gdb_prompt $" {
703 fail "ptype pEe"
704 }
705 timeout {
706 fail "ptype pEe (timeout)"
707 }
708 }
709
710 send_gdb "ptype pVB\n"
711 gdb_expect {
1bc05c3a 712 -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const ?&\\);${ws}VB\\((VB const|const VB) ?&\\);${ws}VB\\((void|)\\);${ws}int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
c906108c
SS
713 pass "ptype pVB"
714 }
63f50499 715 -re "type = class VB \{${ws}public:${ws}int vb;${ws}int fvb \\((void|)\\);${ws}virtual int vvb \\((void|)\\);${ws}\} \[*\]+$nl$gdb_prompt $" {
a0b3c4fd
JM
716 pass "ptype pVB (aCC)"
717 }
63f50499 718 -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 $" {
c906108c
SS
719 pass "ptype pVB (obsolescent gcc or gdb)"
720 }
721 -re ".*$gdb_prompt $" {
722 fail "ptype pVB"
723 }
724 timeout {
725 fail "ptype pVB (timeout)"
726 }
727 }
728}
729
730#
731# Test calling of virtual functions.
732#
733
734proc test_virtual_calls {} {
735 global gdb_prompt
736 global GDB
737 global nl
96baa820 738 global gcc_compiled
c906108c
SS
739
740 if [target_info exists gdb,cannot_call_functions] {
741 setup_xfail "*-*-*" 2416
742 fail "This target can not call functions"
743 return 0
744 }
745
746 send_gdb "print pAe->f()\n"
747 gdb_expect {
748 -re ".* = 20$nl$gdb_prompt $" { pass "print pAe->f()" }
749 -re "Cannot invoke functions on this machine.*$gdb_prompt $" {
750 fail "print pAe->f() (cannot invoke functions, skipping virtual calls)"
751 return 0
752 }
753 -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" {
754 fail "print pAe->f() \
755(known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)"
756 return 0
757 }
a0b3c4fd
JM
758 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
759 setup_xfail hppa*-*-* CLLbs16899
760 fail "print pAe->f()"
761 }
c906108c
SS
762 -re ".*$gdb_prompt $" { fail "print pAe->f()" }
763 timeout { fail "print pAe->f() (timeout)" }
764 eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
765 }
766
767 send_gdb "print pAa->f()\n"
768 gdb_expect {
769 -re ".* = 1$nl$gdb_prompt $" { pass "print pAa->f()" }
a0b3c4fd
JM
770 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
771 setup_xfail hppa*-*-* CLLbs16899
772 fail "print pAa->f()"
773 }
c906108c
SS
774 -re ".*$gdb_prompt $" { fail "print pAa->f()" }
775 timeout { fail "print pAa->f() (timeout)" }
776 eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
777 }
778
779 send_gdb "print pDe->vg()\n"
c906108c
SS
780 gdb_expect {
781 -re ".* = 202$nl$gdb_prompt $" { pass "print pDe->vg()" }
a0b3c4fd
JM
782 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
783 setup_xfail hppa*-*-* CLLbs16899
784 fail "print pDe->vg()"
785 }
c906108c
SS
786 -re ".*$gdb_prompt $" { fail "print pDe->vg()" }
787 timeout { fail "print pDe->vg() (timeout)" }
788 eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
789 }
790
791 send_gdb "print pADe->vg()\n"
792 gdb_expect {
793 -re ".* = 202$nl$gdb_prompt $" { pass "print pADe->vg()" }
a0b3c4fd
JM
794 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
795 setup_xfail hppa*-*-* CLLbs16899
796 fail "print pADe->vg()"
797 }
c906108c
SS
798 -re ".*$gdb_prompt $" { fail "print pADe->vg()" }
799 timeout { fail "print pADe->vg() (timeout)" }
800 eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
801 }
802
803 send_gdb "print pDd->vg()\n"
c906108c
SS
804 gdb_expect {
805 -re ".* = 101$nl$gdb_prompt $" { pass "print pDd->vg()" }
a0b3c4fd
JM
806 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
807 setup_xfail hppa*-*-* CLLbs16899
808 fail "print pDd->vg()"
809 }
c906108c
SS
810 -re ".*$gdb_prompt $" { fail "print pDd->vg()" }
811 timeout { fail "print pDd->vg() (timeout)" }
812 eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
813 }
814
815 send_gdb "print pEe->vvb()\n"
c906108c
SS
816 gdb_expect {
817 -re ".* = 411$nl$gdb_prompt $" { pass "print pEe->vvb()" }
a0b3c4fd
JM
818 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
819 setup_xfail hppa*-*-* CLLbs16899
820 fail "print pEe->vvb()"
821 }
c906108c
SS
822 -re ".*$gdb_prompt $" { fail "print pEe->vvb()" }
823 timeout { fail "print pEe->vvb() (timeout)" }
824 eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
825 }
826
827 send_gdb "print pVB->vvb()\n"
828 gdb_expect {
829 -re ".* = 407$nl$gdb_prompt $" { pass "print pVB->vvb()" }
a0b3c4fd
JM
830 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
831 setup_xfail hppa*-*-* CLLbs16899
832 fail "print pVB->vvb()"
833 }
c906108c
SS
834 -re ".*$gdb_prompt $" { fail "print pVB->vvb()" }
835 timeout { fail "print pVB->vvb() (timeout)" }
836 eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
837 }
838
ac57ea44
MC
839 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
840 # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2.
841 # -- chastain 2002-02-20
842
96baa820
JM
843 if {$gcc_compiled} then { setup_xfail "*-*-*" }
844
c906108c 845 send_gdb "print pBe->vvb()\n"
c906108c
SS
846 gdb_expect {
847 -re ".* = 411$nl$gdb_prompt $" { pass "print pBe->vvb()" }
a0b3c4fd
JM
848 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
849 setup_xfail hppa*-*-* CLLbs16899
850 fail "print pBe->vvb()"
851 }
c906108c
SS
852 -re ".*$gdb_prompt $" { fail "print pBe->vvb()" }
853 timeout { fail "print pBe->vvb() (timeout)" }
854 eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
855 }
856
857 send_gdb "print pDe->vvb()\n"
c906108c
SS
858 gdb_expect {
859 -re ".* = 411$nl$gdb_prompt $" { pass "print pDe->vvb()" }
a0b3c4fd
JM
860 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
861 setup_xfail hppa*-*-* CLLbs16899
862 fail "print pDe->vvb()"
863 }
c906108c
SS
864 -re ".*$gdb_prompt $" { fail "print pDe->vvb()" }
865 timeout { fail "print pDe->vvb() (timeout)" }
866 eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
867 }
868
869 send_gdb "print pEe->vd()\n"
c906108c
SS
870 gdb_expect {
871 -re ".* = 282$nl$gdb_prompt $" { pass "print pEe->vd()" }
a0b3c4fd
JM
872 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
873 setup_xfail hppa*-*-* CLLbs16899
874 fail "print pEe->vd()"
875 }
c906108c
SS
876 -re ".*$gdb_prompt $" { fail "print pEe->vd()" }
877 timeout { fail "print pEe->vd() (timeout)" }
878 eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
879 }
880
881 send_gdb "print pEe->fvb()\n"
c906108c
SS
882 gdb_expect {
883 -re ".* = 311$nl$gdb_prompt $" { pass "print pEe->fvb()" }
a0b3c4fd
JM
884 -re "Cannot resolve .* to any overloaded instance.*$gdb_prompt $" {
885 setup_xfail hppa*-*-* CLLbs16899
886 fail "print pEe->fvb()"
887 }
c906108c
SS
888 -re ".*$gdb_prompt $" { fail "print pEe->fvb()" }
889 timeout { fail "print pEe->fvb() (timeout)" }
890 eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
891 }
892
ac57ea44
MC
893 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
894 # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gdwarf-2.
895 #
896 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
897 # gdb=HEAD%2002-02-16, gcc=2.95.3, goption=-gstabs+.
898 #
899 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
900 # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gdwarf-2.
901 #
902 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
903 # gdb=HEAD%2002-02-16, gcc=3.0.3, goption=-gstabs+.
904 #
905 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
906 # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gdwarf-2.
907 #
908 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
909 # gdb=HEAD%2002-02-16, gcc=3.0.4-20020215, goption=-gstabs+.
910 #
911 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
912 # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gdwarf-2.
913 #
914 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
915 # gdb=HEAD%2002-02-16, gcc=gcc-3_0-branch%2002-02-16, goption=-gstabs+.
916 #
917 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
918 # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gdwarf-2.
919 #
920 # fails on target=native, host=i686-pc-linux-gnu%rh-7.2,
921 # gdb=HEAD%2002-02-16, gcc=HEAD%2002-02-16, goption=-gstabs+.
922 #
923 # -- chastain 2002-02-20
924
96baa820
JM
925 if {$gcc_compiled} then { setup_xfail "*-*-*" }
926
c906108c
SS
927 send_gdb "print pEe->D::vg()\n"
928 setup_xfail "*-*-*"
929 gdb_expect {
930 -re ".* = 102$nl$gdb_prompt $" { pass "print pEe->D::vg()" }
931 -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" }
932 timeout { fail "print pEe->D::vg() (timeout)" }
933 eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return }
934 }
935}
936
937proc do_tests {} {
938 global prms_id
939 global bug_id
940
941 set prms_id 0
942 set bug_id 0
943
944 gdb_start;
945 gdb_virtfunc_init;
946
947 # Get the debug format for the compiled test case. If that
948 # format is DWARF 1 then just skip all the tests since none of
949 # them will pass.
950
951 if [ runto_main ] then {
952 get_debug_format
953 if [ setup_xfail_format "DWARF 1" ] then {
954 fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format"
955 return
956 }
957 clear_xfail "*-*-*"
958 }
959
960 test_ptype_of_classes
961
1fa449a4 962 if [ runto 'test_calls' ] then {
c906108c
SS
963 test_virtual_calls
964 }
965}
966
967do_tests
This page took 0.315433 seconds and 4 git commands to generate.