2007-07-03 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / solib-symbol.exp
1 # Copyright 2007 Free Software Foundation, Inc.
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
4 # the Free Software Foundation; either version 2 of the License, or
5 # (at your option) any later version.
6 #
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.
11 #
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 #
16 # Contributed by Markus Deuling <deuling@de.ibm.com>.
17 #
18
19 if {[skip_shlib_tests]} {
20 return 0
21 }
22
23 # Library file.
24 set libname "solib-symbol-lib"
25 set srcfile_lib ${srcdir}/${subdir}/${libname}.c
26 set binfile_lib ${objdir}/${subdir}/${libname}.so
27 set lib_flags [list debug ldflags=-Wl,-Bsymbolic]
28 # Binary file.
29 set testfile "solib-symbol-main"
30 set srcfile ${srcdir}/${subdir}/${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
32 set bin_flags [list debug shlib=${binfile_lib}]
33
34 if [get_compiler_info ${binfile}] {
35 return -1
36 }
37
38 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
39 || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
40 untested "Could not compile $binfile_lib or $binfile."
41 return -1
42 }
43
44 gdb_exit
45 gdb_start
46 gdb_reinitialize_dir $srcdir/$subdir
47 gdb_load ${binfile}
48 gdb_load_shlibs $binfile_lib
49
50 if ![runto_main] then {
51 fail "Can't run to main"
52 return 0
53 }
54
55 # Set a breakpoint in the binary.
56 gdb_test "br foo2" \
57 "Breakpoint.*file.*${srcfile}.*" \
58 "foo2 in main"
59
60 delete_breakpoints
61
62 # Break in the library.
63 gdb_test "br foo" \
64 "" \
65 "foo in libmd"
66
67 gdb_test "continue" \
68 "Continuing.*" \
69 "continue"
70
71 # This symbol is now looked up in the ELF library.
72 gdb_test "br foo2" \
73 "Breakpoint.*file.*${srcfile_lib}.*" \
74 "foo2 in mdlib"
75
76 gdb_exit
77
78 return 0
79
80
This page took 0.031519 seconds and 4 git commands to generate.