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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [opaque.exp] - Blame information for rev 321

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

Line No. Rev Author Line
1 24 jeremybenn
# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2002, 2007, 2008
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
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# This file was written by Fred Fish. (fnf@cygnus.com)
21
 
22
if $tracelevel then {
23
        strace $tracelevel
24
}
25
 
26
set prms_id 0
27
set bug_id 0
28
 
29
set testfile "opaque"
30
set binfile ${objdir}/${subdir}/opaque
31
 
32
#if  { [gdb_compile "${srcdir}/${subdir}/opaque0.c ${srcdir}/${subdir}/opaque1.c" "${binfile}" executable {debug}] != "" } {
33
#     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
34
#}
35
 
36
if  { [gdb_compile "${srcdir}/${subdir}/opaque0.c" "${binfile}0.o" object {debug}] != "" } {
37
     untested opaque.exp
38
     return -1
39
}
40
 
41
if  { [gdb_compile "${srcdir}/${subdir}/opaque1.c" "${binfile}1.o" object {debug}] != "" } {
42
     untested opaque.exp
43
     return -1
44
}
45
 
46
if  { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
47
     untested opaque.exp
48
     return -1
49
}
50
 
51
 
52
# Create and source the file that provides information about the compiler
53
# used to compile the test case.
54
if [get_compiler_info ${binfile}] {
55
    return -1;
56
}
57
 
58
# Start with a fresh gdb.
59
 
60
gdb_exit
61
gdb_start
62
gdb_reinitialize_dir $srcdir/$subdir
63
gdb_load ${binfile}
64
 
65
#
66
# Test basic opaque structure handling (statically).
67
# The ordering of the tests is significant.  We first try the things that
68
# might fail if gdb fails to connect the uses of opaque structures to
69
# the actual opaque structure definition.
70
 
71
# When we start up, gdb sets the file containing main() as the current
72
# source file.  The actual structure foo is defined in a different file.
73
# A pointer (foop) to an instance of the opaque struct is defined in the same
74
# source file as main().  Ensure that gdb correctly "connected" the definition
75
# in the other file with the pointer to the opaque struct in the file containing
76
# "foop".
77
 
78
# Define a procedure to set up an xfail for all targets that do not support
79
# this sort of cross reference.
80
# Any target gcc that has a DBX_NO_XREFS definition in its config file will
81
# not support it (FIXME: Is this still true; I suspect maybe not).
82
 
83
# Native alpha ecoff doesn't support it either.
84
# I don't think this type of cross reference works for any COFF target
85
# either.
86
 
87
proc setup_xfail_on_opaque_pointer {} {
88
        global gcc_compiled
89
 
90
        setup_xfail "vax-*-*" "i*86-sequent-bsd*"
91
        if {!$gcc_compiled} then {
92
                setup_xfail "alpha-*-*" "mips-sgi-irix5*"
93
        }
94
}
95
 
96
# This seems easier than trying to track different versions of xlc; I'm
97
# not sure there is much rhyme or reason regarding which tests it fails
98
# and which ones it passes.
99
if {[istarget "rs6000-*-aix*"] && !$gcc_compiled} then {
100
    warning "xfails in opaque.exp may not be set up correctly for xlc"
101
}
102
 
103
setup_xfail_on_opaque_pointer
104
gdb_test "whatis foop" \
105
    "type = struct foo \[*\]+" \
106
    "whatis on opaque struct pointer (statically)"
107
 
108
 
109
# Ensure that we know the form of the structure that foop points to.
110
 
111
setup_xfail_on_opaque_pointer
112
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
113
gdb_test "ptype foop" \
114
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\} \[*\]+" \
115
    "ptype on opaque struct pointer (statically)"
116
 
117
 
118
# An instance of the opaque structure (afoo) is defined in a different file.
119
# Ensure that we can locate afoo and the structure definition.
120
 
121
gdb_test "whatis afoo" \
122
    "type = struct foo" \
123
    "whatis on opaque struct instance (statically)"
124
 
125
 
126
# Ensure that we know the form of "afoo".
127
 
128
gdb_test "ptype afoo" \
129
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\}" \
130
    "ptype on opaque struct instance (statically)"
131
 
132
 
133
# Ensure that we know what a struct foo looks like.
134
 
135
gdb_test "ptype struct foo" \
136
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\}" \
137
    "ptype on opaque struct tagname (statically)"
138
 
139
 
140
#
141
# Done with static tests, now test dynamic opaque structure handling.
142
# We reload the symbol table so we forget about anything we might
143
# have learned during the static tests.
144
#
145
 
