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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc3/] [gdb/] [testsuite/] [gdb.cp/] [derivation.exp] - Blame information for rev 579

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010
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 3 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, see .
16
 
17
# This file was written by Elena Zannoni (ezannoni@cygnus.com)
18
# And rewritten by Michael Chastain 
19
 
20
# This file is part of the gdb testsuite
21
 
22
# tests for inheritance, with several derivations types combinations
23
# (private, public, protected)
24
# classes have simple members and member functions.
25
 
26
set ws "\[\r\n\t \]+"
27
set nl "\[\r\n\]+"
28
 
29
if $tracelevel then {
30
    strace $tracelevel
31
}
32
 
33
# Start program.
34
 
35
 
36
if { [skip_cplus_tests] } { continue }
37
 
38
load_lib "cp-support.exp"
39
 
40
set testfile "derivation"
41
set srcfile ${testfile}.cc
42
set binfile ${objdir}/${subdir}/${testfile}
43
 
44
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
45
     untested derivation.exp
46
     return -1
47
}
48
 
49
gdb_exit
50
gdb_start
51
gdb_reinitialize_dir $srcdir/$subdir
52
gdb_load ${binfile}
53
 
54
# Set it up at a breakpoint so we can play with the variable values.
55
 
56
if ![runto 'marker1'] then {
57
    perror "couldn't run to marker1"
58
    continue
59
}
60
 
61
gdb_test "up" ".*main.*" "up from marker1"
62
 
63
# Print class types and values.
64
 
65
# class A
66
 
67
gdb_test "print a_instance" "\\$\[0-9\]+ = \{a = 1, aa = 2\}" "print value of a_instance"
68
 
69
cp_test_ptype_class \
70
    "ptype a_instance" "" "class" "A" \
71
    {
72
        { field  public "int a;" }
73
        { field  public "int aa;" }
74
        { method public "A();" }
75
        { method public "int afoo();" }
76
        { method public "int foo();" }
77
    }
78
 
79
# class D
80
 
81
gdb_test_multiple "print d_instance" "print value of d_instance" {
82
    -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, d = 7, dd = 8\}$nl$gdb_prompt $" {
83
        pass "print value of d_instance"
84
    }
85
}
86
 
87
cp_test_ptype_class \
88
    "ptype d_instance" "" "class" "D" \
89
    {
90
        { base          "private A" }
91
        { base          "public B" }
92
        { base          "protected C" }
93
        { field  public "int d;" }
94
        { field  public "int dd;" }
95
        { method public "D();" }
96
        { method public "int dfoo();" }
97
        { method public "int foo();" }
98
    } \
99
    "" \
100
    {
101
        { "protected C" "private C" { setup_xfail "*-*-*" "gcc/13539" } }
102
    }
103
 
104
# class E
105
 
106
gdb_test_multiple "print e_instance" "print value of e_instance" {
107
    -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, e = 9, ee = 10\}$nl$gdb_prompt $" {
108
        pass "print value of e_instance"
109
    }
110
}
111
 
112
cp_test_ptype_class \
113
    "ptype e_instance" "" "class" "E" \
114
    {
115
        { base          "public A" }
116
        { base          "private B" }
117
        { base          "protected C" }
118
        { field  public "int e;" }
119
        { field  public "int ee;" }
120
        { method public "E();" }
121
        { method public "int efoo();" }
122
        { method public "int foo();" }
123
    } \
124
    "" \
125
    {
126
        { "protected C" "private C" { setup_xfail "*-*-*" "gcc/13539" } }
127
    }
128
 
129
# class F
130
 
131
gdb_test_multiple "print f_instance" "print value of f_instance" {
132
    -re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, f = 11, ff = 12\}$nl$gdb_prompt $" {
133
        pass "print value of f_instance"
134
    }
135
}
136
 
137
cp_test_ptype_class \
138
    "ptype f_instance" "" "class" "F" \
139
    {
140
        { base          "private A" }
141
        { base          "public B" }
142
        { base          "private C" }
143
        { field  public "int f;" }
144
        { field  public "int ff;" }
145
        { method public "F();" }
146
        { method public "int ffoo();" }
147
        { method public "int foo();" }
148
    }
149
 
150
# Print individual fields.
151
 
152
gdb_test "print d_instance.a"  "\\$\[0-9\]+ = 1" "print value of d_instance.a"
153
gdb_test "print d_instance.aa" "\\$\[0-9\]+ = 2" "print value of d_instance.aa"
154
gdb_test "print d_instance.b"  "\\$\[0-9\]+ = 3" "print value of d_instance.b"
155
gdb_test "print d_instance.bb" "\\$\[0-9\]+ = 4" "print value of d_instance.bb"
156
gdb_test "print d_instance.c"  "\\$\[0-9\]+ = 5" "print value of d_instance.c"
157
gdb_test "print d_instance.cc" "\\$\[0-9\]+ = 6" "print value of d_instance.cc"
158
gdb_test "print d_instance.d"  "\\$\[0-9\]+ = 7" "print value of d_instance.d"
159
gdb_test "print d_instance.dd" "\\$\[0-9\]+ = 8" "print value of d_instance.dd"
160
 
161
# Print some fields which are defined in the top of class G
162
# and in its base classes.  This is not be ambiguous.
163
 
164
gdb_test "print g_instance.a"  "\\$\[0-9\]+ = 15" "print value of g_instance.a"
165
gdb_test "print g_instance.b"  "\\$\[0-9\]+ = 16" "print value of g_instance.b"
166
gdb_test "print g_instance.c"  "\\$\[0-9\]+ = 17" "print value of g_instance.c"
167
 
168
# Print a function call.
169
 
170
gdb_test "print g_instance.afoo()" "\\$\[0-9\]+ = 1" "print value of g_instance.afoo()"
171
 
172
# If GDB fails to restore the selected frame properly after the
173
# inferior function call above (see GDB PR 1155 for an explanation of
174
# why this might happen), all the subsequent tests will fail.  We
175
# should detect report that failure, but let the marker call finish so
176
# that the rest of the tests can run undisturbed.
177
 
178
gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
179
    -re "#0  marker1.*$gdb_prompt $" {
180
        setup_kfail "gdb/1155" s390-*-linux-gnu
181
        fail "re-selected 'main' frame after inferior call"
182
        gdb_test "finish" ".*main.*at .*derivation.cc:.*// marker1-returns-here.*" \
183
            "finish call to marker1"
184
    }
185
    -re "#1  ($hex in )?main.*$gdb_prompt $" {
186
        pass "re-selected 'main' frame after inferior call"
187
    }
188
}
189
 
190
gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.bfoo()"
191
gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.cfoo()"

powered by: WebSVN 2.1.0

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