xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/so-impl-ld.exp (revision 7bdf38e5b7a28439665f2fdeff81e36913eef7dd)
1# Copyright 1997-2023 Free Software Foundation, Inc.
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
17if {[skip_shlib_tests]} {
18    return 0
19}
20
21standard_testfile .c
22set libfile "solib1"
23set libsrc  $srcdir/$subdir/$libfile.c
24set lib_sl  [standard_output_file $libfile.sl]
25
26set lib_opts  debug
27set exec_opts [list debug shlib=$lib_sl]
28
29if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
30     || [gdb_compile $srcdir/$subdir/$srcfile $binfile \
31	     executable $exec_opts] != ""} {
32    untested "failed to compile"
33    return -1
34}
35
36# Start with a fresh gdb
37
38clean_restart ${binfile}
39gdb_load_shlib $lib_sl
40
41# This program implicitly loads SOM shared libraries.
42#
43if {![runto_main]} {
44    return
45}
46
47# Verify that we can step over the first shlib call.
48#
49gdb_test "next" "21\[ \t\]*result = solib_main .result.;" \
50    "step over solib call"
51
52# Verify that we can step into the second shlib call.
53#
54gdb_test "step" "solib_main .arg=10000. at.*${libfile}.c:${decimal}.* HERE .*" \
55    "step into solib call"
56
57# Verify that we can step within the shlib call.
58#
59gdb_test "next" "${decimal}\[ \t\]*return ans;.* STEP .*" "step in solib call"
60
61# Verify that we can step out of the shlib call, and back out into
62# the caller.
63#
64gdb_step_until ".*main .. at.*return 0;.*" "step out of solib call"
65
66gdb_exit
67return 0
68
69
70
71
72
73
74