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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.hp/] [gdb.base-hp/] [so-thresh.exp] - Blame information for rev 841

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
#   Copyright (C) 1997, 1998, 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
if $tracelevel then {
18
        strace $tracelevel
19
        }
20
 
21
 
22
if { [skip_hp_tests] } then { continue }
23
 
24
set testfile "so-thresh"
25
set binfile ${objdir}/${subdir}/${testfile}
26
 
27
if [get_compiler_info ${binfile}] {
28
    return -1
29
}
30
 
31
# This testcase is relatively large, and therefore can take awhile to
32
# load.  We'd best set the timeout to something suitable, or we may
33
# seem to fail...
34
#
35
set timeout 60
36
 
37
# Build procedure for this testcase:
38
#    ${srcdir}/${subdir}/so-thresh.sh ${subdir}
39
#        which calls,
40
#        make -f ${srcdir}/${subdir}/so-thresh.mk  
41
#            which builds,
42
#                genso-thresh (from genso-thresh.c)
43
#                    which generates,
44
#                        lib00-so-thresh.c
45
#                        lib01-so-thresh.c
46
#                        lib02-so-thresh.c
47
#                        so-thresh.lopt (link options file)
48
#                lib0*-so-thresh.sl (from .c files above)
49
#                so-thresh (from so-thresh.c)
50
#                    using lib0*-so-thresh.sl and so-thresh.lopt
51
#
52
# Since so-thresh.mk requires SRCDIR and OBJDIR macro definitions,
53
# and SRCDIR / OBJDIR could be in relative path format, we use
54
# so-thresh.sh script to pin down SRCDIR / OBJDIR (using $PWD/ prefix
55
# when detected relative path values for srcdir / objdir), before the
56
# 'cd $subdir' call (when this can be done in TCL here, we can call
57
# make directly instead).
58
#
59
# remote_exec build "sh -c \\\"cd ${objdir}/${subdir}\\; make -v -f ${srcdir}/${subdir}/${testfile}.mk clean require_shlibs all SRCDIR=${srcdir}/${subdir} OBJDIR=${objdir}/${subdir}\\\""
60
 
61
remote_exec build "${srcdir}/${subdir}/${testfile}.sh $subdir"
62
 
63
# Only HP-UX (and any other platforms using SOM shared libraries, I
64
# guess) interprets the auto-solib-limit variable as a threshhold,
65
# rather than a boolean that strictly enables or disables automatic
66
# loading of shlib symbol tables.
67
#
68
# On HP-UX, it is the size threshhold (in megabytes) at which to
69
# stop auto loading of symbol tables.
70
#
71
if ![istarget "hppa*-hp-hpux*"] then {
72
   setup_xfail "*-*-*"
73
}
74
 
75
# Start with a fresh gdb
76
#
77
gdb_exit
78
gdb_start
79
gdb_reinitialize_dir $srcdir/$subdir
80
gdb_load ${binfile}
81
 
82
# This is a test of gdb's ability on HP-UX to stop automatically
83
# loading symbols of shared libraries, when the total size of the
84
# debugger's symbol table reaches a specified threshhold.
85
#
86
 
87
# On HP-UX, the help text for auto-solib-limit mentions that it
88
# serves as a threshhold.
89
#
90
send_gdb "help set auto-solib-limit\n"
91
gdb_expect {
92
  -re "Set threshold .in Mb. for autoloading shared library symbols.*
93
When shared library autoloading is enabled, new libraries will be loaded.*
94
only until the total size of shared library symbols exceeds this.*
95
threshold in megabytes.  Is ignored when using .sharedlibrary.*$gdb_prompt $"\
96
          {pass "help set auto-solib-limit"}
97
  -re "$gdb_prompt $"\
98
          {fail "help set auto-solib-limit"}
99
  timeout {fail "(timeout) help set auto-solib-limit"}
100
}
101
 
102
# On HP-UX, the threshhold is by default set to 50, which means
103
# 50 megabytes.
104
#
105
send_gdb "show auto-solib-limit\n"
106
gdb_expect {
107
  -re "Threshold .in Mb. for autoloading shared library symbols is $decimal.*$gdb_prompt $"\
108
          {pass "show auto-solib-limit "}
109
  -re "$gdb_prompt $"\
110
          {fail "show auto-solib-limit "}
111
  timeout {fail "(timeout) show auto-solib-limit "}
112
}
113
 
114
send_gdb "set auto-solib-limit 1\n"
115
gdb_expect {
116
   -re ".*$gdb_prompt $"
117
            {pass "set auto-solib-limit to 1"}
118
   -re ".*$gdb_prompt $"
119
            {fail "set auto-solib-limit to 1"}
120
   timeout {fail "(timeout) set auto-solib-limit to 1"}
121
}
122
 
