1 # Copyright
(C
) 1997 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 # This file was written by srikanth
(with huge chunks borrowed from old ones
)
23 # o catch
load command does not stop
for implicit loads.
27 # o sharedlibrary command ignores its
argument and ends
28 # up loading
every shared library there is ...
32 # o
info line non
-existent
-function dumps core
33 # o clear non
-existent function dumps core
34 # o xbreak non
-existent
-function dumps core
38 # o gdb prints static and extern variables in shlibs incorrectly.
42 # o deferred breakpoints should kick in
for shlibs loaded explicitly
43 # with the sharedlibrary command.
44 # o GDB confuses
export stubs with actual function.
52 if { [skip_hp_tests
] } { continue }
57 # are we
on a target board
62 # This test is presently only valid
on HP
-UX
, since it requires
63 # that we use HP
-UX
-specific compiler
& linker options to build
67 clear_xfail
"hppa*-*-*hpux*"
70 set testfile
"solib-d"
71 set srcfile $
{testfile
}.c
72 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
73 set testfile1 $
{objdir
}/$
{subdir
}/$
{testfile
}1.o
74 set testfile2 $
{objdir
}/$
{subdir
}/$
{testfile
}2.o
75 set libfile1 $
{objdir
}/$
{subdir
}/$
{testfile
}1.sl
76 set libfile2 $
{objdir
}/$
{subdir
}/$
{testfile
}2.sl
78 # Create and source the file that provides information about the compiler
79 # used to
compile the test case.
80 if [get_compiler_info $
{binfile
}] {
84 #
set up appropriate
compile option to recognize long double
85 if {$hp_aCC_compiler || $hp_cc_compiler
} {
94 # Build the shared libraries this test case needs.
98 if { [gdb_compile
"${srcdir}/${subdir}/${testfile}1.c" "${testfile1}" object "{debug additional_flags=${picflag}}"] != "" } {
99 perror
"Couldn't compile ${testfile}1.c"
103 if { [gdb_compile
"${srcdir}/${subdir}/${testfile}2.c" "${testfile2}" object "{debug additional_flags=${picflag}}"] != ""} {
104 perror
"Couldn't compile ${testfile}2.c"
108 remote_exec build
"ld -b ${testfile1} -o ${libfile1}"
109 remote_exec build
"ld -b ${testfile2} -o ${libfile2}"
111 # Build the test case
113 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile} ${libfile1} ${libfile2}" "${binfile}" executable "{debug additional_flags=${ansiflag} -Wl,-aarchive}"] != "" } {
114 perror
"Couldn't build ${binfile}"
118 # Start with a fresh gdb
122 gdb_reinitialize_dir $srcdir
/$subdir
125 # Verify that we can
set a generic catchpoint
on shlib loads. I.e.
, that
126 # we can catch
any shlib
load, without specifying the
name.
128 gdb_test
"catch load" "Catchpoint \[0-9\]* .load <any library>.*" \
129 "set generic catch load"
131 # Verify that implicit shlib loads are caught and reported.
134 -re
".*solib-d1.*$gdb_prompt $" {
135 pass
"Catch implicit load at startup"
137 -re
"Program exited.*$gdb_prompt $" {
138 fail
"CLLbs14756 || CLLbs16090 came back ???"
140 timeout
{ fail
"(timeout) implicit library load" }
145 gdb_reinitialize_dir $srcdir
/$subdir
148 if ![runto_main
] { fail
"breakpoint at main did not trigger ?" }
150 # verify that we print globals from shlibs correctly.
151 gdb_test
"p global_from_primary" " = 5678" \
152 "print global from shlib (CLLbs15725)"
154 gdb_test
"p global_from_secondary" " = 9012" \
155 "print global from shlib (CLLbs15725)"
157 # verify that we print static variables from shlibs correctly.
158 if { ![runto function_from_primary
] } { return }
159 gdb_test
"p file_static" " = 1234" "print file static variable (CLLbs15725)"
161 if { ![runto function_from_secondary
] } { return }
162 gdb_test
"p local_static" " = 3456" "print local static variable (CLLbs15725)"
166 gdb_reinitialize_dir $srcdir
/$subdir
169 gdb_test
"set auto-solib-add 0" "" "turn off auto shlib debug loading"
172 perror
"C function calling tests suppressed"
175 # verify that
"clear non-existent-symbol" does not crash
176 gdb_test
"clear junkfunc" "Location not found.*" \
177 "clear non-existent function does not dump core !"
179 # verify that
"info line non-existent-symbol" does not crash
180 gdb_test
"info line junkfunc" "Location not found.*" \
181 "info line junkfunc does not dump core !"
183 # verify that
"xbreak non-existent-symbol" does not crash
184 gdb_test
"xbreak junkfunc" "Function \"junkfunc\" not defined.*" \
185 "xbreak junkfunc does not dump core !"
187 gdb_test
"list function_from_primary" \
188 "No line number known for function_from_primary.*" \
189 "turning off auto shlib debug loading"
191 send_gdb
"sharedlibrary solib-d1\n"
193 -re
"Reading symbols from.*solib-d1.*$gdb_prompt $" {
194 pass
"loading primary library on demand (1)"
196 -re
"--Adding symbols for shared library.*solib-d1.*$gdb_prompt $" {
197 pass
"loading primary library on demand (2)"
199 -re
"$gdb_prompt $" { fail "loading primary library on demand (3)" }
200 timeout
{ fail
"(timeout) loading primary library on demand" }
203 # make sure that
load above of primary also did not pull in secondary.
204 send_gdb
"list function_from_secondary\n"
206 -re
"No symbol.*context.*$gdb_prompt $" {
207 pass
"loaded only what we needed (1)"
209 -re
"No line number known for function_from_secondary.*$gdb_prompt $" {
210 pass
"loaded only what we needed (2)"
212 -re
".*9012.*$gdb_prompt $" { fail "Oops ! CLLbs15382 came back ?" }
213 timeout
{ fail
"(timeout) printing global" }
218 gdb_reinitialize_dir $srcdir
/$subdir
221 gdb_test
"set auto-solib-add 0" "" "turn off auto shlib debug loading"
223 gdb_test
"set stop-on-solib-event 1" "" "stop-on-solib-event"
225 # verify that we
set breakpoint
on the function and not the
export stub
226 # used to be that we
set bp
on the
export stub of _start and thus miss
227 # shlib loads in some cases
(where the stub
exists)
230 -re
"Stopped due to shared library event.*$gdb_prompt $" {
231 pass
"stop for shlib event"
233 -re
"Program exited.*$gdb_prompt $" {
234 fail
"Bug CLLbs16090 came back ?"
236 timeout
{ fail
"(timeout) stop for shlib event " }
239 gdb_test
"b main" "Breakpoint 1 at.*" "set breakpoint on main"
241 gdb_test
"set stop-on-solib-event 0" "" "stop-on-solib-event (timeout)"
243 # verify that we
set breakpoint
on the function and not the
export stub
244 gdb_test
"cont" "Breakpoint 1.*main.*" "run to main"
246 #
On PA64 we read in the unwind
info and linker symbol table which lets
247 # us
set the breakpoint and not defer it.
248 send_gdb
"b garbage\n"
250 -re
"Breakpoint.*deferred.*garbage.*library containing.*is loaded.*$gdb_prompt $" {
251 pass
" set deferred breakpoint (1)"
253 -re
"Breakpoint 2 at 0x.*$gdb_prompt $" {
254 pass
" set deferred breakpoint (2)"
256 -re
"$gdb_prompt $" { fail " set deferred breakpoint (3)" }
257 timeout
{ fail
"(timeout) set deferred breakpoint" }
260 # make sure that the sharedlibrary command enables
any deferred breakpoints
262 send_gdb
"sharedlibrary lib\n"
264 -re
"Reading.*solib-d1.*$gdb_prompt $" {
265 pass
"load up all shared libs (1)"
267 -re
"Loading.*dld.sl.*--Adding symbols.*solib-d1.*$gdb_prompt $" {
268 pass
"load up all shared libs (2)"
270 -re
"$gdb_prompt $" { fail "load up all libraries" }
271 timeout
{ fail
"(timeout) load all libraries " }
274 #
do we stop at garbage ?
If yes ok.
275 gdb_test
"cont" "Breakpoint.*garbage.*" "deferred breakpoint enabled"