1 # Copyright
2003, 2004, 2005
2 # Free Software Foundation
, Inc.
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
2 of the License
, or
7 #
(at your option
) any later version.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this
program; if not
, write to the Free Software
16 # Foundation
, Inc.
, 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA.
18 # This file was created by Jeff Johnston.
(jjohnstn@redhat.com
)
25 # test running programs
30 # are we
on a target board?
36 set libfile
"unloadshr"
37 set libsrcfile $
{libfile
}.c
38 set srcfile $srcdir
/$subdir
/$testfile.c
39 set binfile $objdir
/$subdir
/$testfile
40 set shlibdir $
{objdir
}/$
{subdir
}
41 set libsrc $srcdir
/$subdir
/$libfile.c
42 set lib_sl $objdir
/$subdir
/$libfile.sl
45 switch -glob
[istarget
] {
47 "*-*-linux*" { set dl_lib_flag "libs=-ldl" }
48 "*-*-solaris*" { set dl_lib_flag "libs=-ldl" }
53 set exec_opts
[list debug $dl_lib_flag additional_flags
=-DSHLIB_DIR\
=\"$
{shlibdir
}\"]
55 if [get_compiler_info $
{binfile
}] {
59 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts
] != ""
60 ||
[gdb_compile $srcfile $binfile executable $exec_opts
] != ""} {
61 untested
"Couldn't compile $libsrc or $srcfile."
65 # Start with a fresh gdb.
69 gdb_reinitialize_dir $srcdir
/$subdir
72 if [target_info
exists gdb_stub
] {
77 # Test setting a breakpoint in a dynamically loaded library which is
78 # manually loaded and unloaded
81 gdb_test_multiple
"break shrfunc1" "set pending breakpoint" {
82 -re
".*Make breakpoint pending.*y or \\\[n\\\]. $" {
83 gdb_test
"y" "Breakpoint.*shrfunc1.*pending." "set pending breakpoint"
87 gdb_test
"info break" \
88 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
89 \
[0-9\
]+\
[\t \
]+breakpoint keep y.
*PENDING.
*shrfunc1.
*" \
90 "single pending breakpoint info"
92 set unloadshr_line
[gdb_get_line_number
"unloadshr break" ${libsrcfile}]
95 "Starting program.*unload.*
97 Pending breakpoint
\"shrfunc1
\" resolved.
*
98 Breakpoint.
*, shrfunc1
\\\
(x
=3\\\
).
*unloadshr.c
:$unloadshr_line.
*" \
101 gdb_test
"continue" \
102 "Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
103 "continuing to end of program"
106 # Try to rerun
program and verify that shared breakpoint is reset properly
110 ".*Breakpoint.*shrfunc1.*at.*unloadshr.c:$unloadshr_line.*" \
111 "rerun to shared library breakpoint"
113 gdb_test
"continue" \
114 "Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
115 "continuing to end of program second time"