1 # Copyright 2020 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Test that a backtrace is shown correctly for an objfile that uses partial
17 # symtabs created by another objfile sharing the same BFD.
19 # It mimics how a bug with psymtab sharing was initially found:
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"
28 standard_testfile .c share-psymtabs-bt-2.c
30 if { [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
32 untested "failed to compile"
36 # Load $binfile a second time. The second created objfile will re-use the
37 # partial symtabs created by the first one.
38 if { [gdb_file_cmd $binfile] != 0 } {
39 fail "file command failed"
44 if { ![runto "bar"] } {
45 fail "failed to run to bar"
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).
51 gdb_test "bt" "foo \\(x=12345\\).*"