]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.cp/classes.exp
16f83c6c4a24c304c7d5cc56b7634bb5538c8774
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.cp / classes.exp
1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2 # 2003 Free Software Foundation, Inc.
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 # And rewritten by Michael Chastain <mec.gnu@mindspring.com>.
23
24 set ws "\[\r\n\t \]+"
25 set nl "\[\r\n\]+"
26
27 if $tracelevel then {
28 strace $tracelevel
29 }
30
31 if { [skip_cplus_tests] } { continue }
32
33 set testfile "misc"
34 set srcfile ${testfile}.cc
35 set binfile ${objdir}/${subdir}/${testfile}
36
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
38 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
39 }
40
41 # Test ptype of class objects.
42 #
43 # This code accepts the output of gcc v2 and v3, dwarf-2 and stabs+.
44 # It could use some expansion with other compilers such as hp-ux ac++.
45 #
46 # There are lots of variations in the output:
47 #
48 # . gcc -stabs+ emits debug info for implicit member functions:
49 # operator=, copy ctor, ctor. gcc -gdwarf-2 does not.
50 #
51 # . gcc with abi version 1 puts the implicit member functions
52 # at the beginning of the member function list; with abi version 2,
53 # the implicit member functions are at the end of the member function
54 # list. This appears as an output difference with -gstabs+.
55 # gcc 3.3.X defaults to abi version 1, and gcc 3.4 will default
56 # to abi version 2.
57 #
58 # . gcc v2 shows data members for virtual base pointers.
59 # gcc v3 does not.
60 #
61 # . gdb always prints "class" for both "class" and "struct".
62 # In the future, I should accept "struct" in case gdb improves.
63
64 proc test_ptype_class_objects {} {
65 global gdb_prompt
66 global ws
67 global nl
68
69 # Simple type.
70
71 gdb_test_multiple "ptype struct default_public_struct" "ptype struct default_public_struct" {
72 -re "type = class default_public_struct \{${ws}public:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
73 # gcc 2.95.3 -gdwarf-2
74 # gcc 3.3.2 -gdwarf-2
75 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
76 pass "ptype struct default_public_struct"
77 }
78 -re "type = class default_public_struct \{${ws}public:${ws}int a;${ws}int b;${ws}default_public_struct ?& ?operator ?=\\(default_public_struct const ?&\\);${ws}default_public_struct\\(default_public_struct const ?&\\);${ws}default_public_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
79 # gcc 2.95.3 -gstabs+
80 # gcc 3.3.2 -gstabs+
81 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
82 pass "ptype struct default_public_struct"
83 }
84 }
85
86 # Same test, slightly different type.
87
88 gdb_test_multiple "ptype struct explicit_public_struct" "ptype struct explicit_public_struct" {
89 -re "type = class explicit_public_struct \{${ws}public:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
90 # gcc 2.95.3 -gdwarf-2
91 # gcc 3.3.2 -gdwarf-2
92 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
93 pass "ptype struct explicit_public_struct"
94 }
95 -re "type = class explicit_public_struct \{${ws}public:${ws}int a;${ws}int b;${ws}explicit_public_struct ?& ?operator ?=\\(explicit_public_struct const ?&\\);${ws}explicit_public_struct\\(explicit_public_struct const ?&\\);${ws}explicit_public_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
96 # gcc 2.95.3 -gstabs+
97 # gcc 3.3.2 -gstabs+
98 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
99 pass "ptype struct explicit_public_struct"
100 }
101 }
102
103 # Same test, slightly different type.
104
105 gdb_test_multiple "ptype struct protected_struct" "ptype struct protected_struct" {
106 -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
107 # gcc 2.95.3 -gdwarf-2
108 # gcc 3.3.2 -gdwarf-2
109 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
110 pass "ptype struct protected_struct"
111 }
112 -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;${ws}public:${ws}protected_struct ?& ?operator ?=\\(protected_struct const ?&\\);${ws}protected_struct\\(protected_struct const ?&\\);${ws}protected_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
113 # gcc 2.95.3 -gstabs+
114 # gcc 3.3.2 -gstabs+
115 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
116 pass "ptype struct protected_struct"
117 }
118 }
119
120 # Same test, slightly different type.
121
122 gdb_test_multiple "ptype struct private_struct" "ptype struct private_struct" {
123 -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
124 # gcc 2.95.3 -gdwarf-2
125 # gcc 3.3.2 -gdwarf-2
126 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
127 pass "ptype struct private_struct"
128 }
129 -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;${ws}public:${ws}private_struct ?& ?operator ?=\\(private_struct const ?&\\);${ws}private_struct\\(private_struct const ?&\\);${ws}private_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
130 # gcc 2.95.3 -gstabs+
131 # gcc 3.3.2 -gstabs+
132 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
133 pass "ptype struct private_struct"
134 }
135 }
136
137 # Similar test, bigger type.
138
139 gdb_test_multiple "ptype struct mixed_protection_struct" "ptype struct mixed_protection_struct" {
140 -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 $" {
141 # gcc 2.95.3 -gdwarf-2
142 # gcc 3.3.2 -gdwarf-2
143 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
144 pass "ptype struct mixed_protection_struct"
145 }
146 -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;${ws}public:${ws}mixed_protection_struct ?& ?operator ?=\\(mixed_protection_struct const ?&\\);${ws}mixed_protection_struct\\(mixed_protection_struct const ?&\\);${ws}mixed_protection_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
147 # gcc 2.95.3 -gstabs+
148 # gcc 3.3.2 -gstabs+
149 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
150 pass "ptype struct mixed_protection_struct"
151 }
152 }
153
154 # All that again with "class" instead of "struct".
155 # gdb does not care about the difference anyways.
156
157 gdb_test_multiple "ptype class public_class" "ptype class public_class" {
158 -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
159 # gcc 2.95.3 -gdwarf-2
160 # gcc 3.3.2 -gdwarf-2
161 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
162 pass "ptype class public_class"
163 }
164 -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;${ws}public_class ?& ?operator ?=\\(public_class const ?&\\);${ws}public_class\\(public_class const ?&\\);${ws}public_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
165 # gcc 2.95.3 -gstabs+
166 # gcc 3.3.2 -gstabs+
167 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
168 pass "ptype class public_class"
169 }
170 }
171
172 # Same test, slightly different type.
173
174 gdb_test_multiple "ptype class protected_class" "ptype class protected_class" {
175 -re "type = class protected_class \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
176 # gcc 2.95.3 -gdwarf-2
177 # gcc 3.3.2 -gdwarf-2
178 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
179 pass "ptype class protected_class"
180 }
181 -re "type = class protected_class \{${ws}protected:${ws}int a;${ws}int b;${ws}public:${ws}protected_class ?& ?operator ?=\\(protected_class const ?&\\);${ws}protected_class\\(protected_class const ?&\\);${ws}protected_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
182 # gcc 2.95.3 -gstabs+
183 # gcc 3.3.2 -gstabs+
184 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
185 pass "ptype class protected_class"
186 }
187 }
188
189 # Same test, slightly different type.
190 # The 'private' is optional but gdb always prints it.
191
192 gdb_test_multiple "ptype class default_private_class" "ptype class default_private_class" {
193 -re "type = class default_private_class \{${ws}(private:${ws}|)int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
194 # gcc 2.95.3 -gdwarf-2
195 # gcc 3.3.2 -gdwarf-2
196 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
197 pass "ptype class default_private_class"
198 }
199 -re "type = class default_private_class \{${ws}(private:${ws}|)int a;${ws}int b;${ws}public:${ws}default_private_class ?& ?operator ?=\\(default_private_class const ?&\\);${ws}default_private_class\\(default_private_class const ?&\\);${ws}default_private_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
200 # gcc 2.95.3 -gstabs+
201 # gcc 3.3.2 -gstabs+
202 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
203 pass "ptype class default_private_class"
204 }
205 }
206
207 # Same test, slightly different type.
208
209 gdb_test_multiple "ptype class explicit_private_class" "ptype class explicit_private_class" {
210 -re "type = class explicit_private_class \{${ws}(private:${ws}|)int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
211 # gcc 2.95.3 -gdwarf-2
212 # gcc 3.3.2 -gdwarf-2
213 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
214 pass "ptype class explicit_private_class"
215 }
216 -re "type = class explicit_private_class \{${ws}(private:${ws}|)int a;${ws}int b;${ws}public:${ws}explicit_private_class ?& ?operator ?=\\(explicit_private_class const ?&\\);${ws}explicit_private_class\\(explicit_private_class const ?&\\);${ws}explicit_private_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
217 # gcc 2.95.3 -gstabs+
218 # gcc 3.3.2 -gstabs+
219 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
220 pass "ptype class explicit_private_class"
221 }
222 }
223
224 # Similar test, bigger type.
225
226 gdb_test_multiple "ptype class mixed_protection_class" "ptype struct mixed_protection_class" {
227 -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 $" {
228 # gcc 2.95.3 -gdwarf-2
229 # gcc 3.3.2 -gdwarf-2
230 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
231 pass "ptype class mixed_protection_class"
232 }
233 -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;${ws}public:${ws}mixed_protection_class ?& ?operator ?=\\(mixed_protection_class const ?&\\);${ws}mixed_protection_class\\(mixed_protection_class const ?&\\);${ws}mixed_protection_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
234 # gcc 2.95.3 -gstabs+
235 # gcc 3.3.2 -gstabs+
236 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
237 pass "ptype class mixed_protection_class"
238 }
239 }
240
241 # Here are some classes with inheritance.
242
243 # Base class.
244
245 gdb_test_multiple "ptype class A" "ptype class A" {
246 -re "type = class A \{${ws}public:${ws}int a;${ws}int x;$nl\}$nl$gdb_prompt $" {
247 # gcc 2.95.3 -gdwarf-2
248 # gcc 3.3.2 -gdwarf-2
249 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
250 pass "ptype class A"
251 }
252 -re "type = class A \{${ws}public:${ws}int a;${ws}int x;${ws}A ?& ?operator ?=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);$nl\}$nl$gdb_prompt $" {
253 # gcc 2.95.3 -gstabs+
254 # gcc 3.3.2 -gstabs+
255 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
256 pass "ptype class A"
257 }
258 }
259
260 # Derived class.
261
262 gdb_test_multiple "ptype class B" "ptype class B" {
263 -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;$nl\}$nl$gdb_prompt $" {
264 # gcc 2.95.3 -gdwarf-2
265 # gcc 3.3.2 -gdwarf-2
266 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
267 pass "ptype class B"
268 }
269 -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|)\\);$nl\}$nl$gdb_prompt $" {
270 # gcc 2.95.3 -gstabs+
271 # gcc 3.3.2 -gstabs+
272 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
273 pass "ptype class B"
274 }
275 }
276
277 # Derived class.
278
279 gdb_test_multiple "ptype class C" "ptype class C" {
280 -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;$nl\}$nl$gdb_prompt $" {
281 # gcc 2.95.3 -gdwarf-2
282 # gcc 3.3.2 -gdwarf-2
283 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
284 pass "ptype class C"
285 }
286 -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|)\\);$nl\}$nl$gdb_prompt $" {
287 # gcc 2.95.3 -gstabs+
288 # gcc 3.3.2 -gstabs+
289 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
290 pass "ptype class C"
291 }
292 }
293
294 # Derived class, multiple inheritance.
295
296 gdb_test_multiple "ptype class D" "ptype class D" {
297 -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;$nl\}$nl$gdb_prompt $" {
298 # gcc 2.95.3 -gdwarf-2
299 # gcc 3.3.2 -gdwarf-2
300 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
301 pass "ptype class D"
302 }
303 -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|)\\);$nl\}$nl$gdb_prompt $" {
304 # gcc 2.95.3 -gstabs+
305 # gcc 3.3.2 -gstabs+
306 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
307 pass "ptype class D"
308 }
309 }
310
311 # Derived class.
312
313 gdb_test_multiple "ptype class E" "ptype class E" {
314 -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;$nl\}$nl$gdb_prompt $" {
315 # gcc 2.95.3 -gdwarf-2
316 # gcc 3.3.2 -gdwarf-2
317 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
318 pass "ptype class E"
319 }
320 -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|)\\);$nl\}$nl$gdb_prompt $" {
321 # gcc 2.95.3 -gstabs+
322 # gcc 3.3.2 -gstabs+
323 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
324 pass "ptype class E"
325 }
326 }
327
328 # This is a break from inheritance tests.
329 #
330 # gcc 2.X with stabs (stabs or stabs+?) used to have a problem with
331 # static methods whose name is the same as their argument mangling.
332
333 gdb_test_multiple "ptype class Static" "ptype class Static" {
334 -re "type = class Static \{${ws}public:${ws}static void ii\\(int, int\\);$nl\}$nl$gdb_prompt $" {
335 # gcc 2.95.3 -gdwarf-2
336 # gcc 3.3.2 -gdwarf-2
337 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
338 pass "ptype class Static"
339 }
340 -re "type = class Static \{${ws}public:${ws}Static ?& ?operator ?=\\(Static const ?&\\);${ws}Static\\(Static const ?&\\);${ws}Static\\((void|)\\);${ws}static void ii\\(int, int\\);$nl\}$nl$gdb_prompt $" {
341 # gcc 2.95.3 -gstabs+
342 # gcc 3.3.2 -gstabs+
343 pass "ptype class Static"
344 }
345 -re "type = class Static \{${ws}public:${ws}static void ii\\(int, int\\);${ws}Static ?& ?operator ?=\\(Static const ?&\\);${ws}Static\\(Static const ?&\\);${ws}Static\\((void|)\\);$nl\}$nl$gdb_prompt $" {
346 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
347 pass "ptype class Static"
348 }
349 }
350
351 # Here are some virtual inheritance tests.
352
353 gdb_test_multiple "ptype class vA" "ptype class vA" {
354 -re "type = class vA \{${ws}public:${ws}int va;${ws}int vx;$nl\}$nl$gdb_prompt $" {
355 # gcc 2.95.3 -gdwarf-2
356 # gcc 3.3.2 -gdwarf-2
357 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
358 pass "ptype class vA"
359 }
360 -re "type = class vA \{${ws}public:${ws}int va;${ws}int vx;${ws}vA ?& ?operator ?=\\(vA const ?&\\);${ws}vA\\(vA const ?&\\);${ws}vA\\((void|)\\);$nl\}$nl$gdb_prompt $" {
361 # gcc 2.95.3 -gstabs+
362 # gcc 3.3.2 -gstabs+
363 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
364 pass "ptype class vA"
365 }
366 }
367
368 # Accept the virtual base pointer if gdb wants to print it.
369 # Those cases will go away when gcc 2 dies.
370 # With gcc 3, gdb does not print the virtual base pointer.
371
372 gdb_test_multiple "ptype class vB" "ptype class vB" {
373 -re "type = class vB : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.2vA;${ws}public:${ws}int vb;${ws}int vx;$nl\}$nl$gdb_prompt $" {
374 # gcc 2.95.3 -gdwarf-2
375 pass "ptype class vB"
376 }
377 -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;$nl\}$nl$gdb_prompt $" {
378 # gcc 3.3.2 -gdwarf-2
379 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
380 pass "ptype class vB"
381 }
382 -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\\);$nl\}$nl$gdb_prompt $" {
383 # gcc 2.95.3 -gstabs+
384 # See the hidden "in-charge" ctor parameter!
385 pass "ptype class vB"
386 }
387 -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}vB ?& ?operator ?=\\(vB const ?&\\);${ws}vB\\(vB const ?&\\);${ws}vB\\((void|)\\);$nl\}$nl$gdb_prompt $" {
388 # gcc 3.3.2 -gstabs+
389 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
390 pass "ptype class vB"
391 }
392 }
393
394 # Another class with a virtual base.
395
396 gdb_test_multiple "ptype class vC" "ptype class vC" {
397 -re "type = class vC : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.2vA;${ws}public:${ws}int vc;${ws}int vx;$nl\}$nl$gdb_prompt $" {
398 # gcc 2.95.3 -gdwarf-2
399 pass "ptype class vC"
400 }
401 -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;$nl\}$nl$gdb_prompt $" {
402 # gcc 3.3.2 -gdwarf-2
403 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
404 pass "ptype class vC"
405 }
406 -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\\);$nl\}$nl$gdb_prompt $" {
407 # gcc 2.95.3 -gstabs+
408 # See the hidden "in-charge" ctor parameter!
409 pass "ptype class vC"
410 }
411 -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}vC ?& ?operator ?=\\(vC const ?&\\);${ws}vC\\(vC const ?&\\);${ws}vC\\((void|)\\);$nl\}$nl$gdb_prompt $" {
412 # gcc 3.3.2 -gstabs+
413 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
414 pass "ptype class vC"
415 }
416 }
417
418 # The classic diamond inheritance.
419
420 gdb_test_multiple "ptype class vD" "ptype class vD" {
421 -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC ?\\* ?_vb.2vC;${ws}vB ?\\* ?_vb.2vB;${ws}public:${ws}int vd;${ws}int vx;$nl\}$nl$gdb_prompt $" {
422 # gcc 2.95.3 -gdwarf-2
423 pass "ptype class vD"
424 }
425 -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;$nl\}$nl$gdb_prompt $" {
426 # gcc 3.3.2 -gdwarf-2
427 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
428 pass "ptype class vD"
429 }
430 -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\\);$nl\}$nl$gdb_prompt $" {
431 # gcc 2.95.3 -gstabs+
432 # See the hidden "in-charge" ctor parameter!
433 pass "ptype class vD"
434 }
435 -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}vD ?& ?operator ?=\\(vD const ?&\\);${ws}vD\\(vD const ?&\\);${ws}vD\\((void|)\\);$nl\}$nl$gdb_prompt $" {
436 # gcc 3.3.2 -gstabs+
437 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
438 pass "ptype class vD"
439 }
440 }
441
442 # One more case of virtual derivation.
443
444 gdb_test_multiple "ptype class vE" "ptype class vE" {
445 -re "type = class vE : public virtual vD \{${ws}private:${ws}vD ?\\* ?_vb.2vD;${ws}public:${ws}int ve;${ws}int vx;$nl\}$nl$gdb_prompt $" {
446 # gcc 2.95.3 -gdwarf-2
447 pass "ptype class vE"
448 }
449 -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;$nl\}$nl$gdb_prompt $" {
450 # gcc 3.3.2 -gdwarf-2
451 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
452 pass "ptype class vE"
453 }
454 -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\\);$nl\}$nl$gdb_prompt $" {
455 # gcc 2.95.3 -gstabs+
456 # See the hidden "in-charge" ctor parameter!
457 pass "ptype class vE"
458 }
459 -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}vE ?& ?operator ?=\\(vE const ?&\\);${ws}vE\\(vE const ?&\\);${ws}vE\\((void|)\\);$nl\}$nl$gdb_prompt $" {
460 # gcc 3.3.2 -gstabs+
461 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
462 pass "ptype class vE"
463 }
464 }
465
466 # Another inheritance series.
467
468 gdb_test_multiple "ptype class Base1" "ptype class Base1" {
469 -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1\\(int\\);$nl\}$nl$gdb_prompt $" {
470 # gcc 2.95.3 -gdwarf-2
471 # gcc 3.3.2 -gdwarf-2
472 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
473 pass "ptype class Base1"
474 }
475 -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1 ?& ?operator ?=\\(Base1 const ?&\\);${ws}Base1\\(Base1 const ?&\\);${ws}Base1\\(int\\);$nl\}$nl$gdb_prompt $" {
476 # gcc 2.95.3 -gstabs+
477 # gcc 3.3.2 -gstabs+
478 pass "ptype class Base1"
479 }
480 -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1\\(int\\);${ws}Base1 ?& ?operator ?=\\(Base1 const ?&\\);${ws}Base1\\(Base1 const ?&\\);$nl\}$nl$gdb_prompt $" {
481 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
482 pass "ptype class Base1"
483 }
484 }
485
486 # The second base class.
487
488 gdb_test_multiple "ptype class Foo" "ptype class Foo" {
489 -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo\\(int, int\\);${ws}int operator ?!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" {
490 # gcc 2.95.3 -gdwarf-2
491 # gcc 3.3.2 -gdwarf-2
492 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
493 pass "ptype class Foo"
494 }
495 -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\\);$nl\}$nl$gdb_prompt $" {
496 # gcc 2.95.3 -gstabs+
497 # "int operator int()" is a bug
498 kfail "gdb/1497" "ptype class Foo"
499 }
500 -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\\);$nl\}$nl$gdb_prompt $" {
501 # gcc 3.3.2 -gstabs+
502 pass "ptype class Foo"
503 }
504 -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo\\(int, int\\);${ws}int operator ?!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);${ws}Foo ?& ?operator ?=\\(Foo const ?&\\);${ws}Foo\\(Foo const ?&\\);$nl\}$nl$gdb_prompt $" {
505 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
506 pass "ptype class Foo"
507 }
508 }
509
510 # A multiple inheritance derived class.
511
512 gdb_test_multiple "ptype class Bar" "ptype class Bar" {
513 -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar\\(int, int, int\\);$nl\}$nl$gdb_prompt $" {
514 # gcc 2.95.3 -gdwarf-2
515 # gcc 3.3.2 -gdwarf-2
516 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
517 pass "ptype class Bar"
518 }
519 -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\\);$nl\}$nl$gdb_prompt $" {
520 # gcc 2.95.3 -gstabs+
521 # gcc 3.3.2 -gstabs+
522 pass "ptype class Bar"
523 }
524 -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar\\(int, int, int\\);${ws}Bar ?& ?operator ?=\\(Bar const ?&\\);${ws}Bar\\(Bar const ?&\\);$nl\}$nl$gdb_prompt $" {
525 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
526 pass "ptype class Bar"
527 }
528 }
529 }
530
531 # Test simple access to class members.
532 # TODO: these test names are gross!
533 # Just let the test name default.
534
535 proc test_non_inherited_member_access {} {
536 global gdb_prompt
537
538 # Print non-inherited members of g_A.
539 gdb_test "print g_A.a" ".* = 1" "g_A.a incorrect"
540 gdb_test "print g_A.x" ".* = 2" "g_A.x incorrect"
541
542 # Print non-inherited members of g_B.
543 gdb_test "print g_B.b" ".* = 5" "g_B.b incorrect"
544 gdb_test "print g_B.x" ".* = 6" "g_B.x incorrect"
545
546 # Print non-inherited members of g_C.
547 gdb_test "print g_C.c" ".* = 9" "g_C.c incorrect"
548 gdb_test "print g_C.x" ".* = 10" "g_C.x incorrect"
549
550 # Print non-inherited members of g_D.
551 gdb_test "print g_D.d" ".* = 19" "g_D.d incorrect"
552 gdb_test "print g_D.x" ".* = 20" "g_D.x incorrect"
553
554 # Print non-inherited members of g_E.
555 gdb_test "print g_E.e" ".* = 31" "g_E.e incorrect"
556 gdb_test "print g_E.x" ".* = 32" "g_E.x incorrect"
557 }
558
559 # Test access to members of other classes.
560 # gdb should refuse to print them.
561 # (I feel old -- I remember when this was legal in C -- chastain).
562 # TODO: Again, change the silly test names.
563
564 proc test_wrong_class_members {} {
565 global gdb_prompt
566
567 gdb_test "print g_A.b" "There is no member( or method|) named b." "print g_A.b should be error"
568 gdb_test "print g_B.c" "There is no member( or method|) named c." "print g_B.c should be error"
569 gdb_test "print g_B.d" "There is no member( or method|) named d." "print g_B.d should be error"
570 gdb_test "print g_C.b" "There is no member( or method|) named b." "print g_C.b should be error"
571 gdb_test "print g_C.d" "There is no member( or method|) named d." "print g_C.d should be error"
572 gdb_test "print g_D.e" "There is no member( or method|) named e." "print g_D.e should be error"
573 }
574
575 # Test access to names that are not members of any class.
576 # TODO: test names again.
577
578 proc test_nonexistent_members {} {
579 global gdb_prompt
580
581 gdb_test "print g_A.y" "There is no member( or method|) named y." "print g_A.y should be error"
582 gdb_test "print g_B.z" "There is no member( or method|) named z." "print g_B.z should be error"
583 gdb_test "print g_C.q" "There is no member( or method|) named q." "print g_C.q should be error"
584 gdb_test "print g_D.p" "There is no member( or method|) named p." "print g_D.p should be error"
585 }
586
587 # Call a method that expects a base class parameter with base, inherited,
588 # and unrelated class arguments.
589
590 proc test_method_param_class {} {
591 gdb_test "call class_param.Aptr_a (&g_A)" ".* = 1" "base class param->a"
592 gdb_test "call class_param.Aptr_x (&g_A)" ".* = 2" "base class param->x"
593 gdb_test "call class_param.Aptr_a (&g_B)" ".* = 3" "inherited class param->a"
594 gdb_test "call class_param.Aptr_x (&g_B)" ".* = 4" "inherited class param->x"
595 gdb_test "call class_param.Aref_a (g_A)" ".* = 1" "base class (&param)->a"
596 gdb_test "call class_param.Aref_x (g_A)" ".* = 2" "base class (&param)->x"
597 gdb_test "call class_param.Aref_a (g_B)" ".* = 3" "inherited class (&param)->a"
598 gdb_test "call class_param.Aref_x (g_B)" ".* = 4" "inherited class (&param)->x"
599 gdb_test "call class_param.Aval_a (g_A)" ".* = 1" "base class param.a"
600 gdb_test "call class_param.Aval_x (g_A)" ".* = 2" "base class param.x"
601 gdb_test "call class_param.Aval_a (g_B)" ".* = 3" "inherited class param.a"
602 gdb_test "call class_param.Aval_x (g_B)" ".* = 4" "inherited class param.x"
603
604 gdb_test "call class_param.Aptr_a (&foo)" "Cannot resolve .*" "unrelated class *param"
605 gdb_test "call class_param.Aref_a (foo)" "Cannot resolve .*" "unrelated class &param"
606 gdb_test "call class_param.Aval_a (foo)" "Cannot resolve .*" "unrelated class param"
607 }
608
609 # Examine a class with an enum field.
610
611 proc test_enums {} {
612 global gdb_prompt
613 global nl
614 global ws
615
616 # print the object
617
618 gdb_test "print obj_with_enum" \
619 "\\$\[0-9\]+ = \{priv_enum = red, x = 0\}" \
620 "print obj_with_enum (1)"
621
622 # advance one line
623
624 gdb_test "next" ""
625
626 # TODO: with gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2,
627 # gdb says that obj_with_enum is out of scope here and the
628 # tests after this FAIL. This needs investigation.
629 # -- chastain 2003-12-30
630
631 # print the object again
632
633 gdb_test "print obj_with_enum" \
634 "\\$\[0-9\]+ = \{priv_enum = green, x = 0\}" \
635 "print obj_with_enum (2)"
636
637 # print the enum member
638
639 gdb_test "print obj_with_enum.priv_enum" "\\$\[0-9\]+ = green"
640
641 # ptype on the enum member
642
643 gdb_test_multiple "ptype obj_with_enum.priv_enum" "ptype obj_with_enum.priv_enum" {
644 -re "type = enum ClassWithEnum::PrivEnum \{ ?red, green, blue, yellow = 42 ?\}$nl$gdb_prompt $" {
645 pass "ptype obj_with_enum.priv_enum"
646 }
647 -re "type = enum PrivEnum \{ ?red, green, blue, yellow = 42 ?\}$nl$gdb_prompt $" {
648 # gcc 2.95.3 -gdwarf-2
649 # gcc 3.3.2 -gdwarf-2
650 pass "ptype obj_with_enum.priv_enum"
651 }
652 -re "type = enum \{ ?red, green, blue, yellow = 42 ?\}$nl$gdb_prompt $" {
653 # This case case is a little dubious, but it's not clear what
654 # ought to be required of a ptype on a private enum...
655 # -sts 19990324
656 #
657 # It bugs me that this happens with gcc 3.
658 # -- chastain 2003-12-30
659 #
660 # gcc 2.95.3 -gstabs+
661 # gcc 3.3.2 -gstabs+
662 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
663 pass "ptype obj_with_enum.priv_enum"
664 }
665 }
666
667 # ptype on the object
668 gdb_test_multiple "ptype obj_with_enum" "ptype obj_with_enum" {
669 -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)ClassWithEnum::PrivEnum priv_enum;${ws}int x;$nl\}$nl$gdb_prompt $" {
670 pass "ptype obj_with_enum"
671 }
672 -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)PrivEnum priv_enum;${ws}int x;$nl\}$nl$gdb_prompt $" {
673 # NOTE: carlton/2003-02-28: One could certainly argue that
674 # this output is acceptable: PrivEnum is a member of
675 # ClassWithEnum, so there's no need to explicitly qualify
676 # its name with "ClassWithEnum::". The truth, though, is
677 # that GDB is simply forgetting that PrivEnum is a member
678 # of ClassWithEnum, so we do that output for a bad reason
679 # instead of a good reason. Under stabs, we probably
680 # can't get this right; under DWARF-2, we can.
681 #
682 # gcc 2.95.3 -gdwarf-2
683 # gcc 3.3.2 -gdwarf-2
684 kfail "gdb/57" "ptype obj_with_enum"
685 }
686 -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)PrivEnum priv_enum;${ws}int x;${ws}ClassWithEnum ?& ?operator ?=\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\((void|)\\);$nl\}$nl$gdb_prompt $" {
687 # gcc 2.95.3 -gstabs+
688 kfail "gdb/57" "ptype obj_with_enum"
689 }
690 -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)ClassWithEnum::PrivEnum priv_enum;${ws}int x;${ws}ClassWithEnum ?& ?operator ?=\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\((void|)\\);$nl\}$nl$gdb_prompt $" {
691 # I think this is a PASS, but only carlton knows for sure.
692 # -- chastain 2003-12-30
693 #
694 # gcc 3.3.2 -gstabs+
695 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
696 pass "ptype obj_with_enum"
697 }
698 }
699
700 # I'll do this test two different ways, because of a parser bug.
701 # See PR gdb/826.
702
703 gdb_test_multiple "print (ClassWithEnum::PrivEnum) 42" "print (ClassWithEnum::PrivEnum) 42" {
704 -re "\\$\[0-9\]+ = yellow$nl$gdb_prompt $" {
705 pass "print (ClassWithEnum::PrivEnum) 42"
706 }
707 -re "A (parse|syntax) error in expression, near `42'.$nl$gdb_prompt $" {
708 # "parse error" is bison 1.35.
709 # "syntax error" is bison 1.875.
710 kfail "gdb/826" "print (ClassWithEnum::PrivEnum) 42"
711 }
712 }
713
714 gdb_test_multiple "print ('ClassWithEnum::PrivEnum') 42" "print ('ClassWithEnum::PrivEnum') 42" {
715 -re "\\$\[0-9\]+ = yellow$nl$gdb_prompt $" {
716 # gcc 3.3.2 -gstabs+
717 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
718 pass "print ('ClassWithEnum::PrivEnum') 42"
719 }
720 -re "No symbol \"ClassWithEnum::PrivEnum\" in current context.$nl$gdb_prompt $" {
721 # gcc 2.95.3 -gdwarf-2
722 # gcc 3.3.2 -gdwarf-2
723 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
724 # gcc 2.95.3 -gstabs+
725 kfail "gdb/57" "print ('ClassWithEnum::PrivEnum') 42"
726 }
727 }
728 }
729
730 # Pointers to class members
731
732 proc test_pointers_to_class_members {} {
733 global gdb_prompt
734
735 gdb_test "print Bar::z" "\\$\[0-9\]+ = \\(int ?\\( ?Bar::& ?\\) ?\\) ?Bar::z"
736 gdb_test "print &Foo::x" "\\$\[0-9\]+ = \\(int ?\\( ?Foo::\\* ?\\) ?\\) ?&Foo::x"
737 gdb_test "print (int)&Foo::x" "\\$\[0-9\]+ = 0"
738 gdb_test "print (int)&Bar::y == 2*sizeof(int)" "\\$\[0-9\]+ = true"
739 }
740
741 # Test static members.
742
743 proc test_static_members {} {
744 global gdb_prompt
745 global hex
746
747 gdb_test "print Foo::st" "\\$\[0-9\]+ = 100"
748 gdb_test "set foo.st = 200" ""
749 gdb_test "print bar.st" "\\$\[0-9\]+ = 200"
750 gdb_test "print &foo.st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex"
751 gdb_test "print &Bar::st" "\\$\[0-9\]+ = \\(int ?\\*\\) $hex"
752 gdb_test "print *\$" "\\$\[0-9\]+ = 200"
753
754 gdb_test "set print static-members off" ""
755 gdb_test "print csi" \
756 "{x = 10, y = 20}" \
757 "print csi without static members"
758 gdb_test "print cnsi" \
759 "{x = 30, y = 40}" \
760 "print cnsi without static members"
761
762 gdb_test "set print static-members on" ""
763 gdb_test "print csi" \
764 "{x = 10, y = 20, static null = {x = 0, y = 0, static null = <same as static member of an already seen type>}}" \
765 "print csi with static members"
766 gdb_test "print cnsi" \
767 "{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>}" \
768 "print cnsi with static members"
769 }
770
771 proc do_tests {} {
772 global prms_id
773 global bug_id
774 global subdir
775 global objdir
776 global srcdir
777 global binfile
778 global gdb_prompt
779 global nl
780
781 set prms_id 0
782 set bug_id 0
783
784 # Start with a fresh gdb.
785
786 gdb_exit
787 gdb_start
788 gdb_reinitialize_dir $srcdir/$subdir
789 gdb_load $binfile
790
791 gdb_test "set language c++" "" ""
792 gdb_test "set width 0" "" ""
793
794 if ![runto_main ] then {
795 perror "couldn't run to breakpoint"
796 return
797 }
798
799 test_pointers_to_class_members
800 test_static_members
801
802 gdb_breakpoint inheritance2
803 gdb_test "continue" ".*Breakpoint .* inheritance2.*" ""
804
805 test_ptype_class_objects
806 test_non_inherited_member_access
807 test_wrong_class_members
808 test_nonexistent_members
809 test_method_param_class
810
811 gdb_breakpoint enums2
812 gdb_test "continue" ".*Breakpoint .* enums2.*" ""
813 gdb_test "finish" "" ""
814 test_enums
815
816 # Now some random tests that were just thrown in here.
817
818 gdb_breakpoint marker_reg1
819 gdb_test "continue" ".*Breakpoint .* marker_reg1.*" ""
820 gdb_test "finish" "Run till exit from.*" "finish from marker_reg1"
821
822 # This class is so small that an instance of it can fit in a register.
823 # When gdb tries to call a method, it gets embarrassed about taking
824 # the address of a register.
825 #
826 # TODO: I think that message should be a PASS, not an XFAIL.
827 # gdb prints an informative message and declines to do something
828 # impossible.
829 #
830 # The method call actually succeeds if the compiler allocates very
831 # small classes in memory instead of registers. So this test does
832 # not tell us anything interesting if the call succeeds.
833 #
834 # -- chastain 2003-12-31
835 gdb_test_multiple "print v.method ()" "calling method for small class" {
836 -re "\\$\[0-9\]+ = 82$nl$gdb_prompt $" {
837 # gcc 3.3.2 -gdwarf-2
838 # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
839 # gcc 3.3.2 -gstabs+
840 # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
841 pass "calling method for small class"
842 }
843 -re "Address requested for identifier \"v\" which is in register .*$nl$gdb_prompt $" {
844 # gcc 2.95.3 -gdwarf-2
845 # gcc 2.95.3 -gstabs+
846 setup_xfail "*-*-*" 2972
847 fail "calling method for small class"
848 }
849 }
850 }
851
852 do_tests