]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/share-psymtabs-bt.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / share-psymtabs-bt.exp
CommitLineData
3666a048 1# Copyright 2020-2021 Free Software Foundation, Inc.
f8c41851
SM
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# Test that a backtrace is shown correctly for an objfile that uses partial
17# symtabs created by another objfile sharing the same BFD.
18#
19# It mimics how a bug with psymtab sharing was initially found:
20#
21# 1. Load the test file twice, such that the second objfile re-uses the
22# per_bfd object created for the first objfile.
23# 2. Run to some point where in the backtrace there is a frame for a
24# function that's in a CU that's not yet read in.
25# 3. Check that this frame's information is complete in the "backtrace"
26# output.
27
28standard_testfile .c share-psymtabs-bt-2.c
29
30if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
31 {debug}] } {
32 untested "failed to compile"
33 return -1
34}
35
36# Load $binfile a second time. The second created objfile will re-use the
37# partial symtabs created by the first one.
38if { [gdb_file_cmd $binfile] != 0 } {
39 fail "file command failed"
40 return -1
41}
42
43gdb_breakpoint "bar"
44if { ![runto "bar"] } {
45 fail "failed to run to bar"
46 return -1
47}
48
49# A buggy GDB would fail to find the full symbol associated to this frame's
50# address, so would just show "foo ()" (from the minimal symbol).
51gdb_test "bt" "foo \\(x=12345\\).*"