OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [testsuite/] [gdb.c++/] [inherit.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.