Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright 2014-2016 Free Software Foundation, Inc. |
a5947601 SDJ |
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 lib1name $testfile-solib1 | |
23 | set srcfile_lib1 $srcdir/$subdir/$lib1name.c | |
24 | set binfile_lib1 [standard_output_file $lib1name.so] | |
25 | ||
26 | set lib2name $testfile-solib2 | |
27 | set srcfile_lib2 $srcdir/$subdir/$lib2name.c | |
28 | set binfile_lib2 [standard_output_file $lib2name.so] | |
29 | ||
30 | if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \ | |
31 | [list debug additional_flags=-fPIC]] != "" } { | |
84c93cd5 | 32 | untested "failed to compile shared library 1" |
a5947601 SDJ |
33 | return -1 |
34 | } | |
35 | ||
36 | if { [gdb_compile_shlib $srcfile_lib2 $binfile_lib2 \ | |
37 | [list debug additional_flags=-fPIC]] != "" } { | |
84c93cd5 | 38 | untested "failed to compile shared library 2" |
a5947601 SDJ |
39 | return -1 |
40 | } | |
41 | ||
42 | if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable \ | |
43 | [list debug shlib=$binfile_lib1 shlib=$binfile_lib2]] != "" } { | |
44 | return -1 | |
45 | } | |
46 | ||
47 | clean_restart $binfile | |
d9019901 SM |
48 | gdb_load_shlib $binfile_lib1 |
49 | gdb_load_shlib $binfile_lib2 | |
a5947601 SDJ |
50 | |
51 | if { ![runto_main] } { | |
52 | return -1 | |
53 | } | |
54 | ||
55 | gdb_test "next" "$decimal.*b_main \\(\\);" | |
56 | gdb_test "next" "$decimal.*return 0;" | |
57 | gdb_test "print test" " = 42" |