gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / skip-solib.exp
CommitLineData
0b302171 1# Copyright 2011-2012 Free Software Foundation, Inc.
1bfeeb0f
JL
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# This file was written by Justin Lebar. (justin.lebar@gmail.com)
17
18#
19# Tests skipping shared libraries.
20#
21
22# This only works on GNU/Linux.
23if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_tests]} {
24 continue
25}
26
27set test "skip-solib"
28set srcfile_main "${test}-main.c"
89e208db
JK
29set executable_main ${test}-test
30set binfile_main ${objdir}/${subdir}/${executable_main}
1bfeeb0f
JL
31set srcfile_lib "${test}-lib.c"
32set libname "lib${test}"
33set binfile_lib ${objdir}/${subdir}/${libname}.so
34
35#
36# Compile our program under test. The main program references a shared library
37# libskip-solib.so, which contains two functions, square(), which is
38# referenced by the main program, and multiply(), which is not referenced by
39# the main program.
40#
41
42if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-fPIC -Wl,-soname,${libname}.so]] != ""} {
43 return -1
44}
45
46if {[gdb_compile "${srcdir}/${subdir}/${srcfile_main}" "${binfile_main}.o" object debug] != ""} {
47 return -1
48}
49
50if {[gdb_compile "${binfile_main}.o" "${binfile_main}" executable \
51 [list debug "additional_flags=-L${objdir}/${subdir} -l${test} \
52 -Wl,-rpath=${objdir}/${subdir}"]] != ""} {
53 return -1
54}
55
89e208db 56clean_restart ${executable_main}
1bfeeb0f
JL
57
58#
59# At this point, if we try to skip the file ${srcfile_lib} or the function
60# multiply(), we should get a prompt asking us if we want to enable the
61# skip entry pending a shared library load.
62#
63
64gdb_test "skip file ${srcfile_lib}" \
65 "File ${srcfile_lib} will be skipped when stepping." \
66 "ignoring file in solib" \
67 "No source file named ${srcfile_lib}.*
68Ignore file pending future shared library load.*" \
69 "y"
70
71#
85817405 72# Checkinfo skip list.
1bfeeb0f
JL
73#
74gdb_test "info skip" \
85817405
JK
75 "Num\\s+Type\\s+Enb\\s+What\\s*
761\\s+file\\s+y\\s+${srcfile_lib}\\s*" \
1bfeeb0f
JL
77 "info skip with pending file"
78
79if ![runto_main] { fail "skip tests suppressed" }
80
81#
82# We shouldn't step into square(), since we skipped skip-solib-lib.c.
83#
84gdb_test "step" ""
85gdb_test "bt" "#0\\s+main.*" "step after ignoring solib file."
86
1bfeeb0f
JL
87#
88# Now restart gdb and testing ignoring of a function inside a solib.
89#
89e208db 90clean_restart ${executable_main}
1bfeeb0f
JL
91
92gdb_test "skip function multiply" \
85817405 93 "Function multiply will be skipped when stepping\\." \
1bfeeb0f
JL
94 "ignoring function in solib" \
95"No function found named multiply..*
96Ignore function pending future shared library load.*" \
97 "y"
98
99if ![runto_main] { fail "skip tests suppressed" }
100
101#
102# Our first step should take us into square.
103#
104gdb_test "step" "square.*"
105
106#
107# Now our entry should no longer be pending.
108#
109gdb_test "info skip" \
85817405
JK
110 "Num\\s+Type\\s+Enb\\s+What\\s*
1111\\s+function\\s+y\\s+multiply\\s*" \
112 "info skip for function multiply"
1bfeeb0f
JL
113
114#
115# This step shouldn't go into multiply -- we should skip it and go on to the
116# last line of square.
117#
118gdb_test "step" ""
119gdb_test "bt" "#0\\s+square.*"
This page took 0.182401 seconds and 4 git commands to generate.