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