GDB: trad-frame: Store length of value_bytes in trad_frame_saved_reg
[binutils-gdb.git] / gdb / testsuite / gdb.base / info-fun.exp
blob6cd7680e7028d62b19ee44d38d5af39da18016a6
1 # Copyright 2012-2024 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.
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.
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/>.
15 require allow_shlib_tests
16 require {!is_remote target}
18 # Library file.
19 set libname "info-fun-solib"
20 set srcfile_lib ${srcdir}/${subdir}/${libname}.c
21 set binfile_lib [standard_output_file ${libname}.so]
22 set lib_flags {}
23 # Binary file.
24 standard_testfile .c
25 set executable ${testfile}
26 set bin_flags [list debug shlib=${binfile_lib}]
28 foreach_with_prefix n_flag { 0 1 } {
30 # SEP must be last for the possible `unsupported' error path.
31 foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" {
33 set sep_lib_flags $lib_flags
34 if {$libsepdebug != "NO"} {
35 lappend sep_lib_flags {debug}
37 if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $sep_lib_flags] != ""
38 || [gdb_compile $srcdir/$subdir/${srcfile} ${binfile} \
39 executable $bin_flags] != "" } {
40 untested "failed to compile"
41 return -1
44 if {$libsepdebug == "SEP"} {
45 if {[gdb_gnu_strip_debug $binfile_lib] != 0} {
46 unsupported "could not split debug of $binfile_lib."
47 return
48 } else {
49 pass "split solib"
53 clean_restart $executable
55 if {![runto_main]} {
56 return 0
59 set match_str {All functions matching regular expression "foo":[\r\n]*}
60 if { "$libsepdebug" != "NO" } {
61 append match_str {File .*/info-fun-solib[.]c:[\r\n]*}
62 append match_str {\d+:\tint foo\(void\);[\r\n]*}
65 set opt ""
66 if { !$n_flag } {
67 append match_str {Non-debugging symbols:[\r\n]*}
68 # Note: Targets like {m68k,ppc64,s390x}-linux also have, e.g.,
69 # 00000011.plt_call.foo+0 (m68k).
70 set plt_foo_match "($hex \[^\r\n\]*plt\[^\r\n\]*foo\[^\r\n\]*\[\r\n\]*)?"
71 append match_str $plt_foo_match
72 # This text we want to match precisely.
73 append match_str "$hex *foo(@plt)?\[\r\n\]*"
74 # Watch for again to not have to worry about the order of appearance.
75 append match_str $plt_foo_match
76 if { "$libsepdebug" == "NO" } {
77 # Note: The ".?" is for targets like m68k-linux that have ".foo" here.
78 append match_str "$hex *.?foo\[\r\n\]*"
80 } else {
81 set opt "-n"
84 gdb_test "info fun $opt foo" "$match_str"