123
 
124
# We have manually verified that our testcase exceeds 1 Mbytes
125
# of heap space in GDB to hold the symbols for the main program
126
# and all associated linked-against libraries.  Thus, when we
127
# run to the program's main, and therefore notice all the linked-
128
# against shlibs, we expect to hit the threshhold.
129
#
130
# (Note that we're not using the expect [runto main] function here,
131
# 'cause we want to match on output from the run command.
132
#
133
send_gdb "break main\n"
134
gdb_expect {
135
  -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
136
          {pass "1 set break at main"}
137
  -re "$gdb_prompt $"\
138
          {fail "1 set break at main"}
139
  timeout {fail "(timeout) 1 set break at main"}
140
}
141
 
142
send_gdb "run\n"
143
gdb_expect {
144
  -re ".*warning. Symbols for some libraries have not been loaded, because.*
145
doing so would exceed the size threshold specified by auto-solib-limit.*
146
To manually load symbols, use the 'sharedlibrary' command.*
147
To raise the threshold, set auto-solib-limit to a larger value and rerun.*
148
the program.*$gdb_prompt $"\
149
          {pass "run to main hit auto-solib-limit threshold"}
150
  -re "$gdb_prompt $"\
151
          {fail "run to main hit auto-solib-limit threshold"}
152
  timeout {fail "(timeout) run to main hit auto-solib-limit threshold"}
153
}
154
 
155
# Verify that "info share" mentions something about libraries whose
156
# symbols weren't loaded.
157
#
158
# We'll assume that at least the last two shlib's symbols weren't
159
# loaded.  As a side-effect of matching this pattern, the text start
160
# address of the last one is captured in expect_out(1,string).
161
# (we'll need it for the 'add-symbol-file' command in a nonce...)
162
#
163
send_gdb "info sharedlibrary\n"
164
gdb_expect {
165
  -re ".*lib01_$testfile.sl .*symbols not loaded.*0x\[0-9\]*  (0x\[0-9a-fA-F\]*).*$gdb_prompt $"\
166
          { send_gdb "add-symbol-file lib02_$testfile.sl $expect_out(1,string)\n"
167
            gdb_expect {
168
              -re "add symbol table.*y or n.*$"\
169
                      {send_gdb "y\n"
170
                       gdb_expect {
171
                         -re "$gdb_prompt $" {pass "add-symbol-file and info sharedlib"}
172
                         timeout {fail "(timeout) add-symbol-file and info sharedlib"}
173
                       }}
174
              -re "$gdb_prompt $"\
175
                      {fail "add-symbol-file and info sharedlib"}
176
              timeout {fail "(timeout) add-symbol-file and info sharedlib"}
177
            }
178
          }
179
  -re "$gdb_prompt $" {
180
        setup_xfail hppa*-*-* CHFts24108
181
        fail "info sharedlibrary shows shlibs with unloaded symbols"
182
    }
183
  timeout {fail "(timeout) info sharedlibrary shows shlibs with unloaded symbols"}
184
}
185
 
186
# Verify that we can manually load the symbol table of a library
187
# whose symbols weren't loaded.  (We'll pick the last one.)
188
#
189
 
190
# I moved this test inside the one above, because the expect_out array is not ok if the
191
# previous test has failed, and expect would error out (elz)
192
#
193
#send_gdb "add-symbol-file lib02_$testfile.sl $expect_out(1,string)\n"
194
#gdb_expect {
195
#  -re "add symbol table.*y or n.*$"\
196
#          {send_gdb "y\n"
197
#           gdb_expect {
198
#             -re "$gdb_prompt $" {pass "add-symbol-file"}
199
#             timeout {fail "(timeout) add-symbol-file"}
200
#           }}
201
#  -re "$gdb_prompt $"\
202
#          {fail "add-symbol-file"}
203
#  timeout {fail "(timeout) add-symbol-file"}
204
#}
205
 
206
# Verify that we can manually load the symbols for all libraries
207
# which weren't already loaded.
208
#
209
# Warning!  On a machine with little free swap space, this may
210
# fail!
211
#
212
send_gdb "sharedlibrary\n"
213
gdb_expect {
214
  -re "Reading symbols from.*done.*$gdb_prompt $"\
215
          {pass "sharedlibrary"}
216
  -re "$gdb_prompt $" {
217
        setup_xfail hppa*-*-* CHFts24108
218
        fail "sharedlibrary"
219
    }
220
  timeout {fail "(timeout) sharedlibrary"}
221
}
222
 
