1 # Copyright 2014-2019 Free Software Foundation, Inc.
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.
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.
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/>.
16 if { [skip_shlib_tests] } {
22 set lib1name $testfile-solib1
23 set srcfile_lib1 $srcdir/$subdir/$lib1name.c
24 set binfile_lib1 [standard_output_file $lib1name.so]
26 set lib2name $testfile-solib2
27 set srcfile_lib2 $srcdir/$subdir/$lib2name.c
28 set binfile_lib2 [standard_output_file $lib2name.so]
30 if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \
31 [list debug additional_flags=-fPIC]] != "" } {
32 untested "failed to compile shared library 1"
36 if { [gdb_compile_shlib $srcfile_lib2 $binfile_lib2 \
37 [list debug additional_flags=-fPIC]] != "" } {
38 untested "failed to compile shared library 2"
42 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable \
43 [list debug shlib=$binfile_lib1 shlib=$binfile_lib2]] != "" } {
47 clean_restart $binfile
48 gdb_load_shlib $binfile_lib1
49 gdb_load_shlib $binfile_lib2
51 if { ![runto_main] } {
55 gdb_test "next" "$decimal.*b_main \\(\\);"
56 gdb_test "next" "$decimal.*return 0;"
57 gdb_test "print test" " = 42"