]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/info-fun.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / info-fun.exp
CommitLineData
e2882c85 1# Copyright 2012-2018 Free Software Foundation, Inc.
422d65e7
DE
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
15if { [skip_shlib_tests] || [is_remote target] } {
16 return 0
17}
18
19# Library file.
20set libname "info-fun-solib"
21set srcfile_lib ${srcdir}/${subdir}/${libname}.c
f8b41b00 22set binfile_lib [standard_output_file ${libname}.so]
422d65e7
DE
23set lib_flags {}
24# Binary file.
f8b41b00 25standard_testfile .c
422d65e7 26set executable ${testfile}
422d65e7
DE
27set bin_flags [list debug shlib=${binfile_lib}]
28
4c93b1db 29if [get_compiler_info] {
422d65e7
DE
30 return -1
31}
32
33# SEP must be last for the possible `unsupported' error path.
34foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" {
35
36 set sep_lib_flags $lib_flags
37 if {$libsepdebug != "NO"} {
38 lappend sep_lib_flags {debug}
39 }
40 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $sep_lib_flags] != ""
f8b41b00
TT
41 || [gdb_compile $srcdir/$subdir/${srcfile} ${binfile} \
42 executable $bin_flags] != "" } {
84c93cd5 43 untested "failed to compile"
422d65e7
DE
44 return -1
45 }
46
47 if {$libsepdebug == "SEP"} {
48 if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
bc6c7af4 49 unsupported "could not split debug of $binfile_lib."
422d65e7
DE
50 return
51 } else {
52 pass "split solib"
53 }
54 }
55
56 clean_restart $executable
57
58 if ![runto_main] then {
bc6c7af4 59 fail "can't run to main"
422d65e7
DE
60 return 0
61 }
62
63 set match_str {All functions matching regular expression "foo":[\r\n]*}
64 if { "$libsepdebug" != "NO" } {
65 append match_str {File .*/info-fun-solib[.]c:[\r\n]*}
66 append match_str {int foo\(void\);[\r\n]*}
67 }
68 append match_str {Non-debugging symbols:[\r\n]*}
09e0881d
DE
69 # Note: Targets like {m68k,ppc64,s390x}-linux also have, e.g.,
70 # 00000011.plt_call.foo+0 (m68k).
71 set plt_foo_match "($hex \[^\r\n\]*plt\[^\r\n\]*foo\[^\r\n\]*\[\r\n\]*)?"
72 append match_str $plt_foo_match
73 # This text we want to match precisely.
422d65e7 74 append match_str "$hex *foo(@plt)?\[\r\n\]*"
09e0881d
DE
75 # Watch for again to not have to worry about the order of appearance.
76 append match_str $plt_foo_match
422d65e7 77 if { "$libsepdebug" == "NO" } {
09e0881d
DE
78 # Note: The ".?" is for targets like m68k-linux that have ".foo" here.
79 append match_str "$hex *.?foo\[\r\n\]*"
422d65e7
DE
80 }
81
82 gdb_test "info fun foo" "$match_str"
83}}