]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/so-impl-ld.exp
2005-04-29 Paul Gilliam <pgilliam@us.ibm.com>
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / so-impl-ld.exp
1 # Copyright 1997, 1998, 1999, 2000, 2001, 2003, 2005
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 if $tracelevel then {
19 strace $tracelevel
20 }
21
22 set prms_id 0
23 set bug_id 0
24
25 # are we on a target board
26 if ![isnative] then {
27 return
28 }
29
30 set testfile "so-impl-ld"
31 set libfile "solib1"
32 set srcfile $srcdir/$subdir/$testfile.c
33 set libsrc $srcdir/$subdir/$libfile.c
34 set binfile $objdir/$subdir/$testfile
35 set lib_sl $objdir/$subdir/$libfile.sl
36
37 set lib_opts debug
38 set exec_opts [list debug shlib=$lib_sl]
39
40 if [get_compiler_info ${binfile}] {
41 return -1
42 }
43
44 if [get_compiler_info ${binfile}] {
45 return -1
46 }
47
48 if [test_compiler_info "hpcc-*"] {
49 lappend exec_opts "additional_flags=-Ae"
50 }
51
52 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
53 || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
54 untested "Couldn't compile $libsrc or $srcfile."
55 return -1
56 }
57
58 # Start with a fresh gdb
59
60 gdb_exit
61 gdb_start
62 gdb_reinitialize_dir $srcdir/$subdir
63 gdb_load ${binfile}
64
65 # This program implicitly loads SOM shared libraries.
66 #
67 if ![runto_main] then { fail "implicit solibs tests suppressed" }
68
69 # Verify that we can step over the first shlib call.
70 #
71 send_gdb "next\n"
72 gdb_expect {
73 -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\
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 #
82 send_gdb "step\n"
83 gdb_expect {
84 -re "solib_main .arg=10000. at.*${libfile}.c:17.*$gdb_prompt $"\
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 #
93 send_gdb "next\n"
94 gdb_expect {
95 -re "18\[ \t\]*\}.*$gdb_prompt $"\
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 #
105 send_gdb "next\n"
106 gdb_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 {
111 -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
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
119 -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\
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
126 gdb_exit
127 return 0
128
129
130
131
132
133