1 # Copyright (C) 1997, 1998, 2007, 2008 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 if { [skip_hp_tests] } then { continue }
25 set testfile "so-thresh"
26 set binfile ${objdir}/${subdir}/${testfile}
28 if [get_compiler_info ${binfile}] {
32 # This testcase is relatively large, and therefore can take awhile to
33 # load. We'd best set the timeout to something suitable, or we may
38 # Build procedure for this testcase:
39 # ${srcdir}/${subdir}/so-thresh.sh ${subdir}
41 # make -f ${srcdir}/${subdir}/so-thresh.mk <targets> <macros>
43 # genso-thresh (from genso-thresh.c)
48 # so-thresh.lopt (link options file)
49 # lib0*-so-thresh.sl (from .c files above)
50 # so-thresh (from so-thresh.c)
51 # using lib0*-so-thresh.sl and so-thresh.lopt
53 # Since so-thresh.mk requires SRCDIR and OBJDIR macro definitions,
54 # and SRCDIR / OBJDIR could be in relative path format, we use
55 # so-thresh.sh script to pin down SRCDIR / OBJDIR (using $PWD/ prefix
56 # when detected relative path values for srcdir / objdir), before the
57 # 'cd $subdir' call (when this can be done in TCL here, we can call
58 # make directly instead).
60 # 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}\\\""
62 remote_exec build "${srcdir}/${subdir}/${testfile}.sh $subdir"
64 # Only HP-UX (and any other platforms using SOM shared libraries, I
65 # guess) interprets the auto-solib-limit variable as a threshhold,
66 # rather than a boolean that strictly enables or disables automatic
67 # loading of shlib symbol tables.
69 # On HP-UX, it is the size threshhold (in megabytes) at which to
70 # stop auto loading of symbol tables.
72 if ![istarget "hppa*-hp-hpux*"] then {
76 # Start with a fresh gdb
80 gdb_reinitialize_dir $srcdir/$subdir
83 # This is a test of gdb's ability on HP-UX to stop automatically
84 # loading symbols of shared libraries, when the total size of the
85 # debugger's symbol table reaches a specified threshhold.
88 # On HP-UX, the help text for auto-solib-limit mentions that it
89 # serves as a threshhold.
91 send_gdb "help set auto-solib-limit\n"
93 -re "Set threshold .in Mb. for autoloading shared library symbols.*
94 When shared library autoloading is enabled, new libraries will be loaded.*
95 only until the total size of shared library symbols exceeds this.*
96 threshold in megabytes. Is ignored when using .sharedlibrary.*$gdb_prompt $"\
97 {pass "help set auto-solib-limit"}
99 {fail "help set auto-solib-limit"}
100 timeout {fail "(timeout) help set auto-solib-limit"}
103 # On HP-UX, the threshhold is by default set to 50, which means
106 send_gdb "show auto-solib-limit\n"
108 -re "Threshold .in Mb. for autoloading shared library symbols is $decimal.*$gdb_prompt $"\
109 {pass "show auto-solib-limit "}
111 {fail "show auto-solib-limit "}
112 timeout {fail "(timeout) show auto-solib-limit "}
115 send_gdb "set auto-solib-limit 1\n"
117 -re ".*$gdb_prompt $"
118 {pass "set auto-solib-limit to 1"}
119 -re ".*$gdb_prompt $"
120 {fail "set auto-solib-limit to 1"}
121 timeout {fail "(timeout) set auto-solib-limit to 1"}
125 # We have manually verified that our testcase exceeds 1 Mbytes
126 # of heap space in GDB to hold the symbols for the main program
127 # and all associated linked-against libraries. Thus, when we
128 # run to the program's main, and therefore notice all the linked-
129 # against shlibs, we expect to hit the threshhold.
131 # (Note that we're not using the expect [runto main] function here,
132 # 'cause we want to match on output from the run command.
134 send_gdb "break main\n"
136 -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
137 {pass "1 set break at main"}
139 {fail "1 set break at main"}
140 timeout {fail "(timeout) 1 set break at main"}
145 -re ".*warning. Symbols for some libraries have not been loaded, because.*
146 doing so would exceed the size threshold specified by auto-solib-limit.*
147 To manually load symbols, use the 'sharedlibrary' command.*
148 To raise the threshold, set auto-solib-limit to a larger value and rerun.*
149 the program.*$gdb_prompt $"\
150 {pass "run to main hit auto-solib-limit threshold"}
152 {fail "run to main hit auto-solib-limit threshold"}
153 timeout {fail "(timeout) run to main hit auto-solib-limit threshold"}
156 # Verify that "info share" mentions something about libraries whose
157 # symbols weren't loaded.
159 # We'll assume that at least the last two shlib's symbols weren't
160 # loaded. As a side-effect of matching this pattern, the text start
161 # address of the last one is captured in expect_out(1,string).
162 # (we'll need it for the 'add-symbol-file' command in a nonce...)
164 send_gdb "info sharedlibrary\n"
166 -re ".*lib01_$testfile.sl .*symbols not loaded.*0x\[0-9\]* (0x\[0-9a-fA-F\]*).*$gdb_prompt $"\
167 { send_gdb "add-symbol-file lib02_$testfile.sl $expect_out(1,string)\n"
169 -re "add symbol table.*y or n.*$"\
172 -re "$gdb_prompt $" {pass "add-symbol-file and info sharedlib"}
173 timeout {fail "(timeout) add-symbol-file and info sharedlib"}
176 {fail "add-symbol-file and info sharedlib"}
177 timeout {fail "(timeout) add-symbol-file and info sharedlib"}
180 -re "$gdb_prompt $" {
181 setup_xfail hppa*-*-* CHFts24108
182 fail "info sharedlibrary shows shlibs with unloaded symbols"
184 timeout {fail "(timeout) info sharedlibrary shows shlibs with unloaded symbols"}
187 # Verify that we can manually load the symbol table of a library
188 # whose symbols weren't loaded. (We'll pick the last one.)
191 # I moved this test inside the one above, because the expect_out array is not ok if the
192 # previous test has failed, and expect would error out (elz)
194 #send_gdb "add-symbol-file lib02_$testfile.sl $expect_out(1,string)\n"
196 # -re "add symbol table.*y or n.*$"\
199 # -re "$gdb_prompt $" {pass "add-symbol-file"}
200 # timeout {fail "(timeout) add-symbol-file"}
202 # -re "$gdb_prompt $"\
203 # {fail "add-symbol-file"}
204 # timeout {fail "(timeout) add-symbol-file"}
207 # Verify that we can manually load the symbols for all libraries
208 # which weren't already loaded.
210 # Warning! On a machine with little free swap space, this may
213 send_gdb "sharedlibrary\n"
215 -re "Reading symbols from.*done.*$gdb_prompt $"\
216 {pass "sharedlibrary"}
217 -re "$gdb_prompt $" {
218 setup_xfail hppa*-*-* CHFts24108
221 timeout {fail "(timeout) sharedlibrary"}
224 # Rerun the program, this time verifying that we can set the
225 # threshhold high enough to avoid hitting it.
227 # It appears that gdb isn't freeing memory when rerunning, as one
228 # would expect. To avoid potentially hitting a virtual memory
229 # ceiling, start with a fresh gdb.
233 gdb_reinitialize_dir $srcdir/$subdir
236 send_gdb "break main\n"
238 -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
239 {pass "2 set break at main"}
241 {fail "2 set break at main"}
242 timeout {fail "(timeout) 2 set break at main"}
245 send_gdb "set auto-solib-limit 9999\n"
248 {pass "set auto-solib-limit threshold to practical infinity"}
249 timeout {fail "(timeout) set auto-solib-limit threshold to practical infinity"}
253 -re ".*warning. Symbols for some libraries have not been loaded, because.*
254 doing so would exceed the size threshold specified by auto-solib-limit.*
255 To manually load symbols, use the 'sharedlibrary' command.*
256 To raise the threshold, set auto-solib-limit to a larger value and rerun.*
257 the program.*$gdb_prompt $"\
258 {fail "rerun threshold at practical infinity (still hit threshold)"}
260 {pass "rerun with threshold at practical infinity"}
261 timeout {fail "(timeout) rerun with threshold at practical infinity"}
264 # Rerun the program, this time altogether disabling the auto loading
265 # feature. There should be no information at all about shared
268 # ??rehrauer: Personally, I'd call that a bug, since it doesn't give
269 # you the ability to manually load single shlibs (you need the text
270 # start address that 'info share' normall gives you). On the other
271 # hand, one can easily choose to load them all...
273 # It appears that gdb isn't freeing memory when rerunning, as one
274 # would expect. To avoid potentially hitting a virtual memory
275 # ceiling, start with a fresh gdb.
279 gdb_reinitialize_dir $srcdir/$subdir
282 send_gdb "break main\n"
284 -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
285 {pass "3 set break at main"}
287 {fail "3 set break at main"}
288 timeout {fail "(timeout) 3 set break at main"}
291 send_gdb "set auto-solib-limit 0\n"
294 {pass "set auto-solib-limit threshold to 0"}
295 timeout {fail "(timeout) set auto-solib-limit threshold to 0"}
299 -re ".*warning. Symbols for some libraries have not been loaded, because.*
300 doing so would exceed the size threshold specified by auto-solib-limit.*
301 To manually load symbols, use the 'sharedlibrary' command.*
302 To raise the threshold, set auto-solib-limit to a larger value and rerun.*
303 the program.*$gdb_prompt $"\
304 {fail "rerun threshold at 0 (still hit threshold)"}
306 {pass "rerun with threshold at 0"}
307 timeout {fail "(timeout) rerun with threshold at 0"}
310 # Verify that we can still manually load symbols for all libraries.
311 # (We'll assume that if the last shlib's symbols are loaded, that
314 # Note that we set the GDB "height" variable to prevent GDB from
317 # Warning! On a machine with little free swap space, this may
320 send_gdb "set height 9999\n"
323 {pass "set screen page height to practical infinity"}
324 timeout {fail "(timeout) set screen page height to practical infinity"}
326 send_gdb "sharedlibrary\n"
328 -re ".*Reading symbols from .*/lib02-so-thresh\\.sl\\.\\.\\.done\\..*$gdb_prompt $"\
329 {pass "manually load all symbols"}
330 -re "$gdb_prompt $" {
331 setup_xfail hppa*-*-* CHFts24108
332 fail "manually load all symbols (CHFts24108)"
334 timeout {fail "(timeout) manually load all symbols"}