1 # Copyright (C) 1997, 1998 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
27 if { [skip_hp_tests] } then { continue }
29 set testfile "so-thresh"
30 set binfile ${objdir}/${subdir}/${testfile}
32 if [get_compiler_info ${binfile}] {
36 # This testcase is relatively large, and therefore can take awhile to
37 # load. We'd best set the timeout to something suitable, or we may
42 # Build procedure for this testcase:
43 # ${srcdir}/${subdir}/so-thresh.sh ${subdir}
45 # make -f ${srcdir}/${subdir}/so-thresh.mk <targets> <macros>
47 # genso-thresh (from genso-thresh.c)
52 # so-thresh.lopt (link options file)
53 # lib0*-so-thresh.sl (from .c files above)
54 # so-thresh (from so-thresh.c)
55 # using lib0*-so-thresh.sl and so-thresh.lopt
57 # Since so-thresh.mk requires SRCDIR and OBJDIR macro definitions,
58 # and SRCDIR / OBJDIR could be in relative path format, we use
59 # so-thresh.sh script to pin down SRCDIR / OBJDIR (using $PWD/ prefix
60 # when detected relative path values for srcdir / objdir), before the
61 # 'cd $subdir' call (when this can be done in TCL here, we can call
62 # make directly instead).
64 # 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}\\\""
66 send_user "Making with '${srcdir}/${subdir}/${testfile}.sh $subdir ...\n"
67 remote_exec build "${srcdir}/${subdir}/${testfile}.sh $subdir"
69 # Only HP-UX (and any other platforms using SOM shared libraries, I
70 # guess) interprets the auto-solib-add variable as a threshhold,
71 # rather than a boolean that strictly enables or disables automatic
72 # loading of shlib symbol tables.
74 # On HP-UX, it is the size threshhold (in megabytes) at which to
75 # stop auto loading of symbol tables.
77 if ![istarget "hppa*-hp-hpux*"] then {
81 # Start with a fresh gdb
85 gdb_reinitialize_dir $srcdir/$subdir
88 # This is a test of gdb's ability on HP-UX to stop automatically
89 # loading symbols of shared libraries, when the total size of the
90 # debugger's symbol table reaches a specified threshhold.
93 # On HP-UX, the help text for auto-solib-add mentions that it
94 # serves as a threshhold.
96 send_gdb "help set auto-solib-add\n"
98 -re "Set autoloading size threshold .in megabytes. of shared library symbols.*
99 If nonzero, symbols from all shared object libraries will be loaded.*
100 automatically when the inferior begins execution or when the dynamic linker.*
101 informs gdb that a new library has been loaded, until the symbol table.*
102 of the program and libraries exceeds this threshold.*
103 Otherwise, symbols must be loaded manually, using `sharedlibrary'.*$gdb_prompt $"\
104 {pass "help set auto-solib-add"}
106 {fail "help set auto-solib-add"}
107 timeout {fail "(timeout) help set auto-solib-add"}
110 # On HP-UX, the threshhold is by default set to 50, which means
113 send_gdb "show auto-solib-add\n"
115 -re "Autoloading size threshold .in megabytes. of shared library symbols is $decimal.*$gdb_prompt $"\
116 {pass "show auto-solib-add "}
117 -re "Autoloading size threshold \(in megabytes\) of shared library symbols is $decimal.$gdb_prompt $"\
118 {pass "show auto-solib-add "}
120 {fail "show auto-solib-add "}
121 timeout {fail "(timeout) show auto-solib-add "}
124 send_gdb "set auto-solib-add 1\n"
126 -re ".*$gdb_prompt $"
127 {pass "set auto-solib-add to 1"}
128 -re ".*$gdb_prompt $"
129 {fail "set auto-solib-add to 1"}
130 timeout {fail "(timeout) set auto-solib-add to 1"}
134 # We have manually verified that our testcase exceeds 1 Mbytes
135 # of heap space in GDB to hold the symbols for the main program
136 # and all associated linked-against libraries. Thus, when we
137 # run to the program's main, and therefore notice all the linked-
138 # against shlibs, we expect to hit the threshhold.
140 # (Note that we're not using the expect [runto main] function here,
141 # 'cause we want to match on output from the run command.
143 send_gdb "break main\n"
145 -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
146 {pass "1 set break at main"}
148 {fail "1 set break at main"}
149 timeout {fail "(timeout) 1 set break at main"}
154 -re ".*warning. Symbols for some libraries have not been loaded, because.*
155 doing so would exceed the size threshold specified by auto-solib-add.*
156 To manually load symbols, use the 'sharedlibrary' command.*
157 To raise the threshold, set auto-solib-add to a larger value and rerun.*
158 the program.*$gdb_prompt $"\
159 {pass "run to main hit auto-solib-add threshold"}
161 {fail "run to main hit auto-solib-add threshold"}
162 timeout {fail "(timeout) run to main hit auto-solib-add threshold"}
165 # Verify that "info share" mentions something about libraries whose
166 # symbols weren't loaded.
168 # We'll assume that at least the last two shlib's symbols weren't
169 # loaded. As a side-effect of matching this pattern, the text start
170 # address of the last one is captured in expect_out(1,string).
171 # (we'll need it for the 'add-symbol-file' command in a nonce...)
173 send_gdb "info sharedlibrary\n"
175 -re ".*lib01_$testfile.sl .*symbols not loaded.*0x\[0-9\]* (0x\[0-9a-fA-F\]*).*$gdb_prompt $"\
176 { send_gdb "add-symbol-file lib02_$testfile.sl $expect_out(1,string)\n"
178 -re "add symbol table.*y or n.*$"\
181 -re "$gdb_prompt $" {pass "add-symbol-file and info sharedlib"}
182 timeout {fail "(timeout) add-symbol-file and info sharedlib"}
185 {fail "add-symbol-file and info sharedlib"}
186 timeout {fail "(timeout) add-symbol-file and info sharedlib"}
189 -re "$gdb_prompt $" {
190 setup_xfail hppa*-*-* CHFts24108
191 fail "info sharedlibrary shows shlibs with unloaded symbols"
193 timeout {fail "(timeout) info sharedlibrary shows shlibs with unloaded symbols"}
196 # Verify that we can manually load the symbol table of a library
197 # whose symbols weren't loaded. (We'll pick the last one.)
200 # I moved this test inside the one above, because the expect_out array is not ok if the
201 # previous test has failed, and expect would error out (elz)
203 #send_gdb "add-symbol-file lib02_$testfile.sl $expect_out(1,string)\n"
205 # -re "add symbol table.*y or n.*$"\
208 # -re "$gdb_prompt $" {pass "add-symbol-file"}
209 # timeout {fail "(timeout) add-symbol-file"}
211 # -re "$gdb_prompt $"\
212 # {fail "add-symbol-file"}
213 # timeout {fail "(timeout) add-symbol-file"}
216 # Verify that we can manually load the symbols for all libraries
217 # which weren't already loaded.
219 # Warning! On a machine with little free swap space, this may
222 send_gdb "sharedlibrary\n"
224 -re "Reading symbols from.*done.*$gdb_prompt $"\
225 {pass "sharedlibrary"}
226 -re "$gdb_prompt $" {
227 setup_xfail hppa*-*-* CHFts24108
230 timeout {fail "(timeout) sharedlibrary"}
233 # Rerun the program, this time verifying that we can set the
234 # threshhold high enough to avoid hitting it.
236 # It appears that gdb isn't freeing memory when rerunning, as one
237 # would expect. To avoid potentially hitting a virtual memory
238 # ceiling, start with a fresh gdb.
242 gdb_reinitialize_dir $srcdir/$subdir
245 send_gdb "break main\n"
247 -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
248 {pass "2 set break at main"}
250 {fail "2 set break at main"}
251 timeout {fail "(timeout) 2 set break at main"}
254 send_gdb "set auto-solib-add 9999\n"
257 {pass "set auto-solib-add threshold to practical infinity"}
258 timeout {fail "(timeout) set auto-solib-add threshold to practical infinity"}
262 -re ".*warning. Symbols for some libraries have not been loaded, because.*
263 doing so would exceed the size threshold specified by auto-solib-add.*
264 To manually load symbols, use the 'sharedlibrary' command.*
265 To raise the threshold, set auto-solib-add to a larger value and rerun.*
266 the program.*$gdb_prompt $"\
267 {fail "rerun threshold at practical infinity (still hit threshold)"}
269 {pass "rerun with threshold at practical infinity"}
270 timeout {fail "(timeout) rerun with threshold at practical infinity"}
273 # Rerun the program, this time altogether disabling the auto loading
274 # feature. There should be no information at all about shared
277 # ??rehrauer: Personally, I'd call that a bug, since it doesn't give
278 # you the ability to manually load single shlibs (you need the text
279 # start address that 'info share' normall gives you). On the other
280 # hand, one can easily choose to load them all...
282 # It appears that gdb isn't freeing memory when rerunning, as one
283 # would expect. To avoid potentially hitting a virtual memory
284 # ceiling, start with a fresh gdb.
288 gdb_reinitialize_dir $srcdir/$subdir
291 send_gdb "break main\n"
293 -re "Breakpoint \[0-9\]* at.*$gdb_prompt $"\
294 {pass "3 set break at main"}
296 {fail "3 set break at main"}
297 timeout {fail "(timeout) 3 set break at main"}
300 send_gdb "set auto-solib-add 0\n"
303 {pass "set auto-solib-add threshold to 0"}
304 timeout {fail "(timeout) set auto-solib-add threshold to 0"}
308 -re ".*warning. Symbols for some libraries have not been loaded, because.*
309 doing so would exceed the size threshold specified by auto-solib-add.*
310 To manually load symbols, use the 'sharedlibrary' command.*
311 To raise the threshold, set auto-solib-add to a larger value and rerun.*
312 the program.*$gdb_prompt $"\
313 {fail "rerun threshold at 0 (still hit threshold)"}
315 {pass "rerun with threshold at 0"}
316 timeout {fail "(timeout) rerun with threshold at 0"}
319 # Verify that we can still manually load symbols for all libraries.
320 # (We'll assume that if the last shlib's symbols are loaded, that
323 # Note that we set the GDB "height" variable to prevent GDB from
326 # Warning! On a machine with little free swap space, this may
329 send_gdb "set height 9999\n"
332 {pass "set screen page height to practical infinity"}
333 timeout {fail "(timeout) set screen page height to practical infinity"}
335 send_gdb "sharedlibrary\n"
337 -re ".*Reading symbols from .*/lib02-so-thresh\\.sl\\.\\.\\.done\\..*$gdb_prompt $"\
338 {pass "manually load all symbols"}
339 -re "$gdb_prompt $" {
340 setup_xfail hppa*-*-* CHFts24108
341 fail "manually load all symbols (CHFts24108)"
343 timeout {fail "(timeout) manually load all symbols"}