223
# Rerun the program, this time verifying that we can set the
224
# threshhold high enough to avoid hitting it.
225
#
226
# It appears that gdb isn't freeing memory when rerunning, as one
227
# would expect.  To avoid potentially hitting a virtual memory
228
# ceiling, start with a fresh gdb.
229
#
230
gdb_exit
231
gdb_start
232
gdb_reinitialize_dir $srcdir/$subdir
233
gdb_load ${binfile}
234
 
235
send_gdb "break main\n"
236
gdb_expect {
237
  -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
238
          {pass "2 set break at main"}
239
  -re "$gdb_prompt $"\
240
          {fail "2 set break at main"}
241
  timeout {fail "(timeout) 2 set break at main"}
242
}
243
 
244
send_gdb "set auto-solib-limit 9999\n"
245
gdb_expect {
246
  -re "$gdb_prompt $"\
247
          {pass "set auto-solib-limit threshold to practical infinity"}
248
  timeout {fail "(timeout) set auto-solib-limit threshold to practical infinity"}
249
}
250
send_gdb "run\n"
251
gdb_expect {
252
  -re ".*warning. Symbols for some libraries have not been loaded, because.*
253
doing so would exceed the size threshold specified by auto-solib-limit.*
254
To manually load symbols, use the 'sharedlibrary' command.*
255
To raise the threshold, set auto-solib-limit to a larger value and rerun.*
256
the program.*$gdb_prompt $"\
257
          {fail "rerun threshold at practical infinity (still hit threshold)"}
258
  -re "$gdb_prompt $"\
259
          {pass "rerun with threshold at practical infinity"}
260
  timeout {fail "(timeout) rerun with threshold at practical infinity"}
261
}
262
 
263
# Rerun the program, this time altogether disabling the auto loading
264
# feature.  There should be no information at all about shared
265
# libraries now.
266
#
267
# ??rehrauer: Personally, I'd call that a bug, since it doesn't give
268
# you the ability to manually load single shlibs (you need the text
269
# start address that 'info share' normall gives you).  On the other
270
# hand, one can easily choose to load them all...
271
#
272
# It appears that gdb isn't freeing memory when rerunning, as one
273
# would expect.  To avoid potentially hitting a virtual memory
274
# ceiling, start with a fresh gdb.
275
#
276
gdb_exit
277
gdb_start
278
gdb_reinitialize_dir $srcdir/$subdir
279
gdb_load ${binfile}
280
 
281
send_gdb "break main\n"
282
gdb_expect {
283
  -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
284
          {pass "3 set break at main"}
285
  -re "$gdb_prompt $"\
286
          {fail "3 set break at main"}
287
  timeout {fail "(timeout) 3 set break at main"}
288
}
289
 
290
send_gdb "set auto-solib-limit 0\n"
291
gdb_expect {
292
  -re "$gdb_prompt $"\
293
          {pass "set auto-solib-limit threshold to 0"}
294
  timeout {fail "(timeout) set auto-solib-limit threshold to 0"}
295
}
296
send_gdb "run\n"
297
gdb_expect {
298
  -re ".*warning. Symbols for some libraries have not been loaded, because.*
299
doing so would exceed the size threshold specified by auto-solib-limit.*
300
To manually load symbols, use the 'sharedlibrary' command.*
301
To raise the threshold, set auto-solib-limit to a larger value and rerun.*
302
the program.*$gdb_prompt $"\
303
          {fail "rerun threshold at 0 (still hit threshold)"}
304
  -re "$gdb_prompt $"\
305
          {pass "rerun with threshold at 0"}
306
  timeout {fail "(timeout) rerun with threshold at 0"}
307
}
308
 
309
# Verify that we can still manually load symbols for all libraries.
310
# (We'll assume that if the last shlib's symbols are loaded, that
311
# all of them were.)
312
#
313
# Note that we set the GDB "height" variable to prevent GDB from
314
# prompting
315
#
316
# Warning!  On a machine with little free swap space, this may
317
# fail!
318
#
319
send_gdb "set height 9999\n"
320
gdb_expect {
321
  -re "$gdb_prompt $"\
322
          {pass "set screen page height to practical infinity"}
323
  timeout {fail "(timeout) set screen page height to practical infinity"}
324
}
325
send_gdb "sharedlibrary\n"
326
gdb_expect {
327
  -re ".*Reading symbols from .*/lib02-so-thresh\\.sl\\.\\.\\.done\\..*$gdb_prompt $"\
328
          {pass "manually load all symbols"}
329
  -re "$gdb_prompt $" {
330
        setup_xfail hppa*-*-* CHFts24108
331
        fail "manually load all symbols (CHFts24108)"
332
    }
333
  timeout {fail "(timeout) manually load all symbols"}
334
}
335
 
336
return 0

powered by: WebSVN 2.1.0

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