2002-01-20 Daniel Jacobowitz <drow@mvista.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.c++ / inherit.exp
CommitLineData
b6ba6518
KB
1# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 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
23set ws "\[\r\n\t \]+"
24set nl "\[\r\n\]+"
25
c2d11a7d
JM
26# The format of a g++ virtual base pointer.
27set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?"
28
c906108c
SS
29if $tracelevel then {
30 strace $tracelevel
31}
32
d4f3574e
SS
33if { [skip_cplus_tests] } { continue }
34
c906108c
SS
35# Note - create separate "inherit" executable from misc.cc
36
37set testfile "inherit"
38set srcfile misc.cc
39set binfile ${objdir}/${subdir}/${testfile}
40
41
42# Create and source the file that provides information about the compiler
43# used to compile the test case.
44
45if [get_compiler_info ${binfile} "c++"] {
46 return -1
47}
48
c906108c
SS
49if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
50 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
51}
52
53#
54# Single inheritance, print individual members.
55#
56
57proc test_print_si_members {} {
58 # Print all members of g_A using fully qualified form.
59
60 gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"
61
62 gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"
63
64 # Print members of g_A using nonambiguous compact form.
65
66 gdb_test "print g_A.a" ".* = 1" "print g_A.a"
67
68 gdb_test "print g_A.x" ".* = 2" "print g_A.x"
69
70 # Print all members of g_B using fully qualified form.
71
72 gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"
73
74 gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"
75
76 gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"
77
78 gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"
79
80 # Print members of g_B using nonambiguous compact form.
81
82 setup_xfail_format "DWARF 1"
83 gdb_test "print g_B.a" ".* = 3" "print g_B.a"
84
85 gdb_test "print g_B.b" ".* = 5" "print g_B.b"
86
87 gdb_test "print g_B.x" ".* = 6" "print g_B.x"
88
89 # Print all members of g_C using fully qualified form.
90
91 gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"
92
93 gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"
94
95 gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"
96
97 gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"
98
99 # Print members of g_C using nonambiguous compact form.
100
101 setup_xfail_format "DWARF 1"
102 gdb_test "print g_C.a" ".* = 7" "print g_C.a"
103
104 gdb_test "print g_C.c" ".* = 9" "print g_C.c"
105
106 gdb_test "print g_C.x" ".* = 10" "print g_C.x"
107}
108
109#
110# Single inheritance, print type definitions.
111#
112
113proc test_ptype_si {} {
114 global gdb_prompt
115 global ws
116 global nl
a0b3c4fd 117 global hp_aCC_compiler
c906108c
SS
118
119 # Print class A as a type.
120
121 send_gdb "ptype A\n"
122 gdb_expect {
123 -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
124 pass "ptype A (FIXME)"
125 }
126 -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
127 setup_xfail "*-*-*"
128 fail "ptype A (FIXME)"
129 }
130 -re ".*$gdb_prompt $" { fail "ptype A" }
131 timeout { fail "ptype A (timeout)" ; return }
132 }
133
134 # Print class A as an explicit class.
135
136 send_gdb "ptype class A\n"
137 gdb_expect {
138 -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
139 pass "ptype class A (FIXME)"
140 }
141 -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
a0b3c4fd 142 if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
c906108c
SS
143 fail "ptype class A (FIXME)"
144 }
145 -re ".*$gdb_prompt $" { fail "ptype class A" }
146 timeout { fail "ptype class A (timeout)" ; return }
147 }
148
149 # Print type of an object of type A.
150
151 send_gdb "ptype g_A\n"
152 gdb_expect {
153 -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" {
154 pass "ptype g_A (FIXME)"
155 }
156 -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" {
a0b3c4fd 157 if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
c906108c
SS
158 fail "ptype g_A (FIXME)"
159 }
160 -re ".*$gdb_prompt $" { fail "ptype g_A" }
161 timeout { fail "ptype g_A (timeout)" ; return }
162 }
163
164 # Print class B as a type.
165
166 setup_xfail_format "DWARF 1"
167 gdb_test "ptype B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype B"
168
169 # Print class B as an explicit class.
170
171 setup_xfail_format "DWARF 1"
172 gdb_test "ptype class B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype class B"
173
174 # Print type of an object of type B.
175
176 setup_xfail_format "DWARF 1"
177 gdb_test "ptype g_B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype g_B"
178
179 # Print class C as a type.
180
181 setup_xfail_format "DWARF 1"
182 gdb_test "ptype C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype C"
183
184 # Print class C as an explicit class.
185
186 setup_xfail_format "DWARF 1"
187 gdb_test "ptype class C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype class C"
188
189 # Print type of an object of type g_C.
190
191 setup_xfail_format "DWARF 1"
192 gdb_test "ptype g_C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype g_C"
193
194 # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of
195 # cygnus-2.3.3-930417. PR 2819.
196 send_gdb "ptype tagless_struct\n"
197 gdb_expect {
198 -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}$nl$gdb_prompt $" {
199 pass "ptype tagless struct"
200 }
201 -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {
202 pass "ptype tagless struct (obsolete gcc or gdb)"
203 }
204 -re ".*$gdb_prompt $" {
205 fail "ptype tagless struct"
206 }
207 timeout {
208 fail "ptype tagless struct (timeout)"
209 }
210 }
211
212 send_gdb "ptype v_tagless\n"
213 gdb_expect {
214 -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct &\\);${ws}\\\$_1 \\(tagless_struct &\\);${ws}\\\$_1 \\(\\);${ws}\}$nl$gdb_prompt $" {
215 pass "ptype variable of type tagless struct"
216 }
217 -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" {
218 pass "ptype variable of type tagless struct (obsolete gcc or gdb)"
219 }
220 -re ".*$gdb_prompt $" {
221 fail "ptype variable of type tagless struct"
222 }
223 timeout {
224 fail "ptype variable of type tagless struct (timeout)"
225 }
226 }
227}
228
229#
230# Single inheritance, print complete classes.
231#
232
233proc test_print_si_classes {} {
234 # Print all members of g_A.
235
236 gdb_test "print g_A" ".* = \{a = 1, x = 2\}" "print g_A"
237
238 # Print all members of g_B.
239
240 setup_xfail_format "DWARF 1"
a0b3c4fd 241 gdb_test "print g_B" ".* = \{\<(class |)A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B"
c906108c
SS
242
243 # Print all members of g_C.
244
245 setup_xfail_format "DWARF 1"
a0b3c4fd 246 gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C"
c906108c
SS
247}
248
249#
250# Single inheritance, print anonymous unions.
251# GDB versions prior to 4.14 entered an infinite loop when printing
252# the type of a class containing an anonymous union, and they were also
253# incapable of printing the member of an anonymous union.
254# We test the printing of the member first, and perform the other tests
255# only if the test succeeds, to avoid the infinite loop.
256#
257
258proc test_print_anon_union {} {
259 global gdb_prompt
260 global ws
261 global nl
262
263 setup_xfail_format "DWARF 1"
264 gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member"
265 setup_xfail_format "DWARF 1"
266 send_gdb "print g_anon_union\n"
267 gdb_expect {
a0b3c4fd 268 -re ".* = \{one = 1, ( = |)\{a = 2, b = 2\}\}$nl$gdb_prompt $" {
c906108c
SS
269 pass "print variable of type anonymous union"
270 }
a0b3c4fd 271 -re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" {
c906108c
SS
272 pass "print variable of type anonymous union (obsolete gcc or gdb)"
273 }
274 -re ".*$nl$gdb_prompt $" {
275 fail "print variable of type anonymous union"
276 }
277 timeout {
278 fail "print variableof type anonymous union (timeout)"
279 }
280 }
281 setup_xfail_format "DWARF 1"
282 send_gdb "ptype g_anon_union\n"
283 gdb_expect {
284 -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" {
285 pass "print type of anonymous union"
286 }
287 -re "type = (struct|class).*\{.*int one;.*union \{.*int a;.*(long|long int|int) b;.*\};.*\}$nl$gdb_prompt $" {
288 pass "print type of anonymous union (obsolete gcc or gdb)"
289 }
290 -re ".*$nl$gdb_prompt $" {
291 fail "print type of anonymous union"
292 }
293 timeout {
294 fail "print type of anonymous union (timeout)"
295 }
296 }
297}
298
299#
300# Multiple inheritance, print individual members.
301#
302
303proc test_print_mi_members {} {
304 global gdb_prompt
305 global nl
a0b3c4fd 306 global hp_aCC_compiler
c906108c
SS
307
308 # Print all members of g_A.
309
310 gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a"
311
312 gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x"
313
314 # Print all members of g_B.
315
316 gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a"
317
318 gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x"
319
320 gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b"
321
322 gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x"
323
324 # Print all members of g_C.
325
326 gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a"
327
328 gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x"
329
330 gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c"
331
332 gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x"
333
334 # Print all members of g_D.
335
336 # The following is ambiguous, and gdb should detect this.
337 # For now, accept gdb's behavior as an expected failure if it
338 # simply prints either member correctly.
339
a0b3c4fd 340 if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
c906108c 341 send_gdb "print g_D.A::a\n"
a0b3c4fd
JM
342 gdb_expect {
343 -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 15$nl$gdb_prompt $" {
344 pass "print g_D.A::a"
345 }
346 -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 11$nl$gdb_prompt $" {
347 pass "print g_D.A::a (using B)"
c906108c
SS
348 }
349 -re ".* = 15$nl$gdb_prompt $" {
350 fail "print g_D.A::a (FIXME)"
351 }
a0b3c4fd
JM
352 -re ".* = 11$nl$gdb_prompt $" {
353 fail "print g_D.A::a (FIXME)"
354 }
c906108c
SS
355 -re ".*$gdb_prompt $" { fail "print g_D.A::a" }
356 timeout { fail "print g_D.A::a (timeout)" ; return }
357 }
358
359 # The following is ambiguous, and gdb should detect this.
360 # For now, accept gdb's behavior as an expected failure if it
361 # simply prints either member correctly.
362
a0b3c4fd 363 if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
c906108c
SS
364 send_gdb "print g_D.A::x\n"
365 gdb_expect {
a0b3c4fd
JM
366 -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 16$nl$gdb_prompt $" {
367 pass "print g_D.A::x"
368 }
369 -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 12$nl$gdb_prompt $" {
370 pass "print g_D.A::x (using B)"
c906108c
SS
371 }
372 -re ".* = 16$nl$gdb_prompt $" {
373 fail "print g_D.A::x (FIXME)"
374 }
a0b3c4fd
JM
375 -re ".* = 12$nl$gdb_prompt $" {
376 fail "print g_D.A::x (FIXME)"
377 }
c906108c
SS
378 -re ".*$gdb_prompt $" { fail "print g_D.A::x" }
379 timeout { fail "print g_D.A::x (timeout)" ; return }
380 }
381
382 gdb_test "print g_D.B::b" ".* = 13" "print g_D.B::b"
383
384 gdb_test "print g_D.B::x" ".* = 14" "print g_D.B::x"
385
386 setup_xfail_format "DWARF 1"
387 gdb_test "print g_D.C::c" ".* = 17" "print g_D.C::c"
388
389 setup_xfail_format "DWARF 1"
390 gdb_test "print g_D.C::x" ".* = 18" "print g_D.C::x"
391
392 gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d"
393
394 gdb_test "print g_D.D::x" ".* = 20" "print g_D.D::x"
395
396 # Print all members of g_E.
397
398 # The following is ambiguous, and gdb should detect this.
399 # For now, accept gdb's behavior as an expected failure if it
400 # simply prints either member correctly.
401
402 setup_xfail "*-*-*"
403 send_gdb "print g_E.A::a\n"
404 gdb_expect {
405 -re ".* = 21$nl$gdb_prompt $" {
406 fail "print g_E.A::a (FIXME)"
407 }
408 -re ".* = 25$nl$gdb_prompt $" {
409 fail "print g_E.A::a (FIXME)"
410 }
411 -re ".*$gdb_prompt $" { fail "print g_E.A::a" }
412 timeout { fail "print g_E.A::a (timeout)" ; return }
413 }
414
415 # The following is ambiguous, and gdb should detect this.
416 # For now, accept gdb's behavior as an expected failure if it
417 # simply prints either member correctly.
418
a0b3c4fd 419 if {!$hp_aCC_compiler} {setup_xfail "*-*-*"}
c906108c
SS
420 send_gdb "print g_E.A::x\n"
421 gdb_expect {
a0b3c4fd
JM
422 -re "warning: A ambiguous; using E::D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 26$nl$gdb_prompt $" {
423 pass "print g_E.A::x"
424 }
425 -re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 22$nl$gdb_prompt $" {
426 pass "print g_E.A::x (using B)"
c906108c
SS
427 }
428 -re ".* = 26$nl$gdb_prompt $" {
429 fail "print g_E.A::x (FIXME)"
430 }
a0b3c4fd
JM
431 -re ".* = 22$nl$gdb_prompt $" {
432 fail "print g_E.A::x (FIXME)"
433 }
c906108c
SS
434 -re ".*$gdb_prompt $" { fail "print g_E.A::x" }
435 timeout { fail "print g_E.A::x (timeout)" ; return }
436 }
437
438 gdb_test "print g_E.B::b" ".* = 23" "print g_E.B::b"
439
440 gdb_test "print g_E.B::x" ".* = 24" "print g_E.B::x"
441
442 setup_xfail_format "DWARF 1"
443 gdb_test "print g_E.C::c" ".* = 27" "print g_E.C::c"
444
445 setup_xfail_format "DWARF 1"
446 gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x"
447
448 gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d"
449
450 gdb_test "print g_E.D::x" ".* = 30" "print g_E.D::x"
451
452 gdb_test "print g_E.E::e" ".* = 31" "print g_E.E::e"
453
454 gdb_test "print g_E.E::x" ".* = 32" "print g_E.E::x"
455}
456
457#
458# Multiple inheritance, print type definitions.
459#
460
461proc test_ptype_mi {} {
462 global nl
463
464 setup_xfail_format "DWARF 1"
465 gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D"
466
467 setup_xfail_format "DWARF 1"
468 gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D"
469
470 setup_xfail_format "DWARF 1"
471 gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D"
472
473 setup_xfail_format "DWARF 1"
474 gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E"
475
476 setup_xfail_format "DWARF 1"
477 gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E"
478
479 setup_xfail_format "DWARF 1"
480 gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E"
481}
482
483#
484# Multiple inheritance, print complete classes.
485#
486
487proc test_print_mi_classes {} {
488 # Print all members of g_D.
489
490 setup_xfail_format "DWARF 1"
a0b3c4fd 491 gdb_test "print g_D" ".* = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" "print g_D"
c906108c
SS
492
493 # Print all members of g_E.
494
495 setup_xfail_format "DWARF 1"
a0b3c4fd 496 gdb_test "print g_E" ".* = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E"
c906108c
SS
497}
498
499#
500# Single virtual inheritance, print individual members.
501#
502
503proc test_print_svi_members {} {
504 global gdb_prompt
505 global decimal
506 global nl
507
508 # Print all members of g_vA.
509
510 gdb_test "print g_vA.vA::va" ".* = 1" "print g_vA.vA::va"
511
512 gdb_test "print g_vA.vA::vx" ".* = 2" "print g_vA.vA::vx"
513
514 # Print members of g_vA using compact form.
515
516 gdb_test "print g_vA.va" ".* = 1" "print g_vA.va"
517
518 gdb_test "print g_vA.vx" ".* = 2" "print g_vA.vx"
519
520 # Print all members of g_vB.
521
522 setup_xfail_format "DWARF 1"
523 send_gdb "print g_vB.vA::va\n"
524 gdb_expect {
525 -re ".* = 3$nl$gdb_prompt $" { pass "print g_vB.vA::va" }
526 -re ".*virtual baseclass botch.*$gdb_prompt $" {
527 # Does not happen with gcc cygnus-2.4.5-930828
528 fail "print g_vB.vA::va (known bug with gcc cygnus-2.4.5-930417)"
529 # Many of the rest of these tests have the same problem.
530 return 0
531 }
532 -re ".*$gdb_prompt $" { fail "print g_vB.vA::va" }
533 timeout { fail "print g_vB.vA::va (timeout)" ; return }
534 }
535
536 setup_xfail_format "DWARF 1"
537 gdb_test "print g_vB.vA::vx" ".* = 4" "print g_vB.vA::vx"
538
539 gdb_test "print g_vB.vB::vb" ".* = 5" "print g_vB.vB::vb"
540
541 gdb_test "print g_vB.vB::vx" ".* = 6" "print g_vB.vB::vx"
542
543 # Print members of g_vB using compact form.
544
545 setup_xfail_format "DWARF 1"
546 gdb_test "print g_vB.va" ".* = 3" "print g_vB.va"
547
548 gdb_test "print g_vB.vb" ".* = 5" "print g_vB.vb"
549
550 gdb_test "print g_vB.vx" ".* = 6" "print g_vB.vx"
551
552 # Print all members of g_vC.
553
554 setup_xfail_format "DWARF 1"
555 gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va"
556
557 setup_xfail_format "DWARF 1"
558 gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx"
559
560 gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc"
561
562 gdb_test "print g_vC.vC::vx" ".* = 10" "print g_vC.vC::vx"
563
564 # Print members of g_vC using compact form.
565
566 setup_xfail_format "DWARF 1"
567 gdb_test "print g_vC.va" ".* = 7" "print g_vC.va"
568
569 gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc"
570
571 gdb_test "print g_vC.vx" ".* = 10" "print g_vC.vx"
572}
573
574#
575# Single virtual inheritance, print type definitions.
576#
577
578proc test_ptype_vi {} {
579 global gdb_prompt
a0b3c4fd 580 global ws
c906108c 581 global nl
c2d11a7d 582 global vbptr
c906108c
SS
583
584 # This class does not use any C++-specific features, so it's fine for
585 # it to print as "struct".
586 send_gdb "ptype vA\n"
587 gdb_expect {
588 -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
589 pass "ptype vA"
590 }
591 -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
592 pass "ptype vA"
593 }
594 -re ".*$gdb_prompt $" { fail "ptype vA" }
595 timeout { fail "ptype vA (timeout)" ; return }
596 }
597
598 # This class does not use any C++-specific features, so it's fine for
599 # it to print as "struct".
600 send_gdb "ptype class vA\n"
601 gdb_expect {
602 -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
603 pass "ptype class vA"
604 }
605 -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
606 pass "ptype class vA"
607 }
608 -re ".*$gdb_prompt $" { fail "ptype class vA" }
609 timeout { fail "ptype class vA (timeout)" ; return }
610 }
611
612 # This class does not use any C++-specific features, so it's fine for
613 # it to print as "struct".
614 send_gdb "ptype g_vA\n"
615 gdb_expect {
616 -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
617 pass "ptype g_vA"
618 }
619 -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" {
620 pass "ptype g_vA"
621 }
622 -re ".*$gdb_prompt $" { fail "ptype g_vA" }
623 timeout { fail "ptype g_vA (timeout)" ; return }
624 }
625
626 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
627 send_gdb "ptype vB\n"
628 gdb_expect {
c2d11a7d 629 -re "ptype vB${nl}type = class vB : public virtual vA \{$nl private:${ws}vA \\*${vbptr}vA;$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
a0b3c4fd
JM
630 pass "ptype vB"
631 }
632 -re "ptype vB${nl}type = class vB : public virtual vA \{$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" {
633 pass "ptype vB (aCC)"
634 }
635 -re ".*$gdb_prompt $" { fail "ptype vB" }
636 timeout { fail "ptype vB (timeout)" }
637 }
c906108c
SS
638
639 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
640 send_gdb "ptype class vB\n"
641 gdb_expect {
c2d11a7d 642 -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
a0b3c4fd
JM
643 pass "ptype class vB"
644 }
645 -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
646 pass "ptype class vB (aCC)"
647 }
648 -re ".*$gdb_prompt $" { fail "ptype class vB" }
649 timeout { fail "ptype class vB (timeout)" }
650 }
c906108c
SS
651
652 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
653 send_gdb "ptype g_vB\n"
654 gdb_expect {
c2d11a7d 655 -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
a0b3c4fd
JM
656 pass "ptype g_vB"
657 }
658 -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
659 pass "ptype g_vB (aCC)"
660 }
661 -re ".*$gdb_prompt $" { fail "ptype g_vB" }
662 timeout { fail "ptype g_vB (timeout)" }
663 }
c906108c
SS
664
665 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
666 send_gdb "ptype vC\n"
667 gdb_expect {
c2d11a7d 668 -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
a0b3c4fd
JM
669 pass "ptype vC"
670 }
671 -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
672 pass "ptype vC (aCC)"
673 }
674 -re ".*$gdb_prompt $" { fail "ptype vC" }
675 timeout { fail "ptype vC (timeout)" }
676 }
c906108c
SS
677
678 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
679 send_gdb "ptype class vC\n"
680 gdb_expect {
c2d11a7d 681 -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
a0b3c4fd
JM
682 pass "ptype class vC"
683 }
684 -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
685 pass "ptype class vC (aCC)"
686 }
687 -re ".*$gdb_prompt $" { fail "ptype class vC" }
688 timeout { fail "ptype class vC (timeout)" }
689 }
c906108c
SS
690
691 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
692 send_gdb "ptype g_vC\n"
693 gdb_expect {
c2d11a7d 694 -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
a0b3c4fd
JM
695 pass "ptype g_vC"
696 }
697 -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" {
698 pass "ptype g_vC (aCC)"
699 }
700 -re ".*$gdb_prompt $" { fail "ptype g_vC" }
701 timeout { fail "ptype g_vC (timeout)" }
702 }
c906108c
SS
703}
704
705#
706# Single virtual inheritance, print complete classes.
707#
708
709proc test_print_svi_classes {} {
710 global gdb_prompt
711 global hex
712 global decimal
713 global nl
c2d11a7d 714 global vbptr
c906108c
SS
715
716 # Print all members of g_vA.
717
718 gdb_test "print g_vA" ".* = \{va = 1, vx = 2\}" "print g_vA"
719
720 # Print all members of g_vB.
721
722 setup_xfail_format "DWARF 1"
723 send_gdb "print g_vB\n"
724 gdb_expect {
a0b3c4fd
JM
725 -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" {
726 pass "print g_vB (aCC)"
727 }
728 -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, __vfp = $hex\}$nl$gdb_prompt $" {
729 pass "print g_vB (aCC)"
730 }
c2d11a7d 731 -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, ${vbptr}vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
c906108c
SS
732 pass "print g_vB"
733 }
5178b9d6
DJ
734 -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vptr.vB = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" {
735 pass "print g_vB (FIXME v3 vtbl ptr)"
736 }
c906108c
SS
737 -re ".*invalid address 0x0.*$gdb_prompt $" {
738 # Does not happen with gcc cygnus-2.4.5-930828
739 fail "print g_vB (known bug with gcc cygnus-2.4.5-930417)"
740 # Many of the rest of these tests have the same problem.
741 return 0
742 }
743 -re ".*$gdb_prompt $" { fail "print g_vB" }
744 timeout { fail "print g_vB (timeout)" ; return }
745 }
746
747 # Print all members of g_vC.
748
749 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
750 send_gdb "print g_vC\n"
751 gdb_expect {
752 -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" {
753 pass "print g_vC (aCC)"
754 }
755 -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, __vfp = $hex\}$nl$gdb_prompt $" {
756 pass "print g_vC (aCC)"
757 }
c2d11a7d 758 -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, ${vbptr}vA = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
a0b3c4fd
JM
759 pass "print g_vC"
760 }
5178b9d6
DJ
761 -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vptr.vC = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" {
762 pass "print g_vC (FIXME v3 vtbl ptr)"
763 }
a0b3c4fd
JM
764 -re ".*$gdb_prompt $" { fail "print g_vC" }
765 timeout { fail "print g_vC (timeout)" }
766 }
c906108c
SS
767}
768
769#
770# Multiple virtual inheritance, print individual members.
771#
772
773proc test_print_mvi_members {} {
774 global gdb_prompt
775 global decimal
776 global nl
777
778 # Print all members of g_vD.
779
780 setup_xfail_format "DWARF 1"
781 send_gdb "print g_vD.vA::va\n"
782 gdb_expect {
783 -re ".* = 19$nl$gdb_prompt $" { pass "print g_vD.vA::va" }
784 -re ".*virtual baseclass botch.*$gdb_prompt $" {
785 # Does not happen with gcc cygnus-2.4.5-930828
786 fail "print g_vD.vA::va (known bug with gcc cygnus-2.4.5-930417)"
787 # Many of the rest of these tests have the same problem.
788 return 0
789 }
790 -re ".*$gdb_prompt $" { fail "print g_vD.vA::va" }
791 timeout { fail "print g_vD.vA::va (timeout)" ; return }
792 }
793
794 setup_xfail_format "DWARF 1"
795 gdb_test "print g_vD.vA::vx" ".* = 20" "print g_vD.vA::vx"
796
797 setup_xfail_format "DWARF 1"
798 gdb_test "print g_vD.vB::vb" ".* = 21" "print g_vD.vB::vb"
799
800 setup_xfail_format "DWARF 1"
801 gdb_test "print g_vD.vB::vx" ".* = 22" "print g_vD.vB::vx"
802
803 setup_xfail_format "DWARF 1"
804 gdb_test "print g_vD.vC::vc" ".* = 23" "print g_vD.vC::vc"
805
806 setup_xfail_format "DWARF 1"
807 gdb_test "print g_vD.vC::vx" ".* = 24" "print g_vD.vC::vx"
808
809 gdb_test "print g_vD.vD::vd" ".* = 25" "print g_vD.vD::vd"
810
811 gdb_test "print g_vD.vD::vx" ".* = 26" "print g_vD.vD::vx"
812
813 # Print all members of g_vE.
814
815 setup_xfail_format "DWARF 1"
816 gdb_test "print g_vE.vA::va" ".* = 0" "print g_vE.vA::va"
817
818 setup_xfail_format "DWARF 1"
819 gdb_test "print g_vE.vA::vx" ".* = 0" "print g_vE.vA::vx"
820
821 setup_xfail_format "DWARF 1"
822 gdb_test "print g_vE.vB::vb" ".* = 0" "print g_vE.vB::vb"
823
824 setup_xfail_format "DWARF 1"
825 gdb_test "print g_vE.vB::vx" ".* = 0" "print g_vE.vB::vx"
826
827 setup_xfail_format "DWARF 1"
828 gdb_test "print g_vE.vC::vc" ".* = 0" "print g_vE.vC::vc"
829
830 setup_xfail_format "DWARF 1"
831 gdb_test "print g_vE.vC::vx" ".* = 0" "print g_vE.vC::vx"
832
833 setup_xfail_format "DWARF 1"
834 gdb_test "print g_vE.vD::vd" ".* = 0" "print g_vE.vD::vd"
835
836 gdb_test "print g_vE.vD::vx" ".* = 0" "print g_vE.vD::vx"
837
838 gdb_test "print g_vE.vE::ve" ".* = 27" "print g_vE.vE::ve"
839
840 gdb_test "print g_vE.vE::vx" ".* = 28" "print g_vE.vE::vx"
841}
842
843#
844# Multiple virtual inheritance, print type definitions.
845#
846
847proc test_ptype_mvi {} {
a0b3c4fd
JM
848 global gdb_prompt
849 global ws
c906108c 850 global nl
c2d11a7d 851 global vbptr
c906108c
SS
852
853 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
854 send_gdb "ptype vD\n"
855 gdb_expect {
c2d11a7d 856 -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;$nl.*\}.*$gdb_prompt $" {
a0b3c4fd
JM
857 pass "ptype vD"
858 }
859 -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" {
860 pass "ptype vD"
861 }
862 -re ".*$gdb_prompt $" { fail "ptype vD" }
863 timeout { fail "(timeout) ptype vD" }
864 }
c906108c
SS
865
866 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
867 send_gdb "ptype class vD\n"
868 gdb_expect {
c2d11a7d 869 -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;$nl.*\}.*$gdb_prompt $" {
a0b3c4fd
JM
870 pass "ptype class vD"
871 }
872 -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" {
873 pass "ptype class vD"
874 }
875 -re ".*$gdb_prompt $" { fail "ptype class vD" }
876 timeout { fail "(timeout) ptype class vD" }
877 }
c906108c
SS
878
879 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
880 send_gdb "ptype g_vD\n"
881 gdb_expect {
c2d11a7d 882 -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;$nl.*\}.*$gdb_prompt $" {
a0b3c4fd
JM
883 pass "ptype g_vD"
884 }
885 -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
886 pass "ptype g_vD"
887 }
888 -re ".*$gdb_prompt $" { fail "ptype g_vD" }
889 timeout { fail "(timeout) ptype g_vD" }
890 }
c906108c
SS
891
892 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
893 send_gdb "ptype vE\n"
894 gdb_expect {
c2d11a7d 895 -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
a0b3c4fd
JM
896 pass "ptype vE"
897 }
898 -re ".*class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
899 pass "ptype vE"
900 }
901 -re ".*$gdb_prompt $" { fail "ptype vE" }
902 timeout { fail "(timeout) ptype vE" }
903 }
c906108c
SS
904
905 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
906 send_gdb "ptype class vE\n"
907 gdb_expect {
c2d11a7d 908 -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
a0b3c4fd
JM
909 pass "ptype class vE"
910 }
911 -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
912 pass "ptype class vE"
913 }
914 -re ".*$gdb_prompt $" { fail "ptype class vE" }
915 timeout { fail "(timeout) ptype class vE" }
916 }
c906108c
SS
917
918 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
919 send_gdb "ptype g_vE\n"
920 gdb_expect {
c2d11a7d 921 -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" {
a0b3c4fd
JM
922 pass "ptype g_vE"
923 }
924 -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" {
925 pass "ptype g_vE"
926 }
927 -re ".*$gdb_prompt $" { fail "ptype g_vE" }
928 timeout { fail "(timeout) ptype g_vE" }
929 }
c906108c
SS
930}
931
932#
933# Multiple virtual inheritance, print complete classes.
934#
935
936proc test_print_mvi_classes {} {
937 global gdb_prompt
938 global hex
939 global decimal
940 global nl
c2d11a7d 941 global vbptr
c906108c
SS
942
943 # Print all members of g_vD.
944
945 setup_xfail_format "DWARF 1"
946 send_gdb "print g_vD\n"
947 gdb_expect {
a0b3c4fd
JM
948 -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \<class vC\> = \{vc = 23, vx = 24, Virtual table at $hex\}, vd = 25, vx = 26, Virtual table at $hex\}$nl$gdb_prompt $" {
949 pass "print g_vD (aCC)"
950 }
951 -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, __vfp = $hex\}, \<class vC\> = \{vc = 23, vx = 24, __vfp = $hex\}, vd = 25, vx = 26, __vfp = $hex\}$nl$gdb_prompt $" {
952 pass "print g_vD (aCC)"
953 }
c2d11a7d 954 -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, ${vbptr}vA = $hex, vb = 21, vx = 22\}, \<vC\> = \{${vbptr}vA = $hex, vc = 23, vx = 24\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
c906108c
SS
955 pass "print g_vD"
956 }
5178b9d6
DJ
957 -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vptr.vC = $hex, vc = 23, vx = 24\}, _vptr.vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
958 pass "print g_vD (FIXME v3 vtbl ptr)"
959 }
c906108c
SS
960 -re ".*invalid address 0x0.*$gdb_prompt $" {
961 # Does not happen with gcc cygnus-2.4.5-930828
962 fail "print g_vD (known bug with gcc cygnus-2.4.5-930417)"
963 # Many of the rest of these tests have the same problem.
964 return 0
965 }
966 -re ".*$gdb_prompt $" { fail "print g_vD" }
967 timeout { fail "print g_vD (timeout)" ; return }
968 }
969
970 # Print all members of g_vE.
971
972 setup_xfail_format "DWARF 1"
a0b3c4fd
JM
973 send_gdb "print g_vE\n"
974 gdb_expect {
975 -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \<class vC\> = \{vc = 0, vx = 0, Virtual table at $hex\}, vd = 0, vx = 0, Virtual table at $hex\}, ve = 27, vx = 28, Virtual table at $hex\}$nl$gdb_prompt $" {
976 pass "print g_vE (aCC)"
977 }
978 -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, __vfp = $hex\}, \<class vC\> = \{vc = 0, vx = 0, __vfp = $hex\}, vd = 0, vx = 0, __vfp = $hex\}, ve = 27, vx = 28, __vfp = $hex\}$nl$gdb_prompt $" {
979 pass "print g_vE (aCC)"
980 }
c2d11a7d 981 -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, ${vbptr}vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{${vbptr}vA = $hex, vc = 0, vx = 0\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 0, vx = 0\}, ${vbptr}vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
a0b3c4fd
JM
982 pass "print g_vE"
983 }
5178b9d6
DJ
984 -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vptr.vB = $hex, vb = 0, vx = 0\}, \<vC\> = \{_vptr.vC = $hex, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
985 pass "print g_vE (FIXME v3 vtbl ptr)"
986 }
a0b3c4fd
JM
987 -re ".*$gdb_prompt $" { fail "print g_vE" }
988 timeout { fail "print g_vE (timeout)" }
989 }
c906108c
SS
990}
991
992proc do_tests {} {
993 global prms_id
994 global bug_id
995 global subdir
996 global objdir
997 global srcdir
998 global binfile
999
1000 set prms_id 0
1001 set bug_id 0
1002
1003 # Start with a fresh gdb.
1004
1005 gdb_exit
1006 gdb_start
1007 gdb_reinitialize_dir $srcdir/$subdir
1008 gdb_load $binfile
1009
1010 gdb_test "set language c++" ""
1011 gdb_test "set width 0" ""
1012
1013 # Get the debug format for the compiled test case.
1014
1015 if { ![ runto_main] } {
1016 gdb_suppress_tests;
1017 } else {
1018 get_debug_format
1019 }
1020
1021 test_ptype_si
1022 test_ptype_mi
1023 test_ptype_vi
1024 test_ptype_mvi
1025
1026 gdb_stop_suppressing_tests;
1027
b2f9ec70 1028 if { ![ runto 'inheritance2' ] } {
c906108c
SS
1029 gdb_suppress_tests;
1030 }
1031
1032 test_print_si_members
1033 test_print_si_classes
1034 test_print_mi_members
1035 test_print_mi_classes
1036 test_print_anon_union
1037
1038 gdb_stop_suppressing_tests;
1039
b2f9ec70 1040 if { ![ runto 'inheritance4' ] } {
c906108c
SS
1041 gdb_suppress_tests;
1042 }
1043
1044 test_print_svi_members
1045 test_print_svi_classes
1046 test_print_mvi_members
1047 test_print_mvi_classes
1048}
1049
1050do_tests
This page took 0.238539 seconds and 4 git commands to generate.