Commit | Line | Data |
---|---|---|
9b254dd1 | 1 | # Copyright 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007, 2008 |
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 | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
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. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c SS |
16 | |
17 | if $tracelevel then { | |
18 | strace $tracelevel | |
19 | } | |
20 | ||
21 | set prms_id 0 | |
22 | set bug_id 0 | |
23 | ||
93f02886 DJ |
24 | if {[skip_shlib_tests]} { |
25 | return 0 | |
c906108c SS |
26 | } |
27 | ||
c906108c | 28 | set testfile "so-impl-ld" |
bf7234cf PG |
29 | set libfile "solib1" |
30 | set srcfile $srcdir/$subdir/$testfile.c | |
31 | set libsrc $srcdir/$subdir/$libfile.c | |
32 | set binfile $objdir/$subdir/$testfile | |
33 | set lib_sl $objdir/$subdir/$libfile.sl | |
34 | ||
35 | set lib_opts debug | |
36 | set exec_opts [list debug shlib=$lib_sl] | |
c906108c SS |
37 | |
38 | if [get_compiler_info ${binfile}] { | |
39 | return -1 | |
40 | } | |
41 | ||
bf7234cf | 42 | if [get_compiler_info ${binfile}] { |
c906108c SS |
43 | return -1 |
44 | } | |
45 | ||
bf7234cf PG |
46 | if [test_compiler_info "hpcc-*"] { |
47 | lappend exec_opts "additional_flags=-Ae" | |
c906108c SS |
48 | } |
49 | ||
bf7234cf PG |
50 | if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != "" |
51 | || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} { | |
52 | untested "Couldn't compile $libsrc or $srcfile." | |
c906108c SS |
53 | return -1 |
54 | } | |
c906108c SS |
55 | |
56 | # Start with a fresh gdb | |
57 | ||
58 | gdb_exit | |
59 | gdb_start | |
60 | gdb_reinitialize_dir $srcdir/$subdir | |
61 | gdb_load ${binfile} | |
93f02886 | 62 | gdb_load_shlibs $lib_sl |
c906108c SS |
63 | |
64 | # This program implicitly loads SOM shared libraries. | |
65 | # | |
66 | if ![runto_main] then { fail "implicit solibs tests suppressed" } | |
67 | ||
68 | # Verify that we can step over the first shlib call. | |
69 | # | |
70 | send_gdb "next\n" | |
71 | gdb_expect { | |
085dd6e6 | 72 | -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\ |
c906108c SS |
73 | {pass "step over solib call"} |
74 | -re "$gdb_prompt $"\ | |
75 | {fail "step over solib call"} | |
76 | timeout {fail "(timeout) step over solib call"} | |
77 | } | |
78 | ||
79 | # Verify that we can step into the second shlib call. | |
80 | # | |
81 | send_gdb "step\n" | |
82 | gdb_expect { | |
bf7234cf | 83 | -re "solib_main .arg=10000. at.*${libfile}.c:17.*$gdb_prompt $"\ |
c906108c SS |
84 | {pass "step into solib call"} |
85 | -re "$gdb_prompt $"\ | |
86 | {fail "step into solib call"} | |
87 | timeout {fail "(timeout) step into solib call"} | |
88 | } | |
89 | ||
90 | # Verify that we can step within the shlib call. | |
91 | # | |
92 | send_gdb "next\n" | |
93 | gdb_expect { | |
085dd6e6 | 94 | -re "18\[ \t\]*\}.*$gdb_prompt $"\ |
c906108c SS |
95 | {pass "step in solib call"} |
96 | -re "$gdb_prompt $"\ | |
97 | {fail "step in solib call"} | |
98 | timeout {fail "(timeout) step in solib call"} | |
99 | } | |
100 | ||
101 | # Verify that we can step out of the shlib call, and back out into | |
102 | # the caller. | |
103 | # | |
104 | send_gdb "next\n" | |
105 | gdb_expect { | |
106 | -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" { | |
107 | # we haven't left the callee yet, so do another next | |
108 | send_gdb "next\n" | |
109 | gdb_expect { | |
085dd6e6 | 110 | -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ |
c906108c SS |
111 | {pass "step out of solib call"} |
112 | -re "$gdb_prompt $"\ | |
113 | {fail "step out of solib call"} | |
114 | timeout {fail "(timeout) step out of solib call"} | |
115 | } | |
116 | } | |
117 | ||
085dd6e6 | 118 | -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ |
c906108c SS |
119 | {pass "step out of solib call"} |
120 | -re "$gdb_prompt $"\ | |
121 | {fail "step out of solib call"} | |
122 | timeout {fail "(timeout) step out of solib call"} | |
123 | } | |
124 | ||
125 | gdb_exit | |
126 | return 0 | |
0d06e24b JM |
127 | |
128 | ||
129 | ||
130 | ||
131 | ||
132 |