Commit | Line | Data |
---|---|---|
b6ba6518 KB |
1 | # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 |
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 | ||
23 | set ws "\[\r\n\t \]+" | |
24 | set nl "\[\r\n\]+" | |
25 | ||
26 | if $tracelevel then { | |
27 | strace $tracelevel | |
28 | } | |
29 | ||
d4f3574e | 30 | if { [skip_cplus_tests] } { continue } |
c906108c SS |
31 | |
32 | set testfile "misc" | |
33 | set srcfile ${testfile}.cc | |
34 | set binfile ${objdir}/${subdir}/${testfile} | |
35 | ||
36 | # Create and source the file that provides information about the compiler | |
37 | # used to compile the test case. | |
38 | ||
39 | if [get_compiler_info ${binfile} "c++"] { | |
40 | return -1 | |
41 | } | |
42 | ||
c906108c SS |
43 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { |
44 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
45 | } | |
46 | ||
47 | # | |
48 | # Test ptype of class objects. | |
49 | # | |
50 | ||
51 | proc test_ptype_class_objects {} { | |
52 | global gdb_prompt | |
53 | global ws | |
54 | global nl | |
55 | ||
56 | # Note that struct members are public by default, so we don't print | |
57 | # "public:" for the public members of structs. | |
58 | # Accept it as an expected failure if gdb just fails to distinguish between | |
59 | # class and struct, and everything else is OK. | |
60 | ||
61 | send_gdb "ptype struct default_public_struct\n" | |
62 | gdb_expect { | |
63 | -re "type = struct default_public_struct \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { | |
64 | pass "ptype struct default_public_struct" | |
65 | } | |
66 | -re "type = class default_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
67 | setup_xfail "*-*-*" | |
68 | fail "ptype struct default_public_struct" | |
69 | } | |
70 | -re ".*$gdb_prompt $" { fail "ptype struct default_public_struct" } | |
71 | timeout { fail "ptype struct default_public_struct (timeout)" ; return } | |
72 | } | |
73 | ||
74 | # Note that struct members are public by default, so we don't print | |
75 | # "public:" for the public members of structs. | |
76 | # Accept it as an expected failure if gdb just fails to distinguish between | |
77 | # class and struct, and everything else is OK. | |
78 | ||
79 | send_gdb "ptype struct explicit_public_struct\n" | |
80 | gdb_expect { | |
81 | -re "type = struct explicit_public_struct \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
82 | pass "ptype struct explicit_public_struct" | |
83 | } | |
84 | -re "type = class explicit_public_struct \{$nl.*int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
85 | setup_xfail "*-*-*" | |
86 | fail "ptype struct explicit_public_struct" | |
87 | } | |
88 | -re ".*$gdb_prompt $" { fail "ptype struct explicit_public_struct" } | |
89 | timeout { fail "ptype struct explicit_public_struct (timeout)" ; return } | |
90 | } | |
91 | ||
92 | # Accept it as an expected failure if gdb just fails to distinguish between | |
93 | # class and struct, and everything else is OK. | |
94 | ||
95 | setup_xfail_format "DWARF 1" | |
96 | send_gdb "ptype struct protected_struct\n" | |
97 | gdb_expect { | |
98 | -re "type = struct protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { | |
99 | pass "ptype struct protected_struct (FIXME)" | |
100 | } | |
101 | -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
102 | setup_xfail "*-*-*" | |
103 | fail "ptype struct protected_struct (FIXME)" | |
104 | } | |
105 | -re ".*$gdb_prompt $" { fail "ptype struct protected_struct" } | |
106 | timeout { fail "ptype struct protected_struct (timeout)" ; return } | |
107 | } | |
108 | ||
109 | # Accept it as an expected failure if gdb just fails to distinguish between | |
110 | # class and struct, and everything else is OK. | |
111 | ||
112 | setup_xfail_format "DWARF 1" | |
113 | send_gdb "ptype struct private_struct\n" | |
114 | gdb_expect { | |
115 | -re "type = struct private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { | |
116 | pass "ptype struct private_struct (FIXME)" | |
117 | } | |
118 | -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
119 | setup_xfail "*-*-*" | |
120 | fail "ptype struct private_struct (FIXME)" | |
121 | } | |
122 | -re ".*$gdb_prompt $" { fail "ptype struct private_struct" } | |
123 | timeout { fail "ptype struct private_struct (timeout)" ; return } | |
124 | } | |
125 | ||
126 | # Accept it as an expected failure if gdb just fails to distinguish between | |
127 | # class and struct, and everything else is OK. | |
128 | ||
129 | setup_xfail_format "DWARF 1" | |
130 | send_gdb "ptype struct mixed_protection_struct\n" | |
131 | gdb_expect { | |
132 | -re "type = struct mixed_protection_struct \{${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" { | |
133 | pass "ptype struct mixed_protection_struct (FIXME)" | |
134 | } | |
a0b3c4fd JM |
135 | -re "type = struct mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { |
136 | pass "ptype struct mixed_protection_struct (extra public)" | |
137 | } | |
c906108c SS |
138 | -re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { |
139 | setup_xfail "*-*-*" | |
140 | fail "ptype struct mixed_protection_struct (FIXME)" | |
141 | } | |
142 | -re ".*$gdb_prompt $" { fail "ptype struct mixed_protection_struct" } | |
143 | timeout { fail "ptype struct mixed_protection_struct (timeout)" ; return } | |
144 | } | |
145 | ||
146 | # Accept it as an expected failure if gdb just fails to distinguish between | |
147 | # class and struct, and everything else is OK. | |
148 | ||
149 | send_gdb "ptype class public_class\n" | |
150 | gdb_expect { | |
151 | -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
152 | pass "ptype class public_class (FIXME)" | |
153 | } | |
154 | -re "type = struct public_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { | |
155 | setup_xfail "*-*-*" | |
156 | fail "ptype class public_class (FIXME)" | |
157 | } | |
158 | -re ".*$gdb_prompt $" { fail "ptype class public_class" } | |
159 | timeout { fail "ptype class public_class (timeout)" ; return } | |
160 | } | |
161 | ||
162 | send_gdb "ptype class protected_class\n" | |
163 | gdb_expect { | |
164 | -re "type = class protected_class \{${ws}protected:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
165 | pass "ptype class protected_class" | |
166 | } | |
167 | -re "type = struct protected_class \{${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" { | |
168 | setup_xfail "*-*-*" | |
169 | fail "ptype class protected_class" | |
170 | } | |
171 | -re ".*$gdb_prompt $" { fail "ptype class protected_class" } | |
172 | timeout { fail "ptype class protected_class (timeout)" ; return } | |
173 | } | |
174 | ||
175 | # Accept it as an expected failure if gdb just emits a superflous "private:" | |
176 | # attribute, since classes default to private and for consistency with | |
177 | # structs (where we don't print the "public:" attribute) we don't print | |
178 | # the "private:" attribute. | |
179 | ||
180 | setup_xfail_format "DWARF 1" | |
181 | send_gdb "ptype class default_private_class\n" | |
182 | gdb_expect { | |
183 | -re "type = class default_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
184 | pass "ptype class default_private_class (FIXME)" | |
185 | } | |
186 | -re "type = class default_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
187 | setup_xfail "*-*-*" | |
188 | fail "ptype class default_private_class (FIXME)" | |
189 | } | |
190 | -re ".*$gdb_prompt $" { fail "ptype class default_private_class" } | |
191 | timeout { fail "ptype class default_private_class (timeout)" ; return } | |
192 | } | |
193 | ||
194 | send_gdb "ptype class explicit_private_class\n" | |
195 | gdb_expect { | |
196 | -re "type = class explicit_private_class \{${ws}private:${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { | |
197 | pass "ptype class explicit_private_class" | |
198 | } | |
a0b3c4fd JM |
199 | -re "type = class explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { |
200 | pass "ptype class explicit_private_class (OK for HP aCC)" | |
201 | } | |
c906108c SS |
202 | -re "type = struct explicit_private_class \{${ws}int a;${ws}int b;$nl.*\}$nl$gdb_prompt $" { |
203 | setup_xfail "*-*-*" | |
204 | fail "ptype class explicit_private_class" | |
205 | } | |
206 | -re ".*$gdb_prompt $" { fail "ptype class explicit_private_class" } | |
207 | timeout { fail "ptype class explicit_private_class (timeout)" ; return } | |
208 | } | |
209 | ||
210 | send_gdb "ptype class mixed_protection_class\n" | |
211 | gdb_expect { | |
212 | -re "type = class mixed_protection_class \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl.*\}$nl$gdb_prompt $" { | |
213 | pass "ptype class mixed_protection_class" | |
214 | } | |
215 | -re "type = struct mixed_protection_class \{${ws}int a;${ws}int b;${ws}int c;${ws}int d;${ws}int e;${ws}int f;${ws}int g;${ws}int h;${ws}int i;$nl.*\}$nl$gdb_prompt $" { | |
216 | setup_xfail "*-*-*" | |
217 | fail "ptype class mixed_protection_class" | |
218 | } | |
219 | -re ".*$gdb_prompt $" { fail "ptype class mixed_protection_class" } | |
220 | timeout { fail "ptype class mixed_protection_class (timeout)" ; return } | |
221 | } | |
222 | ||
223 | # This class does not use any C++-specific features, so it's fine for | |
224 | # it to print as "struct". | |
225 | send_gdb "ptype class A\n" | |
226 | gdb_expect { | |
4970cb0f | 227 | -re "type = (class|struct) A \{(${ws}public:|)${ws}int a;${ws}int x;((${ws}A & operator=\\(A const ?&\\);)|(${ws}A\\(A const ?&\\);)|(${ws}A\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
228 | pass "ptype class A" |
229 | } | |
230 | -re ".*$gdb_prompt $" { | |
231 | fail "ptype class A" | |
232 | } | |
233 | timeout { | |
234 | fail "ptype class A (timeout)" | |
235 | return | |
236 | } | |
237 | } | |
238 | ||
239 | setup_xfail_format "DWARF 1" | |
240 | send_gdb "ptype class B\n" | |
241 | gdb_expect { | |
4970cb0f | 242 | -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;${ws}B & operator=\\(B const &\\);${ws}B\\(B const &\\);${ws}B\\((void|)\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
243 | pass "ptype class B" |
244 | } | |
4970cb0f | 245 | -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(B const &\\);)|(${ws}B\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
246 | pass "ptype class B (obsolescent gcc or gdb)" |
247 | } | |
248 | -re ".*$gdb_prompt $" { | |
249 | fail "ptype class B" | |
250 | } | |
251 | timeout { | |
252 | fail "ptype class B (timeout)" | |
253 | return | |
254 | } | |
255 | } | |
256 | ||
257 | setup_xfail_format "DWARF 1" | |
258 | send_gdb "ptype class C\n" | |
259 | gdb_expect { | |
4970cb0f | 260 | -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;${ws}C & operator=\\(C const &\\);${ws}C\\(C const &\\);${ws}C\\((void|)\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
261 | pass "ptype class C" |
262 | } | |
4970cb0f | 263 | -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(C const &\\);)|(${ws}C\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
264 | pass "ptype class C (obsolescent gcc or gdb)" |
265 | } | |
266 | -re ".*$gdb_prompt $" { | |
267 | fail "ptype class C" | |
268 | } | |
269 | timeout { | |
270 | fail "ptype class C (timeout)" | |
271 | return | |
272 | } | |
273 | } | |
274 | ||
275 | setup_xfail_format "DWARF 1" | |
276 | send_gdb "ptype class D\n" | |
277 | gdb_expect { | |
4970cb0f | 278 | -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;${ws}D & operator=\\(D const &\\);${ws}D\\(D const &\\);${ws}D\\((void|)\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
279 | pass "ptype class D" |
280 | } | |
4970cb0f | 281 | -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(D const &\\);)|(${ws}D\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
282 | pass "ptype class D (obsolescent gcc or gdb)" |
283 | } | |
284 | -re ".*$gdb_prompt $" { | |
285 | fail "ptype class D" | |
286 | } | |
287 | timeout { | |
288 | fail "ptype class D (timeout)" | |
289 | return | |
290 | } | |
291 | } | |
292 | ||
293 | setup_xfail_format "DWARF 1" | |
294 | send_gdb "ptype class E\n" | |
295 | gdb_expect { | |
4970cb0f | 296 | -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;${ws}E & operator=\\(E const &\\);${ws}E\\(E const &\\);${ws}E\\((void|)\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
297 | pass "ptype class E" |
298 | } | |
4970cb0f | 299 | -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(E const &\\);)|(${ws}E\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
300 | pass "ptype class E" |
301 | } | |
302 | -re ".*$gdb_prompt $" { | |
303 | fail "ptype class E" | |
304 | } | |
305 | timeout { | |
306 | fail "ptype class E (timeout)" | |
307 | return | |
308 | } | |
309 | } | |
310 | ||
311 | send_gdb "ptype class vA\n" | |
312 | gdb_expect { | |
4970cb0f | 313 | -re "type = (class|struct) vA \{(${ws}public:|)${ws}int va;${ws}int vx;${ws}vA & operator=\\(vA const &\\);${ws}vA\\(vA const &\\);${ws}vA\\((void|)\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
314 | pass "ptype class vA" |
315 | } | |
4970cb0f | 316 | -re "type = (class|struct) vA \{(${ws}public:|)${ws}int va;${ws}int vx;((${ws}vA & operator=\\(vA const &\\);)|(${ws}vA\\(vA const &\\);)|(${ws}vA\\((void|)\\);))*${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
317 | pass "ptype class vA (obsolescent gcc or gdb)" |
318 | } | |
319 | -re ".*$gdb_prompt $" { | |
320 | fail "ptype class vA" | |
321 | } | |
322 | timeout { | |
323 | fail "ptype class vA (timeout)" | |
324 | return | |
325 | } | |
326 | } | |
327 | ||
328 | # Accept the form with embedded GNU style mangled virtual table constructs | |
329 | # for now, but with a FIXME. At some future point, gdb should use a | |
330 | # portable representation for the virtual table constructs. | |
331 | ||
c2d11a7d JM |
332 | # The format of a g++ virtual base pointer. |
333 | set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?" | |
334 | ||
c906108c SS |
335 | setup_xfail_format "DWARF 1" |
336 | send_gdb "ptype class vB\n" | |
337 | gdb_expect { | |
c2d11a7d | 338 | -re "type = class vB : public virtual vA \{${ws}private:${ws}vA \\*${vbptr}vA;${ws}public:${ws}int vb;${ws}int vx;${ws}vB & operator=\\(vB const &\\);${ws}vB\\(int, vB const &\\);${ws}vB\\(int\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
339 | setup_xfail "*-*-*" |
340 | fail "ptype class vB (FIXME: non-portable virtual table constructs)" | |
341 | } | |
a0b3c4fd JM |
342 | -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}\}$nl$gdb_prompt $" { |
343 | pass "ptype class vB (aCC)" | |
344 | } | |
c906108c SS |
345 | -re "type = class vB : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vb;${ws}int vx;((${ws}vB & operator=\\(vB const &\\);)|(${ws}vB\\(int, vB const &\\);)|(${ws}vB\\(int\\);))*${ws}\}$nl$gdb_prompt $" { |
346 | setup_xfail "*-*-*" | |
347 | fail "ptype class vB (FIXME) (obsolescent gcc or gdb)" | |
348 | } | |
349 | -re ".*$gdb_prompt $" { | |
350 | fail "ptype class vB" | |
351 | } | |
352 | timeout { | |
353 | fail "ptype class vB (timeout)" | |
354 | return | |
355 | } | |
356 | } | |
357 | ||
358 | # Accept the form with embedded GNU style mangled virtual table constructs | |
359 | # for now, but with a FIXME. At some future point, gdb should use a | |
360 | # portable representation for the virtual table constructs. | |
361 | ||
362 | setup_xfail_format "DWARF 1" | |
363 | send_gdb "ptype class vC\n" | |
364 | gdb_expect { | |
c2d11a7d | 365 | -re "type = class vC : public virtual vA \{${ws}private:${ws}vA \\*${vbptr}vA;${ws}public:${ws}int vc;${ws}int vx;${ws}vC & operator=\\(vC const &\\);${ws}vC\\(int, vC const &\\);${ws}vC\\(int\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
366 | setup_xfail "*-*-*" |
367 | fail "ptype class vC (FIXME: non-portable virtual table constructs)" | |
368 | } | |
a0b3c4fd JM |
369 | -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}\}$nl$gdb_prompt $" { |
370 | pass "ptype class vC (aCC)" | |
371 | } | |
c906108c SS |
372 | -re "type = class vC : public virtual vA \{${ws}private:${ws}vA \\*_vb.vA;${ws}public:${ws}int vc;${ws}int vx;((${ws}vC & operator=\\(vC const &\\);)|(${ws}vC\\(int, vC const &\\);)|(${ws}vC\\(int\\);))*${ws}\}$nl$gdb_prompt $" { |
373 | setup_xfail "*-*-*" | |
374 | fail "ptype class vC (FIXME) (obsolescent gcc or gdb)" | |
375 | } | |
376 | -re ".*$gdb_prompt $" { | |
377 | fail "ptype class vC" | |
378 | } | |
379 | timeout { | |
380 | fail "ptype class vC (timeout)" | |
381 | return | |
382 | } | |
383 | } | |
384 | ||
385 | # Accept the form with embedded GNU style mangled virtual table constructs | |
386 | # for now, but with a FIXME. At some future point, gdb should use a | |
387 | # portable representation for the virtual table constructs. | |
388 | ||
389 | setup_xfail_format "DWARF 1" | |
390 | send_gdb "ptype class vD\n" | |
391 | gdb_expect { | |
c2d11a7d | 392 | -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;${ws}vD & operator=\\(vD const &\\);${ws}vD\\(int, vD const &\\);${ws}vD\\(int\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
393 | setup_xfail "*-*-*" |
394 | fail "ptype class vD (FIXME: non-portable virtual table constructs)" | |
395 | } | |
a0b3c4fd JM |
396 | -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}\}$nl$gdb_prompt $" { |
397 | pass "ptype class vD (aCC)" | |
398 | } | |
c906108c SS |
399 | -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*_vb.vC;${ws}vB \\*_vb.vB;${ws}public:${ws}int vd;${ws}int vx;((${ws}vD & operator=\\(vD const &\\);)|(${ws}vD\\(int, vD const &\\);)|(${ws}vD\\(int\\);))*${ws}\}$nl$gdb_prompt $" { |
400 | setup_xfail "*-*-*" | |
401 | fail "ptype class vD (FIXME) (obsolescent gcc or gdb)" | |
402 | } | |
403 | -re ".*$gdb_prompt $" { | |
404 | fail "ptype class vD" | |
405 | } | |
406 | timeout { | |
407 | fail "ptype class vD (timeout)" | |
408 | return | |
409 | } | |
410 | } | |
411 | ||
412 | # Accept the form with embedded GNU style mangled virtual table constructs | |
413 | # for now, but with a FIXME. At some future point, gdb should use a | |
414 | # portable representation for the virtual table constructs. | |
415 | ||
416 | setup_xfail_format "DWARF 1" | |
417 | send_gdb "ptype class vE\n" | |
418 | gdb_expect { | |
c2d11a7d | 419 | -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;${ws}vE & operator=\\(vE const &\\);${ws}vE\\(int, vE const &\\);${ws}vE\\(int\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
420 | setup_xfail "*-*-*" |
421 | fail "ptype class vE (FIXME: non-portable virtual table constructs)" | |
422 | } | |
a0b3c4fd JM |
423 | -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}\}$nl$gdb_prompt $" { |
424 | pass "ptype class vE (aCC)" | |
425 | } | |
c906108c SS |
426 | -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*_vb.vD;${ws}public:${ws}int ve;${ws}int vx;((${ws}vE & operator=\\(vE const &\\);)|(${ws}vE\\(int, vE const &\\);)|(${ws}vE\\(int\\);))*${ws}\}$nl$gdb_prompt $" { |
427 | setup_xfail "*-*-*" | |
428 | fail "ptype class vE (FIXME) (obsolescent gcc or gdb)" | |
429 | } | |
430 | -re ".*$gdb_prompt $" { | |
431 | fail "ptype class vE" | |
432 | } | |
433 | timeout { | |
434 | fail "ptype class vE (timeout)" | |
435 | return | |
436 | } | |
437 | } | |
438 | ||
439 | setup_xfail_format "DWARF 1" | |
440 | send_gdb "ptype class Base1\n" | |
441 | gdb_expect { | |
442 | -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1 & operator=\\(Base1 const &\\);${ws}Base1\\(Base1 const &\\);${ws}Base1\\(int\\);${ws}\}$nl$gdb_prompt $" { | |
443 | pass "ptype class Base1" | |
444 | } | |
445 | -re "type = class Base1 \{${ws}public:${ws}int x;((${ws}Base1 & operator=\\(Base1 const &\\);)|(${ws}Base1\\(Base1 const &\\);)|(${ws}Base1\\(int\\);))*${ws}\}$nl$gdb_prompt $" { | |
446 | pass "ptype class Base1 (obsolescent gcc or gdb)" | |
447 | } | |
448 | -re ".*$gdb_prompt $" { | |
449 | fail "ptype class Base1" | |
450 | } | |
451 | timeout { | |
452 | fail "ptype class Base1 (timeout)" | |
453 | return | |
454 | } | |
455 | } | |
456 | ||
457 | setup_xfail_format "DWARF 1" | |
458 | send_gdb "ptype class Foo\n" | |
459 | gdb_expect { | |
a0b3c4fd JM |
460 | -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;\r\n${ws}Foo\\(int, int\\);${ws}int operator!.void.;${ws}operator int.void.;${ws}int times.int.;$nl\}$nl$gdb_prompt $" { |
461 | pass "ptype class Foo(aCC)" | |
462 | } | |
4970cb0f | 463 | -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo & operator=\\(Foo const &\\);${ws}Foo\\(Foo const &\\);${ws}Foo\\(int, int\\);${ws}int operator!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
464 | pass "ptype class Foo" |
465 | } | |
4970cb0f | 466 | -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;((${ws}Foo & operator=\\(Foo const &\\);)|(${ws}Foo\\(Foo const &\\);)|(${ws}Foo\\(int, int\\);)|(${ws}int operator!\\((void|)\\);)|(${ws}int operator int\\((void|)\\);)|(${ws}int times\\(int\\);))*${ws}\}$nl$gdb_prompt $" { |
c906108c SS |
467 | pass "ptype class Foo (obsolescent gcc or gdb)" |
468 | } | |
469 | -re ".*$gdb_prompt $" { | |
470 | fail "ptype class Foo" | |
471 | } | |
472 | timeout { | |
473 | fail "ptype class Foo (timeout)" | |
474 | return | |
475 | } | |
476 | } | |
477 | ||
478 | setup_xfail_format "DWARF 1" | |
479 | send_gdb "ptype class Bar\n" | |
480 | gdb_expect { | |
481 | -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar & operator=\\(Bar const &\\);${ws}Bar\\(Bar const &\\);${ws}Bar\\(int, int, int\\);${ws}\}$nl$gdb_prompt $" { | |
482 | pass "ptype class Bar" | |
483 | } | |
484 | -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;((${ws}Bar & operator=\\(Bar const &\\);)|(${ws}Bar\\(Bar const &\\);)|(${ws}Bar\\(int, int, int\\);))*${ws}\}$nl$gdb_prompt $" { | |
485 | pass "ptype class Bar (obsolescent gcc or gdb)" | |
486 | } | |
487 | -re ".*$gdb_prompt $" { | |
488 | fail "ptype class Bar" | |
489 | } | |
490 | timeout { | |
491 | fail "ptype class Bar (timeout)" | |
492 | return | |
493 | } | |
494 | } | |
495 | } | |
496 | ||
497 | # | |
498 | # Test simple access to class members. | |
499 | # | |
500 | ||
501 | proc test_non_inherited_member_access {} { | |
502 | global gdb_prompt | |
503 | ||
504 | # Print non-inherited members of g_A. | |
505 | ||
506 | gdb_test "print g_A.a" ".* = 1" "g_A.a incorrect" | |
507 | ||
508 | gdb_test "print g_A.x" ".* = 2" "g_A.x incorrect" | |
509 | ||
510 | # Print non-inherited members of g_B. | |
511 | ||
512 | gdb_test "print g_B.b" ".* = 5" "g_B.b incorrect" | |
513 | ||
514 | gdb_test "print g_B.x" ".* = 6" "g_B.x incorrect" | |
515 | ||
516 | # Print non-inherited members of g_C. | |
517 | ||
518 | gdb_test "print g_C.c" ".* = 9" "g_C.c incorrect" | |
519 | ||
520 | gdb_test "print g_C.x" ".* = 10" "g_C.x incorrect" | |
521 | ||
522 | # Print non-inherited members of g_D. | |
523 | ||
524 | gdb_test "print g_D.d" ".* = 19" "g_D.d incorrect" | |
525 | ||
526 | gdb_test "print g_D.x" ".* = 20" "g_D.x incorrect" | |
527 | ||
528 | # Print non-inherited members of g_E. | |
529 | ||
530 | gdb_test "print g_E.e" ".* = 31" "g_E.e incorrect" | |
531 | ||
532 | gdb_test "print g_E.x" ".* = 32" "g_E.x incorrect" | |
533 | } | |
534 | ||
535 | # | |
536 | # Try access to non-members that are members of another class. | |
537 | # Should give errors. | |
538 | # | |
539 | ||
540 | proc test_wrong_class_members {} { | |
541 | global gdb_prompt | |
542 | ||
543 | gdb_test "print g_A.b" "There is no member( or method|) named b." "print g_A.b should be error" | |
544 | ||
545 | gdb_test "print g_B.c" "There is no member( or method|) named c." "print g_B.c should be error" | |
546 | ||
547 | gdb_test "print g_B.d" "There is no member( or method|) named d." "print g_B.d should be error" | |
548 | ||
549 | gdb_test "print g_C.b" "There is no member( or method|) named b." "print g_C.b should be error" | |
550 | ||
551 | gdb_test "print g_C.d" "There is no member( or method|) named d." "print g_C.d should be error" | |
552 | ||
553 | gdb_test "print g_D.e" "There is no member( or method|) named e." "print g_D.e should be error" | |
554 | } | |
555 | ||
556 | # | |
557 | # Try access to non-members that are not members of any class. | |
558 | # Should give errors. | |
559 | # | |
560 | ||
2bec0572 | 561 | proc test_nonexistent_members {} { |
c906108c SS |
562 | global gdb_prompt |
563 | ||
564 | gdb_test "print g_A.y" "There is no member( or method|) named y." "print g_A.y should be error" | |
565 | ||
566 | gdb_test "print g_B.z" "There is no member( or method|) named z." "print g_B.z should be error" | |
567 | ||
568 | gdb_test "print g_C.q" "There is no member( or method|) named q." "print g_C.q should be error" | |
569 | ||
570 | gdb_test "print g_D.p" "There is no member( or method|) named p." "print g_D.p should be error" | |
571 | } | |
572 | ||
54602222 ND |
573 | # |
574 | # Call a method that expects a base class parameter with base, inherited, | |
575 | # and unrelated class arguments. | |
576 | # | |
577 | ||
578 | proc test_method_param_class {} { | |
579 | gdb_test "call class_param.Aptr_a (&g_A)" ".* = 1" "base class param->a" | |
580 | gdb_test "call class_param.Aptr_x (&g_A)" ".* = 2" "base class param->x" | |
581 | gdb_test "call class_param.Aptr_a (&g_B)" ".* = 3" "inherited class param->a" | |
582 | gdb_test "call class_param.Aptr_x (&g_B)" ".* = 4" "inherited class param->x" | |
583 | gdb_test "call class_param.Aref_a (g_A)" ".* = 1" "base class (¶m)->a" | |
584 | gdb_test "call class_param.Aref_x (g_A)" ".* = 2" "base class (¶m)->x" | |
585 | gdb_test "call class_param.Aref_a (g_B)" ".* = 3" "inherited class (¶m)->a" | |
586 | gdb_test "call class_param.Aref_x (g_B)" ".* = 4" "inherited class (¶m)->x" | |
587 | gdb_test "call class_param.Aval_a (g_A)" ".* = 1" "base class param.a" | |
588 | gdb_test "call class_param.Aval_x (g_A)" ".* = 2" "base class param.x" | |
589 | gdb_test "call class_param.Aval_a (g_B)" ".* = 3" "inherited class param.a" | |
590 | gdb_test "call class_param.Aval_x (g_B)" ".* = 4" "inherited class param.x" | |
591 | ||
592 | gdb_test "call class_param.Aptr_a (&foo)" "Cannot resolve .*" "unrelated class *param" | |
593 | gdb_test "call class_param.Aref_a (foo)" "Cannot resolve .*" "unrelated class ¶m" | |
594 | gdb_test "call class_param.Aval_a (foo)" "Cannot resolve .*" "unrelated class param" | |
595 | } | |
596 | ||
2bec0572 ND |
597 | # |
598 | # Examine a class with an enum field. | |
599 | # | |
600 | ||
601 | proc test_enums {} { | |
602 | global gdb_prompt | |
603 | global hp_aCC_compiler | |
604 | ||
605 | # print the object | |
606 | send_gdb "print obj_with_enum\n" | |
607 | gdb_expect { | |
608 | -re "\\$\[0-9\]* = \\{priv_enum = red, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (1)" } | |
609 | -re "$gdb_prompt $" { fail "print obj_with_enum (1)" } | |
610 | timeout { fail "(timeout) print obj_with_enum (1)" } | |
611 | } | |
612 | ||
613 | send_gdb "next\n" | |
614 | gdb_expect { | |
615 | -re "$gdb_prompt $" { pass "next" } | |
616 | timeout { fail "(timeout) next" } | |
617 | } | |
618 | ||
619 | # print the object again | |
620 | send_gdb "print obj_with_enum\n" | |
621 | gdb_expect { | |
622 | -re "\\$\[0-9\]* = \\{priv_enum = green, x = 0\\}.*$gdb_prompt $" { pass "print obj_with_enum (2)" } | |
623 | -re "$gdb_prompt $" { fail "print obj_with_enum (2)" } | |
624 | timeout { fail "(timeout) print obj_with_enum (2)" } | |
625 | } | |
626 | ||
627 | # print out the enum member | |
628 | send_gdb "print obj_with_enum.priv_enum\n" | |
629 | gdb_expect { | |
630 | -re "\\$\[0-9\]* = green.*$gdb_prompt $" { pass "print obj_with_enum.priv_enum" } | |
631 | -re "$gdb_prompt $" { fail "print obj_with_enum.priv_enum" } | |
632 | timeout { fail "(timeout) print obj_with_enum.priv_enum" } | |
633 | } | |
634 | ||
635 | # ptype on the enum member | |
636 | # The third success case is a little dubious, but it's not clear what | |
637 | # ought to be required of a ptype on a private enum... -sts 19990324 | |
638 | send_gdb "ptype obj_with_enum.priv_enum\n" | |
639 | gdb_expect { | |
640 | -re "type = enum ClassWithEnum::PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" } | |
641 | -re "type = enum PrivEnum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" } | |
642 | -re "type = enum \\{red, green, blue, yellow = 42\\}.*$gdb_prompt $" { pass "ptype obj_with_enum.priv_enum" } | |
643 | -re "$gdb_prompt $" { fail "ptype obj_with_enum.priv_enum" } | |
644 | timeout { fail "(timeout) ptype obj_with_enum.priv_enum" } | |
645 | } | |
646 | ||
647 | # ptype on the object | |
648 | # g++ is putting out the wrong debug info. This works with aCC | |
649 | if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} | |
650 | send_gdb "ptype obj_with_enum\n" | |
651 | gdb_expect { | |
652 | -re "type = class ClassWithEnum \\{\r\n\[ \t\]*public:\r\n\[ \t\]*(enum |)ClassWithEnum::PrivEnum priv_enum;\r\n\[ \t\]*int x;\r\n\\}\r\n$gdb_prompt $" { pass "ptype obj_with_enum" } | |
653 | -re "$gdb_prompt $" { fail "ptype obj_with_enum" } | |
654 | timeout { fail "(timeout) ptype obj_with_enum" } | |
655 | } | |
656 | ||
657 | # g++ is putting out the wrong debug info. This works with aCC | |
658 | if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} | |
659 | send_gdb "print (ClassWithEnum::PrivEnum) 42\n" | |
660 | gdb_expect { | |
661 | -re "\\$\[0-9\]* = yellow.*$gdb_prompt $" { pass "print (ClassWithEnum::PrivEnum) 42" } | |
662 | -re "$gdb_prompt $" { fail "print (ClassWithEnum::PrivEnum) 42" } | |
663 | timeout { fail "(timeout) print (ClassWithEnum::PrivEnum) 42" } | |
664 | } | |
665 | } | |
666 | ||
c906108c SS |
667 | # |
668 | # Pointers to class members | |
669 | # | |
670 | ||
671 | proc test_pointers_to_class_members {} { | |
672 | global gdb_prompt | |
673 | global decimal | |
674 | global nl | |
675 | ||
676 | gdb_test "print Bar::z" ".* = .int\[ \]*\[( \]*Bar::&\[)\]+\[ \]*Bar::z" "print Bar::z" | |
677 | ||
678 | gdb_test "print &Foo::x" ".* = .int\[ \]*\[( \]*Foo::\[*)\]+\[ \]*&Foo::x" "print &Foo::x" | |
679 | ||
680 | gdb_test "print (int)&Foo::x" ".* = 0" "print (int)&Foo::x" | |
681 | ||
682 | send_gdb "print (int)&Bar::y == 2*sizeof(int)\n" | |
683 | gdb_expect { | |
684 | -re ".* = true$nl$gdb_prompt $" { | |
685 | pass "print (int)&Bar::y == 2*sizeof(int)" | |
686 | } | |
687 | -re "There is no field named y.*$gdb_prompt $" { | |
688 | setup_xfail "*-*-*" | |
689 | fail "print (int)&Bar::y == 2*sizeof(int)" | |
690 | } | |
691 | -re ".*$gdb_prompt $" { fail "print (int)&Bar::y == 2*sizeof(int)" } | |
692 | timeout { fail "print (int)&Bar::y == 2*sizeof(int) (timeout)" ; return } | |
693 | } | |
694 | ||
a0b3c4fd | 695 | send_gdb "next 2\n" |
c906108c SS |
696 | setup_xfail "*-*-*" |
697 | gdb_expect { | |
698 | -re "$decimal\[ \t\]+inheritance3 \[)(\]+;$nl$gdb_prompt $" {} | |
699 | -re ".*$gdb_prompt $" { fail "next to inheritance3" ; return } | |
700 | } | |
701 | clear_xfail "*-*-*" | |
702 | ||
703 | setup_xfail_format "DWARF 1" | |
704 | gdb_test "print (int)pmi == sizeof(int)" ".* = false" "print (int)pmi == sizeof(int)" | |
705 | } | |
706 | ||
707 | # | |
708 | # Test static members. | |
709 | # | |
710 | ||
711 | proc test_static_members {} { | |
712 | global gdb_prompt | |
713 | global hex | |
714 | global nl | |
715 | ||
716 | send_gdb "print Foo::st\n" | |
717 | gdb_expect { | |
718 | -re ".* = 100$nl$gdb_prompt $" { | |
719 | pass "print Foo::st" | |
720 | } | |
721 | -re "There is no field named st.*$gdb_prompt $" { | |
722 | setup_xfail "*-*-*" | |
723 | fail "print Foo::st" | |
724 | } | |
725 | -re ".*$gdb_prompt $" { fail "print Foo::st" } | |
726 | timeout { fail "print Foo::st (timeout)" ; return } | |
727 | } | |
728 | ||
729 | send_gdb "set foo.st = 200\n" | |
730 | gdb_expect { | |
731 | -re ".*$gdb_prompt $" {} | |
732 | } | |
733 | ||
734 | send_gdb "print bar.st\n" | |
735 | gdb_expect { | |
736 | -re ".* = 200$nl$gdb_prompt $" { | |
737 | pass "print bar.st" | |
738 | } | |
739 | -re "There is no member( or method|) named st.*$gdb_prompt $" { | |
740 | setup_xfail "*-*-*" | |
741 | fail "print bar.st" | |
742 | } | |
743 | -re ".*$gdb_prompt $" { fail "print bar.st" } | |
744 | timeout { fail "print bar.st (timeout)" ; return } | |
745 | } | |
746 | ||
747 | send_gdb "print &foo.st\n" | |
748 | gdb_expect { | |
749 | -re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" { | |
750 | pass "print &foo.st" | |
751 | } | |
752 | -re "There is no member( or method|) named st.*$gdb_prompt $" { | |
753 | setup_xfail "*-*-*" | |
754 | fail "print &foo.st" | |
755 | } | |
756 | -re ".*$gdb_prompt $" { fail "print &foo.st" } | |
757 | timeout { fail "print &foo.st (timeout)" ; return } | |
758 | } | |
759 | ||
760 | set got_bar_st 0 | |
761 | send_gdb "print &Bar::st\n" | |
762 | gdb_expect { | |
763 | -re ".* = .int \[*)\]+ $hex$nl$gdb_prompt $" { | |
764 | pass "print &Bar::st" | |
765 | set got_bar_st 1 | |
766 | } | |
767 | -re "There is no field named st.*$gdb_prompt $" { | |
768 | setup_xfail "*-*-*" | |
769 | fail "print &Bar::st" | |
770 | } | |
771 | -re ".*$gdb_prompt $" { fail "print &Bar::st" } | |
772 | timeout { fail "print &Bar::st (timeout)" ; return } | |
773 | } | |
774 | ||
775 | if $got_bar_st then { | |
776 | gdb_test "print *\$" ".* = 200" "print *\$" | |
777 | } | |
778 | ||
779 | gdb_test "set print static-members off" "" | |
780 | gdb_test "print csi" \ | |
781 | "{x = 10, y = 20}" \ | |
782 | "print csi without static members" | |
783 | gdb_test "print cnsi" \ | |
784 | "{x = 30, y = 40}" \ | |
785 | "print cnsi without static members" | |
786 | ||
787 | gdb_test "set print static-members on" "" | |
788 | setup_xfail_format "DWARF 1" | |
789 | gdb_test "print csi" \ | |
790 | "{x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>}}" \ | |
791 | "print csi with static members" | |
792 | setup_xfail_format "DWARF 1" | |
793 | gdb_test "print cnsi" \ | |
794 | "{x = 30, y = 40, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>, static yy = {z = 5, static xx = {x = 1, y = 2, static null = <same as static member of an already seen type>, static yy = <same as static member of an already seen type>}}}, static yy = <same as static member of an already seen type>}" \ | |
795 | "print cnsi with static members" | |
796 | } | |
797 | ||
798 | proc do_tests {} { | |
799 | global prms_id | |
800 | global bug_id | |
801 | global subdir | |
802 | global objdir | |
803 | global srcdir | |
804 | global binfile | |
805 | global gdb_prompt | |
806 | ||
807 | set prms_id 0 | |
808 | set bug_id 0 | |
809 | ||
810 | # Start with a fresh gdb. | |
811 | ||
812 | gdb_exit | |
813 | gdb_start | |
814 | gdb_reinitialize_dir $srcdir/$subdir | |
815 | gdb_load $binfile | |
816 | ||
817 | send_gdb "set language c++\n" | |
818 | gdb_expect -re "$gdb_prompt $" | |
819 | send_gdb "set width 0\n" | |
820 | gdb_expect -re "$gdb_prompt $" | |
821 | ||
822 | # Get the debug format for the compiled test case. | |
823 | ||
824 | if [ runto_main ] then { | |
825 | get_debug_format | |
826 | } | |
827 | ||
828 | test_ptype_class_objects | |
829 | ||
1fa449a4 | 830 | if [ runto 'inheritance2' ] then { |
c906108c SS |
831 | test_non_inherited_member_access |
832 | test_wrong_class_members | |
2bec0572 | 833 | test_nonexistent_members |
54602222 | 834 | test_method_param_class |
2bec0572 ND |
835 | } |
836 | ||
837 | gdb_breakpoint enums2 | |
838 | if [ gdb_continue enums2 ]==0 then { | |
73d28ce1 | 839 | gdb_test "finish" "" "" |
2bec0572 | 840 | test_enums |
c906108c SS |
841 | } |
842 | ||
843 | if [istarget "mips-idt-*"] then { | |
844 | # Restart because IDT/SIM runs out of file descriptors. | |
845 | gdb_exit | |
846 | gdb_start | |
847 | gdb_reinitialize_dir $srcdir/$subdir | |
848 | gdb_load $binfile | |
849 | } | |
850 | ||
851 | if [ runto_main ] then { | |
852 | test_pointers_to_class_members | |
853 | test_static_members | |
854 | } | |
855 | ||
856 | if [istarget "mips-idt-*"] then { | |
857 | # Restart because IDT/SIM runs out of file descriptors. | |
858 | gdb_exit | |
859 | gdb_start | |
860 | gdb_reinitialize_dir $srcdir/$subdir | |
861 | gdb_load $binfile | |
862 | } | |
2bec0572 | 863 | |
c906108c SS |
864 | if [ runto marker_reg1 ] then { |
865 | ||
866 | gdb_test "finish" "Run till exit from.*" "finish from marker_reg1" | |
867 | ||
868 | send_gdb "print v.method ()\n" | |
869 | gdb_expect { | |
870 | -re "= 82.*$gdb_prompt $" { | |
871 | pass "calling method for small class" | |
872 | } | |
873 | -re "Address requested for identifier .v. which is in a register.*$gdb_prompt $" { | |
874 | setup_xfail "*-*-*" 2972 | |
875 | fail "calling method for small class" | |
876 | } | |
877 | -re ".*$gdb_prompt $" { fail "calling method for small class" } | |
878 | timeout { fail "calling method for small class (timeout)" } | |
879 | eof { fail "calling method for small class (eof)" } | |
880 | } | |
881 | } | |
882 | ||
883 | } | |
884 | ||
885 | do_tests | |
886 | ||
c906108c SS |
887 | send_gdb "maint demangle inheritance1__Fv\n" |
888 | gdb_expect { | |
889 | -re "inheritance1\\(void\\).*$gdb_prompt $" { pass "demangle" } | |
890 | -re ".*$gdb_prompt $" { fail "demangle" } | |
891 | timeout { fail "(timeout) demangle" } | |
892 | } |