]>
Commit | Line | Data |
---|---|---|
4dafcdeb JB |
1 | # Copyright 2015 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 3 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, see <http://www.gnu.org/licenses/>. | |
15 | ||
16 | if { [skip_shlib_tests] } { | |
17 | return 0 | |
18 | } | |
19 | ||
20 | standard_testfile | |
21 | ||
22 | set output_dir [standard_output_file {}] | |
23 | ||
24 | set libdso2 $testfile-dso2 | |
25 | set srcfile_libdso2 $srcdir/$subdir/$libdso2.c | |
26 | set binfile_libdso2 [standard_output_file $libdso2.so] | |
27 | ||
28 | set libdso1 $testfile-dso1 | |
29 | set srcfile_libdso1 $srcdir/$subdir/$libdso1.c | |
30 | set binfile_libdso1 [standard_output_file $libdso1.so] | |
31 | ||
32 | if { [gdb_compile_shlib $srcfile_libdso2 $binfile_libdso2 \ | |
33 | [list debug additional_flags=-fPIC]] != "" } { | |
34 | untested "Could not compile $binfile_libdso2." | |
35 | return -1 | |
36 | } | |
37 | ||
38 | if { [gdb_compile_shlib $srcfile_libdso1 $binfile_libdso1 \ | |
39 | [list debug additional_flags=-fPIC]] != "" } { | |
40 | untested "Could not compile $binfile_libdso1." | |
41 | return -1 | |
42 | } | |
43 | ||
44 | if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable \ | |
45 | [list debug shlib=$binfile_libdso2 shlib=$binfile_libdso1]] != "" } { | |
46 | return -1 | |
47 | } | |
48 | ||
49 | clean_restart $binfile | |
50 | gdb_load_shlibs $binfile_libdso2 $binfile_libdso1 | |
51 | ||
52 | if { ![runto_main] } { | |
53 | return -1 | |
54 | } | |
55 | ||
56 | # Verify that we can "next" over the call to sub2 (provided by | |
57 | # libdso2) make from sub1 (provided by libdso1), and land at | |
58 | # the expected location. | |
59 | ||
ea8812bc | 60 | set bp_location [gdb_get_line_number "STOP HERE" [file tail $srcfile_libdso1]] |
4dafcdeb JB |
61 | gdb_breakpoint ${srcfile_libdso1}:${bp_location} |
62 | ||
63 | gdb_continue_to_breakpoint "at call to sub2" \ | |
64 | ".*sub2 ().*" | |
65 | ||
66 | gdb_test "next" \ | |
67 | ".*return 5;.*" \ | |
68 | "next over call to sub2" |