Commit | Line | Data |
---|---|---|
7b6bb8da JB |
1 | # Copyright 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2007, 2008, 2009, 2010, |
2 | # 2011 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 | ||
c906108c | 21 | |
93f02886 DJ |
22 | if {[skip_shlib_tests]} { |
23 | return 0 | |
c906108c SS |
24 | } |
25 | ||
c906108c | 26 | set testfile "so-impl-ld" |
bf7234cf PG |
27 | set libfile "solib1" |
28 | set srcfile $srcdir/$subdir/$testfile.c | |
29 | set libsrc $srcdir/$subdir/$libfile.c | |
30 | set binfile $objdir/$subdir/$testfile | |
31 | set lib_sl $objdir/$subdir/$libfile.sl | |
32 | ||
33 | set lib_opts debug | |
34 | set exec_opts [list debug shlib=$lib_sl] | |
c906108c SS |
35 | |
36 | if [get_compiler_info ${binfile}] { | |
37 | return -1 | |
38 | } | |
39 | ||
bf7234cf | 40 | if [get_compiler_info ${binfile}] { |
c906108c SS |
41 | return -1 |
42 | } | |
43 | ||
bf7234cf PG |
44 | if [test_compiler_info "hpcc-*"] { |
45 | lappend exec_opts "additional_flags=-Ae" | |
c906108c SS |
46 | } |
47 | ||
bf7234cf PG |
48 | if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != "" |
49 | || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} { | |
50 | untested "Couldn't compile $libsrc or $srcfile." | |
c906108c SS |
51 | return -1 |
52 | } | |
c906108c SS |
53 | |
54 | # Start with a fresh gdb | |
55 | ||
56 | gdb_exit | |
57 | gdb_start | |
58 | gdb_reinitialize_dir $srcdir/$subdir | |
59 | gdb_load ${binfile} | |
93f02886 | 60 | gdb_load_shlibs $lib_sl |
c906108c SS |
61 | |
62 | # This program implicitly loads SOM shared libraries. | |
63 | # | |
64 | if ![runto_main] then { fail "implicit solibs tests suppressed" } | |
65 | ||
66 | # Verify that we can step over the first shlib call. | |
67 | # | |
02746bbc MS |
68 | gdb_test "next" "21\[ \t\]*result = solib_main .result.;" \ |
69 | "step over solib call" | |
c906108c SS |
70 | |
71 | # Verify that we can step into the second shlib call. | |
72 | # | |
02746bbc MS |
73 | gdb_test "step" "solib_main .arg=10000. at.*${libfile}.c:17.*" \ |
74 | "step into solib call" | |
c906108c SS |
75 | |
76 | # Verify that we can step within the shlib call. | |
77 | # | |
02746bbc | 78 | gdb_test "next" "18\[ \t\]*\}" "step in solib call" |
c906108c SS |
79 | |
80 | # Verify that we can step out of the shlib call, and back out into | |
81 | # the caller. | |
82 | # | |
02746bbc | 83 | gdb_test_multiple "next" "step out of solib call" { |
c906108c | 84 | -re "0x\[0-9a-f\]*\[ \t\]*9\[ \t\]*.*$gdb_prompt $" { |
02746bbc MS |
85 | gdb_test "next" \ |
86 | "main .. at.*so-impl-ld.c:22.*" \ | |
87 | "step out of solib call" | |
88 | } | |
89 | -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $" { | |
90 | pass "step out of solib call" | |
c906108c | 91 | } |
c906108c SS |
92 | } |
93 | ||
94 | gdb_exit | |
95 | return 0 | |
0d06e24b JM |
96 | |
97 | ||
98 | ||
99 | ||
100 | ||
101 |