]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/symtab-search-order.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / symtab-search-order.exp
CommitLineData
213516ef 1# Copyright 2014-2023 Free Software Foundation, Inc.
af3768e9
DE
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
16if {[skip_shlib_tests]} {
17 return 0
18}
19
20standard_testfile .c symtab-search-order-1.c symtab-search-order-shlib-1.c
21set srcfile $srcdir/$subdir/$srcfile
22set srcfile2 $srcdir/$subdir/$srcfile2
23set lib1src $srcdir/$subdir/$srcfile3
24set lib1 [standard_output_file symtab-search-order-1.sl]
25
26set lib_opts "debug"
27set exec_opts [list debug shlib=$lib1]
28
af3768e9
DE
29if { [gdb_compile_shlib $lib1src $lib1 $lib_opts] != ""
30 || [gdb_compile [list $srcfile $srcfile2] $binfile executable \
31 $exec_opts] != ""} {
84c93cd5 32 untested "failed to compile"
af3768e9
DE
33 return -1
34}
35
36# Start with a fresh gdb.
37
38clean_restart $binfile
d9019901 39gdb_load_shlib $lib1
af3768e9
DE
40
41if ![runto_main] {
af3768e9
DE
42 return -1
43}
44
45# PR 17564
46# Expand something in the shared library,
47# and then try to print static_global in the binary.
48# We should get the static_global in the binary.
49# Note: static_global in the binary needs to be in a file
50# other than the one with "main" because gdb will expand
51# the symtab with main when starting.
52
53gdb_test "p shlib_1_func" "= .*<shlib_1_func>"
54gdb_test "p static_global" " = 23"