1# Copyright 2010, 2011 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# are we on a target board 17if {![isnative] || [skip_shlib_tests]} { 18 return 19} 20 21set testfile "solib-nodir" 22# Arbitrary file, possibly not containing main, even an empty one. 23set srclibfile foo.c 24# Arbitrary file containing main. 25set srcfile start.c 26set binlibfilebase ${testfile}.so 27set binlibfiledir ${objdir}/${subdir} 28set binlibfile ${binlibfiledir}/${binlibfilebase} 29set executable ${testfile} 30set objfile ${objdir}/${subdir}/${executable}.o 31set binfile ${objdir}/${subdir}/${executable} 32 33# build the first test case 34if { [get_compiler_info unused] 35 || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [list debug ldflags=-Wl,-soname,${binlibfilebase}]] != "" 36 || [gdb_gnu_strip_debug $binlibfile] 37 || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug}] != "" 38 || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "" } { 39 untested ${testfile}.exp 40 return -1 41} 42 43clean_restart $executable 44gdb_load_shlibs ${binlibfile} 45 46gdb_test_no_output "set env LD_LIBRARY_PATH=:" 47gdb_test "cd ${binlibfiledir}" "Working directory [string_to_regexp ${binlibfiledir}]\\." "cd OBJDIR/${subdir}" 48 49set test "library loaded" 50if [runto_main] { 51 pass $test 52} else { 53 fail $test 54} 55