OLD | NEW |
1 # Copyright 1992, 1994-2004, 2006-2012 Free Software Foundation, Inc. | 1 # Copyright 1992-2013 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
(...skipping 16 matching lines...) Expand all Loading... |
28 return -1 | 28 return -1 |
29 } | 29 } |
30 | 30 |
31 # Test ptype of class objects. | 31 # Test ptype of class objects. |
32 | 32 |
33 proc test_ptype_class_objects {} { | 33 proc test_ptype_class_objects {} { |
34 | 34 |
35 # Simple type. | 35 # Simple type. |
36 | 36 |
37 cp_test_ptype_class \ | 37 cp_test_ptype_class \ |
38 » "ptype struct default_public_struct" "" "struct" "default_public_struct"
\ | 38 » "struct default_public_struct" "" "struct" "default_public_struct" \ |
39 { | 39 { |
40 { field public "int a;" } | 40 { field public "int a;" } |
41 { field public "int b;" } | 41 { field public "int b;" } |
42 } | 42 } |
43 | 43 |
44 # Another simple type. | 44 # Another simple type. |
45 | 45 |
46 cp_test_ptype_class \ | 46 cp_test_ptype_class \ |
47 » "ptype struct explicit_public_struct" "" "struct" "explicit_public_struc
t" \ | 47 » "struct explicit_public_struct" "" "struct" "explicit_public_struct" \ |
48 { | 48 { |
49 { field public "int a;" } | 49 { field public "int a;" } |
50 { field public "int b;" } | 50 { field public "int b;" } |
51 } | 51 } |
52 | 52 |
53 # Another simple type. | 53 # Another simple type. |
54 | 54 |
55 cp_test_ptype_class \ | 55 cp_test_ptype_class \ |
56 » "ptype struct protected_struct" "" "struct" "protected_struct" \ | 56 » "struct protected_struct" "" "struct" "protected_struct" \ |
57 { | 57 { |
58 { field protected "int a;" } | 58 { field protected "int a;" } |
59 { field protected "int b;" } | 59 { field protected "int b;" } |
60 } | 60 } |
61 | 61 |
62 # Another simple type. | 62 # Another simple type. |
63 | 63 |
64 cp_test_ptype_class \ | 64 cp_test_ptype_class \ |
65 » "ptype struct private_struct" "" "struct" "private_struct" \ | 65 » "struct private_struct" "" "struct" "private_struct" \ |
66 { | 66 { |
67 { field private "int a;" } | 67 { field private "int a;" } |
68 { field private "int b;" } | 68 { field private "int b;" } |
69 } | 69 } |
70 | 70 |
71 # A bigger type. | 71 # A bigger type. |
72 | 72 |
73 cp_test_ptype_class \ | 73 cp_test_ptype_class \ |
74 » "ptype struct mixed_protection_struct" "" "struct" "mixed_protection_str
uct" \ | 74 » "struct mixed_protection_struct" "" "struct" "mixed_protection_struct" \ |
75 { | 75 { |
76 { field public "int a;" } | 76 { field public "int a;" } |
77 { field public "int b;" } | 77 { field public "int b;" } |
78 { field private "int c;" } | 78 { field private "int c;" } |
79 { field private "int d;" } | 79 { field private "int d;" } |
80 { field protected "int e;" } | 80 { field protected "int e;" } |
81 { field protected "int f;" } | 81 { field protected "int f;" } |
82 { field public "int g;" } | 82 { field public "int g;" } |
83 { field private "int h;" } | 83 { field private "int h;" } |
84 { field protected "int i;" } | 84 { field protected "int i;" } |
85 } | 85 } |
86 | 86 |
87 # All that again with "class" instead of "struct". | 87 # All that again with "class" instead of "struct". |
88 # gdb does not care about the difference anyways. | 88 # gdb does not care about the difference anyways. |
89 | 89 |
90 cp_test_ptype_class \ | 90 cp_test_ptype_class \ |
91 » "ptype class public_class" "" "class" "public_class" \ | 91 » "class public_class" "" "class" "public_class" \ |
92 { | 92 { |
93 { field public "int a;" } | 93 { field public "int a;" } |
94 { field public "int b;" } | 94 { field public "int b;" } |
95 } | 95 } |
96 | 96 |
97 # Another simple type. | 97 # Another simple type. |
98 | 98 |
99 cp_test_ptype_class \ | 99 cp_test_ptype_class \ |
100 » "ptype class protected_class" "" "class" "protected_class" \ | 100 » "class protected_class" "" "class" "protected_class" \ |
101 { | 101 { |
102 { field protected "int a;" } | 102 { field protected "int a;" } |
103 { field protected "int b;" } | 103 { field protected "int b;" } |
104 } | 104 } |
105 | 105 |
106 # Another simple type. | 106 # Another simple type. |
107 | 107 |
108 cp_test_ptype_class \ | 108 cp_test_ptype_class \ |
109 » "ptype class default_private_class" "" "class" "default_private_class" \ | 109 » "class default_private_class" "" "class" "default_private_class" \ |
110 { | 110 { |
111 { field private "int a;" } | 111 { field private "int a;" } |
112 { field private "int b;" } | 112 { field private "int b;" } |
113 } | 113 } |
114 | 114 |
115 # Another simple type. | 115 # Another simple type. |
116 | 116 |
117 cp_test_ptype_class \ | 117 cp_test_ptype_class \ |
118 » "ptype class explicit_private_class" "" "class" "explicit_private_class"
\ | 118 » "class explicit_private_class" "" "class" "explicit_private_class" \ |
119 { | 119 { |
120 { field private "int a;" } | 120 { field private "int a;" } |
121 { field private "int b;" } | 121 { field private "int b;" } |
122 } | 122 } |
123 | 123 |
124 # A bigger type. | 124 # A bigger type. |
125 | 125 |
126 cp_test_ptype_class \ | 126 cp_test_ptype_class \ |
127 » "ptype class mixed_protection_class" "" "class" "mixed_protection_class"
\ | 127 » "class mixed_protection_class" "" "class" "mixed_protection_class" \ |
128 { | 128 { |
129 | 129 |
130 { field public "int a;" } | 130 { field public "int a;" } |
131 { field public "int b;" } | 131 { field public "int b;" } |
132 { field private "int c;" } | 132 { field private "int c;" } |
133 { field private "int d;" } | 133 { field private "int d;" } |
134 { field protected "int e;" } | 134 { field protected "int e;" } |
135 { field protected "int f;" } | 135 { field protected "int f;" } |
136 { field public "int g;" } | 136 { field public "int g;" } |
137 { field private "int h;" } | 137 { field private "int h;" } |
138 { field protected "int i;" } | 138 { field protected "int i;" } |
139 } | 139 } |
140 | 140 |
141 # Here are some classes with inheritance. | 141 # Here are some classes with inheritance. |
142 | 142 |
143 # Base class. | 143 # Base class. |
144 | 144 |
145 cp_test_ptype_class \ | 145 cp_test_ptype_class \ |
146 » "ptype class A" "" "class" "A" \ | 146 » "class A" "" "class" "A" \ |
147 { | 147 { |
148 { field public "int a;" } | 148 { field public "int a;" } |
149 { field public "int x;" } | 149 { field public "int x;" } |
150 } | 150 } |
151 | 151 |
152 # Derived class. | 152 # Derived class. |
153 | 153 |
154 cp_test_ptype_class \ | 154 cp_test_ptype_class \ |
155 » "ptype class B" "" "class" "B" \ | 155 » "class B" "" "class" "B" \ |
156 { | 156 { |
157 { base "public A" } | 157 { base "public A" } |
158 { field public "int b;" } | 158 { field public "int b;" } |
159 { field public "int x;" } | 159 { field public "int x;" } |
160 } | 160 } |
161 | 161 |
162 # Derived class. | 162 # Derived class. |
163 | 163 |
164 cp_test_ptype_class \ | 164 cp_test_ptype_class \ |
165 » "ptype class C" "" "class" "C" \ | 165 » "class C" "" "class" "C" \ |
166 { | 166 { |
167 { base "public A" } | 167 { base "public A" } |
168 { field public "int c;" } | 168 { field public "int c;" } |
169 { field public "int x;" } | 169 { field public "int x;" } |
170 } | 170 } |
171 | 171 |
172 # Derived class, multiple inheritance. | 172 # Derived class, multiple inheritance. |
173 | 173 |
174 cp_test_ptype_class \ | 174 cp_test_ptype_class \ |
175 » "ptype class D" "" "class" "D" \ | 175 » "class D" "" "class" "D" \ |
176 { | 176 { |
177 { base "public B" } | 177 { base "public B" } |
178 { base "public C" } | 178 { base "public C" } |
179 { field public "int d;" } | 179 { field public "int d;" } |
180 { field public "int x;" } | 180 { field public "int x;" } |
181 } | 181 } |
182 | 182 |
183 # Derived class. | 183 # Derived class. |
184 | 184 |
185 cp_test_ptype_class \ | 185 cp_test_ptype_class \ |
186 » "ptype class E" "" "class" "E" \ | 186 » "class E" "" "class" "E" \ |
187 { | 187 { |
188 { base "public D" } | 188 { base "public D" } |
189 { field public "int e;" } | 189 { field public "int e;" } |
190 { field public "int x;" } | 190 { field public "int x;" } |
191 } | 191 } |
192 | 192 |
193 # This is a break from inheritance tests. | 193 # This is a break from inheritance tests. |
194 # | 194 # |
195 # gcc 2.X with stabs (stabs or stabs+?) used to have a problem with | 195 # gcc 2.X with stabs (stabs or stabs+?) used to have a problem with |
196 # static methods whose name is the same as their argument mangling. | 196 # static methods whose name is the same as their argument mangling. |
197 | 197 |
198 cp_test_ptype_class \ | 198 cp_test_ptype_class \ |
199 » "ptype class Static" "" "class" "Static" \ | 199 » "class Static" "" "class" "Static" \ |
200 { | 200 { |
201 { method public "static void ii(int, int);" } | 201 { method public "static void ii(int, int);" } |
202 } | 202 } |
203 | 203 |
204 # Here are some virtual inheritance tests. | 204 # Here are some virtual inheritance tests. |
205 | 205 |
206 # A virtual base class. | 206 # A virtual base class. |
207 | 207 |
208 cp_test_ptype_class \ | 208 cp_test_ptype_class \ |
209 » "ptype class vA" "" "class" "vA" \ | 209 » "class vA" "" "class" "vA" \ |
210 { | 210 { |
211 { field public "int va;" } | 211 { field public "int va;" } |
212 { field public "int vx;" } | 212 { field public "int vx;" } |
213 } | 213 } |
214 | 214 |
215 # A derived class with a virtual base. | 215 # A derived class with a virtual base. |
216 | 216 |
217 cp_test_ptype_class \ | 217 cp_test_ptype_class \ |
218 » "ptype class vB" "" "class" "vB" \ | 218 » "class vB" "" "class" "vB" \ |
219 { | 219 { |
220 { base "public virtual vA" } | 220 { base "public virtual vA" } |
221 { vbase "vA" } | 221 { vbase "vA" } |
222 { field public "int vb;" } | 222 { field public "int vb;" } |
223 { field public "int vx;" } | 223 { field public "int vx;" } |
224 } | 224 } |
225 | 225 |
226 # Another derived class with a virtual base. | 226 # Another derived class with a virtual base. |
227 | 227 |
228 cp_test_ptype_class \ | 228 cp_test_ptype_class \ |
229 » "ptype class vC" "" "class" "vC" \ | 229 » "class vC" "" "class" "vC" \ |
230 { | 230 { |
231 { base "public virtual vA" } | 231 { base "public virtual vA" } |
232 { vbase "vA" } | 232 { vbase "vA" } |
233 { field public "int vc;" } | 233 { field public "int vc;" } |
234 { field public "int vx;" } | 234 { field public "int vx;" } |
235 } | 235 } |
236 | 236 |
237 # A classic diamond class. | 237 # A classic diamond class. |
238 | 238 |
239 cp_test_ptype_class \ | 239 cp_test_ptype_class \ |
240 » "ptype class vD" "" "class" "vD" \ | 240 » "class vD" "" "class" "vD" \ |
241 { | 241 { |
242 { base "public virtual vB" } | 242 { base "public virtual vB" } |
243 { base "public virtual vC" } | 243 { base "public virtual vC" } |
244 { vbase "vC" } | 244 { vbase "vC" } |
245 { vbase "vB" } | 245 { vbase "vB" } |
246 { field public "int vd;" } | 246 { field public "int vd;" } |
247 { field public "int vx;" } | 247 { field public "int vx;" } |
248 } | 248 } |
249 | 249 |
250 # A class derived from a diamond class. | 250 # A class derived from a diamond class. |
251 | 251 |
252 cp_test_ptype_class \ | 252 cp_test_ptype_class \ |
253 » "ptype class vE" "" "class" "vE" \ | 253 » "class vE" "" "class" "vE" \ |
254 { | 254 { |
255 { base "public virtual vD" } | 255 { base "public virtual vD" } |
256 { vbase "vD" } | 256 { vbase "vD" } |
257 { field public "int ve;" } | 257 { field public "int ve;" } |
258 { field public "int vx;" } | 258 { field public "int vx;" } |
259 } | 259 } |
260 | 260 |
261 # Another inheritance series. | 261 # Another inheritance series. |
262 | 262 |
263 # A base class. | 263 # A base class. |
264 | 264 |
265 cp_test_ptype_class \ | 265 cp_test_ptype_class \ |
266 » "ptype class Base1" "" "class" "Base1" \ | 266 » "class Base1" "" "class" "Base1" \ |
267 { | 267 { |
268 { field public "int x;" } | 268 { field public "int x;" } |
269 { method public "Base1(int);" } | 269 { method public "Base1(int);" } |
270 } | 270 } |
271 | 271 |
272 # Another base class. | 272 # Another base class. |
273 | 273 |
274 cp_test_ptype_class \ | 274 cp_test_ptype_class \ |
275 » "ptype class Foo" "" "class" "Foo" \ | 275 » "class Foo" "" "class" "Foo" \ |
276 { | 276 { |
277 { field public "int x;" } | 277 { field public "int x;" } |
278 { field public "int y;" } | 278 { field public "int y;" } |
279 { field public "static int st;" } | 279 { field public "static int st;" } |
280 { method public "Foo(int, int);" } | 280 { method public "Foo(int, int);" } |
281 { method public "int operator!();" } | 281 { method public "int operator!();" } |
282 { method public "operator int();" } | 282 { method public "operator int();" } |
283 { method public "int times(int);" } | 283 { method public "int times(int);" } |
284 } \ | 284 } \ |
285 "" \ | 285 "" \ |
286 { | 286 { |
287 { | 287 { |
288 "operator int();" | 288 "operator int();" |
289 "int operator int();" | 289 "int operator int();" |
290 { setup_kfail "gdb/1497" "*-*-*" } | 290 { setup_kfail "gdb/1497" "*-*-*" } |
291 } | 291 } |
292 { | 292 { |
293 "operator int();" | 293 "operator int();" |
294 "int operator int(void);" | 294 "int operator int(void);" |
295 { setup_kfail "gdb/1497" "*-*-*" } | 295 { setup_kfail "gdb/1497" "*-*-*" } |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 # A multiple inheritance derived class. | 299 # A multiple inheritance derived class. |
300 | 300 |
301 cp_test_ptype_class \ | 301 cp_test_ptype_class \ |
302 » "ptype class Bar" "" "class" "Bar" \ | 302 » "class Bar" "" "class" "Bar" \ |
303 { | 303 { |
304 { base "public Base1" } | 304 { base "public Base1" } |
305 { base "public Foo" } | 305 { base "public Foo" } |
306 { field public "int z;" } | 306 { field public "int z;" } |
307 { method public "Bar(int, int, int);" } | 307 { method public "Bar(int, int, int);" } |
308 } | 308 } |
309 | 309 |
310 } | 310 } |
311 | 311 |
312 # Test simple access to class members. | 312 # Test simple access to class members. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 # NOTE: carlton/2003-02-28: One could certainly argue that plain | 438 # NOTE: carlton/2003-02-28: One could certainly argue that plain |
439 # "PrivEnum" | 439 # "PrivEnum" |
440 # is acceptable: PrivEnum is a member of ClassWithEnum, so | 440 # is acceptable: PrivEnum is a member of ClassWithEnum, so |
441 # there's no need to explicitly qualify its name with | 441 # there's no need to explicitly qualify its name with |
442 # "ClassWithEnum::". The truth, though, is that GDB is simply | 442 # "ClassWithEnum::". The truth, though, is that GDB is simply |
443 # forgetting that PrivEnum is a member of ClassWithEnum, so we do | 443 # forgetting that PrivEnum is a member of ClassWithEnum, so we do |
444 # that output for a bad reason instead of a good reason. Under | 444 # that output for a bad reason instead of a good reason. Under |
445 # stabs, we probably can't get this right; under DWARF-2, we can. | 445 # stabs, we probably can't get this right; under DWARF-2, we can. |
446 | 446 |
447 cp_test_ptype_class \ | 447 cp_test_ptype_class \ |
448 » "ptype obj_with_enum" "" "class" "ClassWithEnum" \ | 448 » "obj_with_enum" "" "class" "ClassWithEnum" \ |
449 { | 449 { |
450 { field public "ClassWithEnum::PrivEnum priv_enum;" } | 450 { field public "ClassWithEnum::PrivEnum priv_enum;" } |
451 { field public "int x;" } | 451 { field public "int x;" } |
452 } \ | 452 } \ |
453 "" \ | 453 "" \ |
454 { | 454 { |
455 { | 455 { |
456 "ClassWithEnum::PrivEnum priv_enum;" | 456 "ClassWithEnum::PrivEnum priv_enum;" |
457 "PrivEnum priv_enum;" | 457 "PrivEnum priv_enum;" |
458 { setup_kfail "gdb/57" "*-*-*" } | 458 { setup_kfail "gdb/57" "*-*-*" } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 } | 611 } |
612 | 612 |
613 gdb_test "print base1::Base1" "<.*Base1.*>" "print ctor of typedef class" | 613 gdb_test "print base1::Base1" "<.*Base1.*>" "print ctor of typedef class" |
614 gdb_test "print base1::~Base1" "<.*~Base1(\\(\\))?>" \ | 614 gdb_test "print base1::~Base1" "<.*~Base1(\\(\\))?>" \ |
615 "print dtor of typedef class" | 615 "print dtor of typedef class" |
616 | 616 |
617 gdb_test "list ByAnyOtherName::times" ".*int Foo::times.*" | 617 gdb_test "list ByAnyOtherName::times" ".*int Foo::times.*" |
618 } | 618 } |
619 | 619 |
620 do_tests | 620 do_tests |
OLD | NEW |