Commit | Line | Data |
---|---|---|
c906108c SS |
1 | # Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc. |
2 | ||
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. | |
7 | # | |
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. | |
12 | # | |
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. | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | # This file was written by Fred Fish. (fnf@cygnus.com) | |
21 | ||
22 | set ws "\[\r\n\t \]+" | |
23 | ||
24 | if $tracelevel then { | |
25 | strace $tracelevel | |
26 | } | |
27 | ||
7a292a7a SS |
28 | if { [skip_hp_tests] } then { continue } |
29 | ||
c906108c SS |
30 | set testfile "virtfun-hp" |
31 | set srcfile ${testfile}.cc | |
32 | set binfile ${objdir}/${subdir}/${testfile} | |
33 | ||
34 | if [get_compiler_info ${binfile} "c++"] { | |
35 | return -1; | |
36 | } | |
7a292a7a SS |
37 | |
38 | if { $gcc_compiled } then { continue } | |
c906108c SS |
39 | |
40 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { | |
41 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
42 | } | |
43 | ||
44 | ||
45 | proc gdb_virtfunc_init {} { | |
46 | global srcdir subdir binfile | |
47 | global gdb_prompt | |
48 | ||
49 | gdb_reinitialize_dir $srcdir/$subdir | |
50 | gdb_load $binfile | |
51 | ||
52 | send_gdb "set language c++\n" | |
53 | gdb_expect -re "$gdb_prompt $" | |
54 | send_gdb "set width 0\n" | |
55 | gdb_expect -re "$gdb_prompt $" | |
56 | } | |
57 | ||
58 | proc gdb_virtfunc_restart {} { | |
59 | gdb_exit; | |
60 | gdb_start; | |
61 | gdb_virtfunc_init; | |
62 | runto 'test_calls(void)'; | |
63 | } | |
64 | ||
65 | # | |
66 | # Test printing of the types of various classes. | |
67 | # | |
68 | ||
69 | proc test_ptype_of_classes {} { | |
70 | global gdb_prompt | |
71 | global ws | |
72 | ||
73 | # This used to be a fail if it printed "struct" not "class". But | |
74 | # since this struct doesn't use any special C++ features, it is | |
75 | # considered right for GDB to print it as "struct". | |
76 | send_gdb "ptype VA\n" | |
77 | gdb_expect { | |
78 | -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 $" { | |
79 | pass "ptype VA" | |
80 | } | |
81 | -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;((${ws}VA & operator=\\(VA const &\\);)|(${ws}VA\\(VA const &\\);)|(${ws}VA\\(void\\);))*${ws}\}.*$gdb_prompt $" { | |
82 | pass "ptype VA (obsolescent gcc or gdb)" | |
83 | } | |
84 | -re ".*$gdb_prompt $" { | |
85 | fail "ptype VA" | |
86 | } | |
87 | timeout { | |
88 | fail "ptype VA (timeout)" | |
89 | } | |
90 | } | |
91 | ||
92 | send_gdb "ptype VB\n" | |
93 | gdb_expect { | |
94 | -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 $" { | |
95 | pass "ptype VB" | |
96 | } | |
97 | -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}.*$gdb_prompt $" { | |
98 | pass "ptype VB (obsolescent gcc or gdb)" | |
99 | } | |
100 | -re ".*$gdb_prompt $" { | |
101 | fail "ptype VB" | |
102 | } | |
103 | timeout { | |
104 | fail "ptype VB (timeout)" | |
105 | } | |
106 | } | |
107 | ||
108 | send_gdb "ptype V\n" | |
109 | gdb_expect { | |
110 | -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}\}\r\n$gdb_prompt $" { | |
111 | pass "ptype V" | |
112 | } | |
113 | -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}\}\r\n$gdb_prompt $" { | |
114 | pass "ptype V (obsolescent gcc or gdb)" | |
115 | } | |
116 | -re ".*$gdb_prompt $" { | |
117 | fail "ptype V" | |
118 | } | |
119 | timeout { | |
120 | fail "ptype V (timeout)" | |
121 | } | |
122 | } | |
123 | ||
124 | send_gdb "ptype A\n" | |
125 | gdb_expect { | |
126 | -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { | |
127 | pass "ptype A (aCC)" | |
128 | } | |
129 | -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}\}\r\n$gdb_prompt $" { | |
130 | pass "ptype A" | |
131 | } | |
132 | -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}\}\r\n$gdb_prompt $" { | |
133 | pass "ptype A (obsolescent gcc or gdb)" | |
134 | } | |
135 | -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}\r\n$gdb_prompt $" { | |
136 | # This happens because the type is defined only after it is | |
137 | # too late. | |
138 | fail "ptype A (known failure with gcc cygnus-2.4.5-930417)" | |
139 | # Many of the rest of these tests have the same problem. | |
140 | return 0 | |
141 | } | |
142 | -re ".*$gdb_prompt $" { | |
143 | fail "ptype A" | |
144 | } | |
145 | timeout { | |
146 | fail "ptype A (timeout)" | |
147 | } | |
148 | } | |
149 | ||
150 | send_gdb "ptype B\n" | |
151 | gdb_expect { | |
152 | -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}\}\r\n$gdb_prompt $" { | |
153 | pass "ptype B" | |
154 | } | |
155 | -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}\}\r\n$gdb_prompt $" { | |
156 | pass "ptype B (obsolescent gcc or gdb)" | |
157 | } | |
158 | -re ".*$gdb_prompt $" { | |
159 | fail "ptype B" | |
160 | } | |
161 | timeout { | |
162 | fail "ptype B (timeout)" | |
163 | } | |
164 | } | |
165 | ||
166 | send_gdb "ptype C\n" | |
167 | gdb_expect { | |
168 | -re "type = class C : public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int c;\[\r\n\t \]+\}\r\n$gdb_prompt $" { | |
169 | pass "ptype C (aCC)" | |
170 | } | |
171 | -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}\}\r\n$gdb_prompt $" { | |
172 | pass "ptype C" | |
173 | } | |
174 | -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}\}\r\n$gdb_prompt $" { | |
175 | pass "ptype C (obsolescent gcc or gdb)" | |
176 | } | |
177 | -re ".*$gdb_prompt $" { | |
178 | fail "ptype C" | |
179 | } | |
180 | timeout { | |
181 | fail "ptype C (timeout)" | |
182 | } | |
183 | } | |
184 | ||
185 | send_gdb "ptype AD\n" | |
186 | gdb_expect { | |
187 | -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\}\r\n$gdb_prompt $" { | |
188 | pass "ptype AD" | |
189 | } | |
190 | -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { | |
191 | pass "ptype AD (obsolescent gcc or gdb)" | |
192 | } | |
193 | -re ".*$gdb_prompt $" { | |
194 | fail "ptype AD" | |
195 | } | |
196 | timeout { | |
197 | fail "ptype AD (timeout)" | |
198 | } | |
199 | } | |
200 | ||
201 | send_gdb "ptype D\n" | |
202 | gdb_expect { | |
203 | -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { | |
204 | pass "ptype D (aCC)" | |
205 | } | |
206 | -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}\}\r\n$gdb_prompt $" { | |
207 | pass "ptype D" | |
208 | } | |
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}\}\r\n$gdb_prompt $" { | |
210 | pass "ptype D (obsolescent gcc or gdb)" | |
211 | } | |
212 | -re ".*$gdb_prompt $" { | |
213 | fail "ptype D" | |
214 | } | |
215 | timeout { | |
216 | fail "ptype D (timeout)" | |
217 | } | |
218 | } | |
219 | ||
220 | send_gdb "ptype E\n" | |
221 | gdb_expect { | |
222 | -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}\}\r\n$gdb_prompt $" { | |
223 | pass "ptype E" | |
224 | } | |
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}\}\r\n$gdb_prompt $" { | |
226 | pass "ptype E (obsolescent gcc or gdb)" | |
227 | } | |
228 | -re ".*$gdb_prompt $" { | |
229 | fail "ptype E" | |
230 | } | |
231 | timeout { | |
232 | fail "ptype E (timeout)" | |
233 | } | |
234 | } | |
235 | ||
236 | send_gdb "ptype dd\n" | |
237 | gdb_expect { | |
238 | -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { | |
239 | pass "ptype dd (aCC)" | |
240 | } | |
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}\}\r\n$gdb_prompt $" { | |
242 | pass "ptype dd" | |
243 | } | |
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}\}\r\n$gdb_prompt $" { | |
245 | pass "ptype dd (obsolescent gcc or gdb)" | |
246 | } | |
247 | -re ".*$gdb_prompt $" { | |
248 | fail "ptype dd" | |
249 | } | |
250 | timeout { | |
251 | fail "ptype dd (timeout)" | |
252 | } | |
253 | } | |
254 | ||
255 | send_gdb "ptype ppd\n" | |
256 | gdb_expect { | |
257 | -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { | |
258 | pass "ptype ppd (aCC)" | |
259 | } | |
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}\} \[*\]+\r\n$gdb_prompt $" { | |
261 | pass "ptype ppd" | |
262 | } | |
263 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
264 | pass "ptype ppd (obsolescent gcc or gdb)" | |
265 | } | |
266 | -re ".*$gdb_prompt $" { | |
267 | fail "ptype ppd" | |
268 | } | |
269 | timeout { | |
270 | fail "ptype ppd (timeout)" | |
271 | } | |
272 | } | |
273 | ||
274 | send_gdb "ptype pAd\n" | |
275 | gdb_expect { | |
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}\} \[*\]+\r\n$gdb_prompt $" { | |
277 | pass "ptype pAd" | |
278 | } | |
279 | -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { | |
280 | pass "ptype pAd (obsolescent gcc or gdb)" | |
281 | } | |
282 | -re ".*$gdb_prompt $" { | |
283 | fail "ptype pAd" | |
284 | } | |
285 | timeout { | |
286 | fail "ptype pAd (timeout)" | |
287 | } | |
288 | } | |
289 | ||
290 | send_gdb "ptype a\n" | |
291 | gdb_expect { | |
292 | -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { | |
293 | pass "ptype a (aCC)" | |
294 | } | |
295 | -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}\}\r\n$gdb_prompt $" { | |
296 | pass "ptype a" | |
297 | } | |
298 | -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}\}\r\n$gdb_prompt $" { | |
299 | pass "ptype a (obsolescent gcc or gdb)" | |
300 | } | |
301 | -re ".*$gdb_prompt $" { | |
302 | fail "ptype a" | |
303 | } | |
304 | timeout { | |
305 | fail "ptype a (timeout)" | |
306 | } | |
307 | } | |
308 | ||
309 | send_gdb "ptype b\n" | |
310 | gdb_expect { | |
311 | -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}\}\r\n$gdb_prompt $" { | |
312 | pass "ptype b" | |
313 | } | |
314 | -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}\}\r\n$gdb_prompt $" { | |
315 | pass "ptype b (obsolescent gcc or gdb)" | |
316 | } | |
317 | -re ".*$gdb_prompt $" { | |
318 | fail "ptype b" | |
319 | } | |
320 | timeout { | |
321 | fail "ptype b (timeout)" | |
322 | } | |
323 | } | |
324 | ||
325 | send_gdb "ptype c\n" | |
326 | gdb_expect { | |
327 | -re "type = class C : public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int c;\[\r\n\t \]+\}\r\n$gdb_prompt $" { | |
328 | pass "ptype c (aCC)" | |
329 | } | |
330 | -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}\}\r\n$gdb_prompt $" { | |
331 | pass "ptype c" | |
332 | } | |
333 | -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}\}\r\n$gdb_prompt $" { | |
334 | pass "ptype c (obsolescent gcc or gdb)" | |
335 | } | |
336 | -re ".*$gdb_prompt $" { | |
337 | fail "ptype c" | |
338 | } | |
339 | timeout { | |
340 | fail "ptype c (timeout)" | |
341 | } | |
342 | } | |
343 | ||
344 | send_gdb "ptype d\n" | |
345 | gdb_expect { | |
346 | -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { | |
347 | pass "ptype d (aCC)" | |
348 | } | |
349 | -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}\}\r\n$gdb_prompt $" { | |
350 | pass "ptype d" | |
351 | } | |
352 | -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}\}\r\n$gdb_prompt $" { | |
353 | pass "ptype d (obsolescent gcc or gdb)" | |
354 | } | |
355 | -re ".*$gdb_prompt $" { | |
356 | fail "ptype d" | |
357 | } | |
358 | timeout { | |
359 | fail "ptype d (timeout)" | |
360 | } | |
361 | } | |
362 | ||
363 | send_gdb "ptype e\n" | |
364 | gdb_expect { | |
365 | -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}\}\r\n$gdb_prompt $" { | |
366 | pass "ptype e" | |
367 | } | |
368 | -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}\}\r\n$gdb_prompt $" { | |
369 | pass "ptype e (obsolescent gcc or gdb)" | |
370 | } | |
371 | -re ".*$gdb_prompt $" { | |
372 | fail "ptype e" | |
373 | } | |
374 | timeout { | |
375 | fail "ptype e (timeout)" | |
376 | } | |
377 | } | |
378 | ||
379 | send_gdb "ptype v\n" | |
380 | gdb_expect { | |
381 | -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}\}\r\n$gdb_prompt $" { | |
382 | pass "ptype v" | |
383 | } | |
384 | -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}\}\r\n$gdb_prompt $" { | |
385 | pass "ptype v (obsolescent gcc or gdb)" | |
386 | } | |
387 | -re ".*$gdb_prompt $" { | |
388 | fail "ptype v" | |
389 | } | |
390 | timeout { | |
391 | fail "ptype v (timeout)" | |
392 | } | |
393 | } | |
394 | ||
395 | send_gdb "ptype vb\n" | |
396 | gdb_expect { | |
397 | -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}\}\r\n$gdb_prompt $" { | |
398 | pass "ptype vb" | |
399 | } | |
400 | -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}\}\r\n$gdb_prompt $" { | |
401 | pass "ptype vb (obsolescent gcc or gdb)" | |
402 | } | |
403 | -re ".*$gdb_prompt $" { | |
404 | fail "ptype vb" | |
405 | } | |
406 | timeout { | |
407 | fail "ptype vb (timeout)" | |
408 | } | |
409 | } | |
410 | ||
411 | send_gdb "ptype pAa\n" | |
412 | gdb_expect { | |
413 | -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { | |
414 | pass "ptype pAa (aCC)" | |
415 | } | |
416 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
417 | pass "ptype pAa" | |
418 | } | |
419 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
420 | pass "ptype pAa (obsolescent gcc or gdb)" | |
421 | } | |
422 | -re ".*$gdb_prompt $" { | |
423 | fail "ptype pAa" | |
424 | } | |
425 | timeout { | |
426 | fail "ptype pAa (timeout)" | |
427 | } | |
428 | } | |
429 | ||
430 | send_gdb "ptype pAe\n" | |
431 | gdb_expect { | |
432 | -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { | |
433 | pass "ptype pAe (aCC)" | |
434 | } | |
435 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
436 | pass "ptype pAe" | |
437 | } | |
438 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
439 | pass "ptype pAe (obsolescent gcc or gdb)" | |
440 | } | |
441 | -re ".*$gdb_prompt $" { | |
442 | fail "ptype pAe" | |
443 | } | |
444 | timeout { | |
445 | fail "ptype pAe (timeout)" | |
446 | } | |
447 | } | |
448 | ||
449 | send_gdb "ptype pBe\n" | |
450 | gdb_expect { | |
451 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
452 | pass "ptype pBe" | |
453 | } | |
454 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
455 | pass "ptype pBe (obsolescent gcc or gdb)" | |
456 | } | |
457 | -re ".*$gdb_prompt $" { | |
458 | fail "ptype pBe" | |
459 | } | |
460 | timeout { | |
461 | fail "ptype pBe (timeout)" | |
462 | } | |
463 | } | |
464 | ||
465 | send_gdb "ptype pDd\n" | |
466 | gdb_expect { | |
467 | -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { | |
468 | pass "ptype pDd (aCC)" | |
469 | } | |
470 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
471 | pass "ptype pDd" | |
472 | } | |
473 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
474 | pass "ptype pDd (obsolescent gcc or gdb)" | |
475 | } | |
476 | -re ".*$gdb_prompt $" { | |
477 | fail "ptype pDd" | |
478 | } | |
479 | timeout { | |
480 | fail "ptype pDd (timeout)" | |
481 | } | |
482 | } | |
483 | ||
484 | send_gdb "ptype pDe\n" | |
485 | gdb_expect { | |
486 | -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { | |
487 | pass "ptype pDe (aCC)" | |
488 | } | |
489 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
490 | pass "ptype pDe" | |
491 | } | |
492 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
493 | pass "ptype pDe (obsolescent gcc or gdb)" | |
494 | } | |
495 | -re ".*$gdb_prompt $" { | |
496 | fail "ptype pDe" | |
497 | } | |
498 | timeout { | |
499 | fail "ptype pDe (timeout)" | |
500 | } | |
501 | } | |
502 | ||
503 | send_gdb "ptype pVa\n" | |
504 | gdb_expect { | |
505 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
506 | pass "ptype pVa" | |
507 | } | |
508 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
509 | pass "ptype pVa (obsolescent gcc or gdb)" | |
510 | } | |
511 | -re ".*$gdb_prompt $" { | |
512 | fail "ptype pVa" | |
513 | } | |
514 | timeout { | |
515 | fail "ptype pVa (timeout)" | |
516 | } | |
517 | } | |
518 | ||
519 | send_gdb "ptype pVv\n" | |
520 | gdb_expect { | |
521 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
522 | pass "ptype pVv" | |
523 | } | |
524 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
525 | pass "ptype pVv (obsolescent gcc or gdb)" | |
526 | } | |
527 | -re ".*$gdb_prompt $" { | |
528 | fail "ptype pVv" | |
529 | } | |
530 | timeout { | |
531 | fail "ptype pVv (timeout)" | |
532 | } | |
533 | } | |
534 | ||
535 | send_gdb "ptype pVe\n" | |
536 | gdb_expect { | |
537 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
538 | pass "ptype pVe" | |
539 | } | |
540 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
541 | pass "ptype pVe (obsolescent gcc or gdb)" | |
542 | } | |
543 | -re ".*$gdb_prompt $" { | |
544 | fail "ptype pVe" | |
545 | } | |
546 | timeout { | |
547 | fail "ptype pVe (timeout)" | |
548 | } | |
549 | } | |
550 | ||
551 | send_gdb "ptype pVd\n" | |
552 | gdb_expect { | |
553 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
554 | pass "ptype pVd" | |
555 | } | |
556 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
557 | pass "ptype pVd (obsolescent gcc or gdb)" | |
558 | } | |
559 | -re ".*$gdb_prompt $" { | |
560 | fail "ptype pVd" | |
561 | } | |
562 | timeout { | |
563 | fail "ptype pVd (timeout)" | |
564 | } | |
565 | } | |
566 | ||
567 | send_gdb "ptype pADe\n" | |
568 | gdb_expect { | |
569 | -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { | |
570 | pass "ptype pADe" | |
571 | } | |
572 | -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { | |
573 | pass "ptype pADe (obsolescent gcc or gdb)" | |
574 | } | |
575 | -re ".*$gdb_prompt $" { | |
576 | fail "ptype pADe" | |
577 | } | |
578 | timeout { | |
579 | fail "ptype pADe (timeout)" | |
580 | } | |
581 | } | |
582 | ||
583 | send_gdb "ptype pEe\n" | |
584 | gdb_expect { | |
585 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
586 | pass "ptype pEe" | |
587 | } | |
588 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
589 | pass "ptype pEe (obsolescent gcc or gdb)" | |
590 | } | |
591 | -re ".*$gdb_prompt $" { | |
592 | fail "ptype pEe" | |
593 | } | |
594 | timeout { | |
595 | fail "ptype pEe (timeout)" | |
596 | } | |
597 | } | |
598 | ||
599 | send_gdb "ptype pVB\n" | |
600 | gdb_expect { | |
601 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
602 | pass "ptype pVB" | |
603 | } | |
604 | -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}\} \[*\]+\r\n$gdb_prompt $" { | |
605 | pass "ptype pVB (obsolescent gcc or gdb)" | |
606 | } | |
607 | -re ".*$gdb_prompt $" { | |
608 | fail "ptype pVB" | |
609 | } | |
610 | timeout { | |
611 | fail "ptype pVB (timeout)" | |
612 | } | |
613 | } | |
614 | } | |
615 | ||
616 | # | |
617 | # Test calling of virtual functions. | |
618 | # | |
619 | ||
620 | proc test_virtual_calls {} { | |
621 | global gdb_prompt | |
622 | global GDB | |
623 | ||
624 | if [target_info exists gdb,cannot_call_functions] { | |
625 | setup_xfail "*-*-*" 2416 | |
626 | fail "This target can not call functions" | |
627 | return 0 | |
628 | } | |
629 | ||
630 | send_gdb "print pAe->f()\n" | |
631 | gdb_expect { | |
632 | -re ".* = 20\r\n$gdb_prompt $" { pass "print pAe->f()" } | |
633 | -re "Cannot invoke functions on this machine.*$gdb_prompt $" { | |
634 | fail "print pAe->f() (cannot invoke functions, skipping virtual calls)" | |
635 | return 0 | |
636 | } | |
637 | -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" { | |
638 | fail "print pAe->f() \ | |
639 | (known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)" | |
640 | return 0 | |
641 | } | |
642 | -re ".*$gdb_prompt $" { fail "print pAe->f()" } | |
643 | timeout { fail "print pAe->f() (timeout)" } | |
644 | eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
645 | } | |
646 | ||
647 | send_gdb "print pAa->f()\n" | |
648 | gdb_expect { | |
649 | -re ".* = 1\r\n$gdb_prompt $" { pass "print pAa->f()" } | |
650 | -re ".*$gdb_prompt $" { fail "print pAa->f()" } | |
651 | timeout { fail "print pAa->f() (timeout)" } | |
652 | eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
653 | } | |
654 | ||
655 | send_gdb "print pDe->vg()\n" | |
656 | # setup_xfail "*-*-*" | |
657 | gdb_expect { | |
658 | -re ".* = 202\r\n$gdb_prompt $" { pass "print pDe->vg()" } | |
659 | -re ".*$gdb_prompt $" { fail "print pDe->vg()" } | |
660 | timeout { fail "print pDe->vg() (timeout)" } | |
661 | eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
662 | } | |
663 | ||
664 | send_gdb "print pADe->vg()\n" | |
665 | gdb_expect { | |
666 | -re ".* = 202\r\n$gdb_prompt $" { pass "print pADe->vg()" } | |
667 | -re ".*$gdb_prompt $" { fail "print pADe->vg()" } | |
668 | timeout { fail "print pADe->vg() (timeout)" } | |
669 | eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
670 | } | |
671 | ||
672 | send_gdb "print pDd->vg()\n" | |
673 | # setup_xfail "*-*-*" | |
674 | gdb_expect { | |
675 | -re ".* = 101\r\n$gdb_prompt $" { pass "print pDd->vg()" } | |
676 | -re ".*$gdb_prompt $" { fail "print pDd->vg()" } | |
677 | timeout { fail "print pDd->vg() (timeout)" } | |
678 | eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
679 | } | |
680 | ||
681 | send_gdb "print pEe->vvb()\n" | |
682 | # setup_xfail "*-*-*" | |
683 | gdb_expect { | |
684 | -re ".* = 411\r\n$gdb_prompt $" { pass "print pEe->vvb()" } | |
685 | -re ".*$gdb_prompt $" { fail "print pEe->vvb()" } | |
686 | timeout { fail "print pEe->vvb() (timeout)" } | |
687 | eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
688 | } | |
689 | ||
690 | send_gdb "print pVB->vvb()\n" | |
691 | gdb_expect { | |
692 | -re ".* = 407\r\n$gdb_prompt $" { pass "print pVB->vvb()" } | |
693 | -re ".*$gdb_prompt $" { fail "print pVB->vvb()" } | |
694 | timeout { fail "print pVB->vvb() (timeout)" } | |
695 | eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
696 | } | |
697 | ||
698 | send_gdb "print pBe->vvb()\n" | |
699 | # setup_xfail "*-*-*" | |
700 | gdb_expect { | |
701 | -re ".* = 411\r\n$gdb_prompt $" { pass "print pBe->vvb()" } | |
702 | -re ".*$gdb_prompt $" { fail "print pBe->vvb()" } | |
703 | timeout { fail "print pBe->vvb() (timeout)" } | |
704 | eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
705 | } | |
706 | ||
707 | send_gdb "print pDe->vvb()\n" | |
708 | # setup_xfail "*-*-*" | |
709 | gdb_expect { | |
710 | -re ".* = 411\r\n$gdb_prompt $" { pass "print pDe->vvb()" } | |
711 | -re ".*$gdb_prompt $" { fail "print pDe->vvb()" } | |
712 | timeout { fail "print pDe->vvb() (timeout)" } | |
713 | eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
714 | } | |
715 | ||
716 | send_gdb "print pEe->vd()\n" | |
717 | # setup_xfail "*-*-*" | |
718 | gdb_expect { | |
719 | -re ".* = 282\r\n$gdb_prompt $" { pass "print pEe->vd()" } | |
720 | -re ".*$gdb_prompt $" { fail "print pEe->vd()" } | |
721 | timeout { fail "print pEe->vd() (timeout)" } | |
722 | eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
723 | } | |
724 | ||
725 | send_gdb "print pEe->fvb()\n" | |
726 | # setup_xfail "*-*-*" | |
727 | gdb_expect { | |
728 | -re ".* = 311\r\n$gdb_prompt $" { pass "print pEe->fvb()" } | |
729 | -re ".*$gdb_prompt $" { fail "print pEe->fvb()" } | |
730 | timeout { fail "print pEe->fvb() (timeout)" } | |
731 | eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
732 | } | |
733 | ||
734 | send_gdb "print pEe->D::vg()\n" | |
735 | setup_xfail "*-*-*" | |
736 | gdb_expect { | |
737 | -re ".* = 102\r\n$gdb_prompt $" { pass "print pEe->D::vg()" } | |
738 | -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" } | |
739 | timeout { fail "print pEe->D::vg() (timeout)" } | |
740 | eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } | |
741 | } | |
742 | } | |
743 | ||
744 | proc do_tests {} { | |
745 | global prms_id | |
746 | global bug_id | |
747 | ||
748 | set prms_id 0 | |
749 | set bug_id 0 | |
750 | ||
751 | gdb_start; | |
752 | gdb_virtfunc_init; | |
753 | ||
754 | # Get the debug format for the compiled test case. If that | |
755 | # format is DWARF 1 then just skip all the tests since none of | |
756 | # them will pass. | |
757 | ||
758 | if [ runto_main ] then { | |
759 | get_debug_format | |
760 | if [ setup_xfail_format "DWARF 1" ] then { | |
761 | fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format" | |
762 | return | |
763 | } | |
764 | clear_xfail "*-*-*" | |
765 | } | |
766 | ||
767 | test_ptype_of_classes | |
768 | ||
769 | if [ runto 'test_calls(void)' ] then { | |
770 | test_virtual_calls | |
771 | } | |
772 | } | |
773 | ||
774 | do_tests |