Commit | Line | Data |
---|---|---|
c906108c SS |
1 | # Copyright (C) 1997, 1998 Free Software Foundation, Inc. |
2 | ||
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. | |
7 | # | |
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. | |
12 | # | |
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. */ | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | if $tracelevel then { | |
21 | strace $tracelevel | |
22 | } | |
23 | ||
24 | set prms_id 0 | |
25 | set bug_id 0 | |
26 | ||
27 | # are we on a target board | |
28 | if ![isnative] then { | |
29 | return | |
30 | } | |
31 | ||
32 | # This test is presently only valid on HP-UX, since it requires | |
33 | # that we use HP-UX-specific compiler & linker options to build | |
34 | # the testcase. | |
35 | # | |
36 | setup_xfail "*-*-*" | |
37 | clear_xfail "hppa*-*-*hpux*" | |
38 | ||
39 | set libfile "solib" | |
40 | set testfile "so-impl-ld" | |
41 | set srcfile ${testfile}.c | |
42 | set binfile ${objdir}/${subdir}/${testfile} | |
43 | ||
44 | if [get_compiler_info ${binfile}] { | |
45 | return -1 | |
46 | } | |
47 | ||
48 | # Build the shared libraries this test case needs. | |
49 | # | |
50 | #cd ${subdir} | |
51 | #remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o" | |
52 | ||
53 | ||
54 | if {$gcc_compiled == 0} { | |
55 | if [istarget "hppa*-hp-hpux*"] then { | |
56 | set additional_flags "additional_flags=+z" | |
57 | } else { | |
58 | # don't know that the compiler is, hope for the best... | |
59 | set additional_flags "" | |
60 | } | |
61 | } else { | |
62 | set additional_flags "additional_flags=-fpic" | |
63 | } | |
64 | ||
65 | if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${libfile}1.o" object [list debug $additional_flags]] != ""} { | |
66 | perror "Couldn't compile ${libfile}1.c" | |
67 | return -1 | |
68 | } | |
69 | ||
70 | if [istarget "hppa*-hp-hpux*"] then { | |
085dd6e6 | 71 | remote_exec build "ld -b ${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl" |
c906108c SS |
72 | } else { |
73 | set additional_flags "additional_flags=-shared" | |
085dd6e6 | 74 | gdb_compile "${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags] |
c906108c SS |
75 | } |
76 | ||
77 | # Build the test case | |
78 | #remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}" | |
79 | ||
80 | ||
085dd6e6 JM |
81 | if {$hp_cc_compiler} { |
82 | set additional_flags "additional_flags=-Ae" | |
c906108c SS |
83 | } else { |
84 | set additional_flags "" | |
85 | } | |
86 | ||
085dd6e6 | 87 | if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { |
c906108c SS |
88 | perror "Couldn't build ${binfile}" |
89 | return -1 | |
90 | } | |
91 | #cd .. | |
92 | ||
93 | # Start with a fresh gdb | |
94 | ||
95 | gdb_exit | |
96 | gdb_start | |
97 | gdb_reinitialize_dir $srcdir/$subdir | |
98 | gdb_load ${binfile} | |
99 | ||
100 | # This program implicitly loads SOM shared libraries. | |
101 | # | |
102 | if ![runto_main] then { fail "implicit solibs tests suppressed" } | |
103 | ||
104 | # Verify that we can step over the first shlib call. | |
105 | # | |
106 | send_gdb "next\n" | |
107 | gdb_expect { | |
085dd6e6 | 108 | -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\ |
c906108c SS |
109 | {pass "step over solib call"} |
110 | -re "$gdb_prompt $"\ | |
111 | {fail "step over solib call"} | |
112 | timeout {fail "(timeout) step over solib call"} | |
113 | } | |
114 | ||
115 | # Verify that we can step into the second shlib call. | |
116 | # | |
117 | send_gdb "step\n" | |
118 | gdb_expect { | |
085dd6e6 | 119 | -re "solib_main .arg=10000. at.*${libfile}1.c:17.*$gdb_prompt $"\ |
c906108c SS |
120 | {pass "step into solib call"} |
121 | -re "$gdb_prompt $"\ | |
122 | {fail "step into solib call"} | |
123 | timeout {fail "(timeout) step into solib call"} | |
124 | } | |
125 | ||
126 | # Verify that we can step within the shlib call. | |
127 | # | |
128 | send_gdb "next\n" | |
129 | gdb_expect { | |
085dd6e6 | 130 | -re "18\[ \t\]*\}.*$gdb_prompt $"\ |
c906108c SS |
131 | {pass "step in solib call"} |
132 | -re "$gdb_prompt $"\ | |
133 | {fail "step in solib call"} | |
134 | timeout {fail "(timeout) step in solib call"} | |
135 | } | |
136 | ||
137 | # Verify that we can step out of the shlib call, and back out into | |
138 | # the caller. | |
139 | # | |
140 | send_gdb "next\n" | |
141 | gdb_expect { | |
142 | -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" { | |
143 | # we haven't left the callee yet, so do another next | |
144 | send_gdb "next\n" | |
145 | gdb_expect { | |
085dd6e6 | 146 | -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ |
c906108c SS |
147 | {pass "step out of solib call"} |
148 | -re "$gdb_prompt $"\ | |
149 | {fail "step out of solib call"} | |
150 | timeout {fail "(timeout) step out of solib call"} | |
151 | } | |
152 | } | |
153 | ||
085dd6e6 | 154 | -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ |
c906108c SS |
155 | {pass "step out of solib call"} |
156 | -re "$gdb_prompt $"\ | |
157 | {fail "step out of solib call"} | |
158 | timeout {fail "(timeout) step out of solib call"} | |
159 | } | |
160 | ||
161 | gdb_exit | |
162 | return 0 |