]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/global-var-nested-by-dso.exp
da94f4fa8d1e19b9ef661f08f371471f0cacc0ec
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / global-var-nested-by-dso.exp
1 # Copyright 2014-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 require allow_shlib_tests
17
18 standard_testfile
19
20 set lib1name $testfile-solib1
21 set srcfile_lib1 $srcdir/$subdir/$lib1name.c
22 set binfile_lib1 [standard_output_file $lib1name.so]
23
24 set lib2name $testfile-solib2
25 set srcfile_lib2 $srcdir/$subdir/$lib2name.c
26 set binfile_lib2 [standard_output_file $lib2name.so]
27
28 if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \
29 [list debug]] != "" } {
30 untested "failed to compile shared library 1"
31 return -1
32 }
33
34 if { [gdb_compile_shlib $srcfile_lib2 $binfile_lib2 \
35 [list debug]] != "" } {
36 untested "failed to compile shared library 2"
37 return -1
38 }
39
40 if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable \
41 [list debug shlib=$binfile_lib1 shlib=$binfile_lib2]] != "" } {
42 return -1
43 }
44
45 clean_restart $binfile
46 gdb_load_shlib $binfile_lib1
47 gdb_load_shlib $binfile_lib2
48
49 if { ![runto_main] } {
50 return -1
51 }
52
53 gdb_test "next" "$decimal.*b_main \\(\\);" "step over c_main"
54 gdb_test "next" "$decimal.*return 0;" "step over b_main"
55 gdb_test "print test" " = 42"