]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/so-impl-ld.exp
Copyright updates for 2007.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / so-impl-ld.exp
CommitLineData
6aba47ca 1# Copyright 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007
bf7234cf 2# Free Software Foundation, Inc.
c906108c
SS
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
bf7234cf 16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
c906108c
SS
17
18if $tracelevel then {
19 strace $tracelevel
20 }
21
22set prms_id 0
23set bug_id 0
24
25# are we on a target board
26if ![isnative] then {
27 return
28}
29
c906108c 30set testfile "so-impl-ld"
bf7234cf
PG
31set libfile "solib1"
32set srcfile $srcdir/$subdir/$testfile.c
33set libsrc $srcdir/$subdir/$libfile.c
34set binfile $objdir/$subdir/$testfile
35set lib_sl $objdir/$subdir/$libfile.sl
36
37set lib_opts debug
38set exec_opts [list debug shlib=$lib_sl]
c906108c
SS
39
40if [get_compiler_info ${binfile}] {
41 return -1
42}
43
bf7234cf 44if [get_compiler_info ${binfile}] {
c906108c
SS
45 return -1
46}
47
bf7234cf
PG
48if [test_compiler_info "hpcc-*"] {
49 lappend exec_opts "additional_flags=-Ae"
c906108c
SS
50}
51
bf7234cf
PG
52if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
53 || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
54 untested "Couldn't compile $libsrc or $srcfile."
c906108c
SS
55 return -1
56}
c906108c
SS
57
58# Start with a fresh gdb
59
60gdb_exit
61gdb_start
62gdb_reinitialize_dir $srcdir/$subdir
63gdb_load ${binfile}
64
65# This program implicitly loads SOM shared libraries.
66#
67if ![runto_main] then { fail "implicit solibs tests suppressed" }
68
69# Verify that we can step over the first shlib call.
70#
71send_gdb "next\n"
72gdb_expect {
085dd6e6 73 -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\
c906108c
SS
74 {pass "step over solib call"}
75 -re "$gdb_prompt $"\
76 {fail "step over solib call"}
77 timeout {fail "(timeout) step over solib call"}
78}
79
80# Verify that we can step into the second shlib call.
81#
82send_gdb "step\n"
83gdb_expect {
bf7234cf 84 -re "solib_main .arg=10000. at.*${libfile}.c:17.*$gdb_prompt $"\
c906108c
SS
85 {pass "step into solib call"}
86 -re "$gdb_prompt $"\
87 {fail "step into solib call"}
88 timeout {fail "(timeout) step into solib call"}
89}
90
91# Verify that we can step within the shlib call.
92#
93send_gdb "next\n"
94gdb_expect {
085dd6e6 95 -re "18\[ \t\]*\}.*$gdb_prompt $"\
c906108c
SS
96 {pass "step in solib call"}
97 -re "$gdb_prompt $"\
98 {fail "step in solib call"}
99 timeout {fail "(timeout) step in solib call"}
100}
101
102# Verify that we can step out of the shlib call, and back out into
103# the caller.
104#
105send_gdb "next\n"
106gdb_expect {
107 -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" {
108 # we haven't left the callee yet, so do another next
109 send_gdb "next\n"
110 gdb_expect {
085dd6e6 111 -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
c906108c
SS
112 {pass "step out of solib call"}
113 -re "$gdb_prompt $"\
114 {fail "step out of solib call"}
115 timeout {fail "(timeout) step out of solib call"}
116 }
117 }
118
085dd6e6 119 -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
c906108c
SS
120 {pass "step out of solib call"}
121 -re "$gdb_prompt $"\
122 {fail "step out of solib call"}
123 timeout {fail "(timeout) step out of solib call"}
124}
125
126gdb_exit
127return 0
0d06e24b
JM
128
129
130
131
132
133