• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/gdb/gdb/testsuite/gdb.base/
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 3 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, see <http://www.gnu.org/licenses/>.
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
25set binfile_lib ${objdir}/${subdir}/${libname}.so
26set lib_flags [list debug ldflags=-Wl,-Bsymbolic]
27# Binary file.
28set testfile "solib-symbol-main"
29set srcfile ${srcdir}/${subdir}/${testfile}.c
30set binfile ${objdir}/${subdir}/${testfile}
31set bin_flags [list debug shlib=${binfile_lib}]
32
33if [get_compiler_info ${binfile}] {
34    return -1
35}
36
37if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
38     || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
39  untested "Could not compile $binfile_lib or $binfile."
40  return -1
41}
42
43gdb_exit
44gdb_start
45gdb_reinitialize_dir $srcdir/$subdir
46gdb_load ${binfile}
47gdb_load_shlibs $binfile_lib
48
49if ![runto_main] then {
50  fail "Can't run to main"
51  return 0
52}
53
54# Set a breakpoint in the binary.
55gdb_test "br foo2" \
56	 "Breakpoint.*file.*${srcfile}.*" \
57	 "foo2 in main"
58
59delete_breakpoints
60
61# Break in the library.
62gdb_test "br foo" \
63	 "" \
64	 "foo in libmd"
65
66gdb_test "continue" \
67	 "Continuing.*" \
68	 "continue"
69
70# This symbol is now looked up in the ELF library.
71gdb_test "br foo2" \
72	 "Breakpoint.*file.*${srcfile_lib}.*" \
73	 "foo2 in mdlib"
74
75gdb_exit
76
77return 0
78
79
80