Move 2006 ChangeLog entries to ChangeLog-2006.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / unload.exp
CommitLineData
5ea106f7 1# Copyright 2003, 2004, 2005
37fdf854
JJ
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 2 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, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18# This file was created by Jeff Johnston. (jjohnstn@redhat.com)
37fdf854
JJ
19
20if $tracelevel then {
21 strace $tracelevel
22}
23
24#
25# test running programs
26#
27set prms_id 0
28set bug_id 0
29
30# are we on a target board?
31if ![isnative] then {
32 return 0
33}
34
35set testfile "unload"
36set libfile "unloadshr"
37set libsrcfile ${libfile}.c
5ea106f7
PG
38set srcfile $srcdir/$subdir/$testfile.c
39set binfile $objdir/$subdir/$testfile
37fdf854 40set shlibdir ${objdir}/${subdir}
5ea106f7
PG
41set libsrc $srcdir/$subdir/$libfile.c
42set lib_sl $objdir/$subdir/$libfile.sl
37fdf854
JJ
43
44set dl_lib_flag ""
45switch -glob [istarget] {
46 "hppa*-hp-hpux*" { }
47 "*-*-linux*" { set dl_lib_flag "libs=-ldl" }
9cbe82da 48 "*-*-solaris*" { set dl_lib_flag "libs=-ldl" }
37fdf854
JJ
49 default { }
50}
51
5ea106f7
PG
52set lib_opts debug
53set exec_opts [list debug $dl_lib_flag additional_flags=-DSHLIB_DIR\=\"${shlibdir}\"]
37fdf854 54
5ea106f7
PG
55if [get_compiler_info ${binfile}] {
56 return -1
37fdf854
JJ
57}
58
5ea106f7
PG
59if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
60 || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
61 untested "Couldn't compile $libsrc or $srcfile."
62 return -1
37fdf854
JJ
63}
64
5ea106f7 65# Start with a fresh gdb.
37fdf854
JJ
66
67gdb_exit
68gdb_start
69gdb_reinitialize_dir $srcdir/$subdir
70gdb_load ${binfile}
71
72if [target_info exists gdb_stub] {
73 gdb_step_for_stub;
74}
75
76#
77# Test setting a breakpoint in a dynamically loaded library which is
78# manually loaded and unloaded
79#
80
81gdb_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"
84 }
85}
86
87gdb_test "info break" \
88 "Num Type\[ \]+Disp Enb Address\[ \]+What.*
89\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*shrfunc1.*" \
90"single pending breakpoint info"
91
0107feed 92set unloadshr_line [gdb_get_line_number "unloadshr break" ${libsrcfile}]
37fdf854
JJ
93
94gdb_test "run" \
95"Starting program.*unload.*
96Breakpoint.*at.*
97Pending breakpoint \"shrfunc1\" resolved.*
98Breakpoint.*, shrfunc1 \\\(x=3\\\).*unloadshr.c:$unloadshr_line.*" \
99"running program"
100
101gdb_test "continue" \
edd9b715 102"Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
37fdf854
JJ
103"continuing to end of program"
104
105#
106# Try to rerun program and verify that shared breakpoint is reset properly
107#
108
109gdb_test "run" \
110".*Breakpoint.*shrfunc1.*at.*unloadshr.c:$unloadshr_line.*" \
111"rerun to shared library breakpoint"
112
113gdb_test "continue" \
edd9b715 114"Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
1236e623 115"continuing to end of program second time"
edd9b715 116
This page took 0.234059 seconds and 4 git commands to generate.