Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / solib-symbol.exp
CommitLineData
88b9d363 1# Copyright 2007-2022 Free Software Foundation, Inc.
3a40aaa0
UW
2# This program is free software; you can redistribute it and/or modify
3# it under the terms of the GNU General Public License as published by
e22f8b7c 4# the Free Software Foundation; either version 3 of the License, or
3a40aaa0 5# (at your option) any later version.
e22f8b7c 6#
3a40aaa0
UW
7# This program is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10# GNU General Public License for more details.
e22f8b7c 11#
3a40aaa0 12# You should have received a copy of the GNU General Public License
e22f8b7c 13# along with this program. If not, see <http://www.gnu.org/licenses/>.
3a40aaa0
UW
14#
15# Contributed by Markus Deuling <deuling@de.ibm.com>.
16#
17
18if {[skip_shlib_tests]} {
19 return 0
20}
21
22# Library file.
23set libname "solib-symbol-lib"
24set srcfile_lib ${srcdir}/${subdir}/${libname}.c
0ab77f5f 25set binfile_lib [standard_output_file ${libname}.so]
3a40aaa0
UW
26set lib_flags [list debug ldflags=-Wl,-Bsymbolic]
27# Binary file.
28set testfile "solib-symbol-main"
29set srcfile ${srcdir}/${subdir}/${testfile}.c
0ab77f5f 30set binfile [standard_output_file ${testfile}]
3a40aaa0
UW
31set bin_flags [list debug shlib=${binfile_lib}]
32
4c93b1db 33if [get_compiler_info] {
3a40aaa0
UW
34 return -1
35}
36
37if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
38 || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
84c93cd5 39 untested "failed to compile"
3a40aaa0
UW
40 return -1
41}
42
43gdb_exit
44gdb_start
45gdb_reinitialize_dir $srcdir/$subdir
46gdb_load ${binfile}
d9019901 47gdb_load_shlib $binfile_lib
3a40aaa0 48
3a40aaa0
UW
49# Set a breakpoint in the binary.
50gdb_test "br foo2" \
af369495 51 "Breakpoint.*file.*${testfile}\\.c.*" \
3a40aaa0
UW
52 "foo2 in main"
53
54delete_breakpoints
55
f8eba3c6 56if ![runto_main] then {
bc6c7af4 57 fail "can't run to main"
f8eba3c6
TT
58 return 0
59}
60
3a40aaa0
UW
61# Break in the library.
62gdb_test "br foo" \
af369495 63 "Breakpoint.*file.*${libname}\\.c.*" \
3a40aaa0
UW
64 "foo in libmd"
65
66gdb_test "continue" \
11af934b 67 "Continuing.*"
3a40aaa0 68
f8eba3c6 69# This symbol is now looked up in the ELF library and the binary.
3a40aaa0 70gdb_test "br foo2" \
f8eba3c6 71 "Breakpoint.*: foo2. .2 locations..*" \
3a40aaa0
UW
72 "foo2 in mdlib"
73
74gdb_exit
75
76return 0
77
78
This page took 2.126591 seconds and 4 git commands to generate.