146
if [istarget "mips-idt-*"] then {
147
    # Restart because IDT/SIM runs out of file descriptors.
148
    gdb_exit
149
    gdb_start
150
}
151
gdb_reinitialize_dir $srcdir/$subdir
152
gdb_load ${binfile}
153
 
154
# Run to main, where struct foo is incomplete.
155
if ![runto_main] {
156
    perror "cannot run to breakpoint at main"
157
}
158
 
159
 
160
# The current source file is now the one containing main().  The structure foo
161
# is defined in a different file, but we have a pointer to an instance of
162
# the opaque structure in the current file.  Ensure we know it's type.
163
 
164
setup_xfail_on_opaque_pointer
165
gdb_test "whatis foop" \
166
    "type = struct foo \[*\]+" \
167
    "whatis on opaque struct pointer (dynamically)"
168
 
169
 
170
# Ensure that we know the form of the thing foop points to.
171
 
172
setup_xfail_on_opaque_pointer
173
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
174
gdb_test "ptype foop" \
175
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\} \[*\]+" \
176
    "ptype on opaque struct pointer (dynamically) 1"
177
 
178
gdb_test "whatis afoo" \
179
    "type = struct foo" \
180
    "whatis on opaque struct instance (dynamically) 1"
181
 
182
 
183
# Ensure that we know the form of afoo, an instance of a struct foo.
184
 
185
gdb_test "ptype afoo" \
186
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\}" \
187
    "ptype on opaque struct instance (dynamically) xyz 1"
188
 
189
 
190
# Ensure that we know the form of an explicit struct foo.
191
 
192
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
193
gdb_test "ptype struct foo" \
194
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\}" \
195
    "ptype on opaque struct tagname (dynamically) 1"
196
 
197
 
198
# Now reload the symbols again so we forget about anything we might
199
# have learned reading the symbols during the previous tests.
200
 
201
if [istarget "mips-idt-*"] then {
202
    # Restart because IDT/SIM runs out of file descriptors.
203
    gdb_exit
204
    gdb_start
205
}
206
gdb_reinitialize_dir $srcdir/$subdir
207
gdb_load ${binfile}
208
 
209
# Run to getfoo, where struct foo is complete.
210
if ![runto getfoo] {
211
    perror "cannot run to breakpoint at getfoo"
212
}
213
 
214
 
215
# Ensure that we know what foop is.
216
 
217
setup_xfail_on_opaque_pointer
218
gdb_test "whatis foop" \
219
    "type = struct foo \[*\]+" \
220
    "whatis on opaque struct pointer (dynamically) 1"
221
 
222
 
223
# Ensure that we know the form of the thing foop points to.
224
 
225
setup_xfail_on_opaque_pointer
226
if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
227
gdb_test "ptype foop" \
228
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\} \[*\]+" \
229
    "ptype on opaque struct pointer (dynamically) 2"
230
 
231
gdb_test "whatis afoo" \
232
    "type = struct foo" \
233
    "whatis on opaque struct instance (dynamically) 1"
234
 
235
 
236
# Ensure that we know the form of afoo, an instance of a struct foo.
237
 
238
gdb_test "ptype afoo" \
239
    "type = struct foo \{\r\n    int a;\r\n    int b;\r\n\}" \
240
    "ptype on opaque struct instance (dynamically) 1"
241
 
242
gdb_test "ptype afoo" \
243
    "type = struct foo \{\[\r\n\]*.*int a;\[\r\n\]*.*int b;\[\r\n\]*}\[\r\n\]*" \
244
    "ptype on opaque struct instance (dynamically) pqr 1"
245
 
246
 
247
# Ensure that we know the form of an explicit struct foo.
248
 
249
gdb_test "ptype foop" \
250
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\} \[*\]+" \
251
    "ptype on opaque struct pointer (dynamically) 2"
252
 
253
gdb_test "whatis afoo" \
254
    "type = struct foo" \
255
    "whatis on opaque struct instance (dynamically) 2"
256
 
257
 
258
# Ensure that we know the form of afoo, an instance of a struct foo.
259
 
260
gdb_test "ptype afoo" \
261
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\}" \
262
    "ptype on opaque struct instance (dynamically) 2"
263
 
264
 
265
# Ensure that we know the form of an explicit struct foo.
266
 
267
gdb_test "ptype struct foo" \
268
    "type = struct foo \{\[\r\n\]+    int a;\[\r\n\]+    int b;\[\r\n\]+\}" \
269
    "ptype on opaque struct tagname (dynamically) 2"

powered by: WebSVN 2.1.0

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