diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-06-04 13:56:55 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-06-04 13:58:48 -0400 |
commit | f8c4185131758306ddeb7b40479e82cab4dd7f26 (patch) | |
tree | 89cd25ab29ed03533340572e9506d9f79e0b6bdf /gas/config/tc-or1k.c | |
parent | add5f777decf9257f46c98dc2aacedb52a3d65e6 (diff) | |
download | gdb-f8c4185131758306ddeb7b40479e82cab4dd7f26.zip gdb-f8c4185131758306ddeb7b40479e82cab4dd7f26.tar.gz gdb-f8c4185131758306ddeb7b40479e82cab4dd7f26.tar.bz2 |
gdb: really share partial symtabs when using .gdb_index or .debug_names
Fix/follow-up to commit 17ee85fc2a ("Share DWARF partial symtabs").
In the non-index case, where GDB builds partial symbols from scratch,
two objfiles around the same BFD correctly share partial symtabs. The
first objfile, which has to do all the work, saves a reference to the
created partial symtabs in the shared per_bfd object (at the end of
dwarf2_build_psymtabs). The second objfile, when it reaches
dwarf2_build_psymtabs, sees that there are already partial symtabs built
for this BFD and just uses it.
However, that commit missed implementing the same sharing for cases
where GDB uses .gdb_index or .debug_names to build the partial symtabs.
This patch fixes it by having the first objfile to use the BFD set
per_bfd->partial_symtabs at the end of dwarf2_read_gdb_index /
dwarf2_read_debug_names. For the subsequent objfiles using that BFD,
the partial symtabs are then picked up in dwarf2_initialize_objfile.
This patch adds a test that mimics how the issue was originally
triggered:
1. Load the test file twice, such that the second objfile re-uses the
per_bfd object created for the first objfile.
2. Run to some point where in the backtrace there is a frame for a
function that's in a CU that's not yet read in.
3. Check that this frame's information is complete in the "backtrace"
output.
Step 2 requires an address -> symbol lookup which uses the addrmap at
objfile->partial_symtabs->psymtabs_addrmap. If the
objfile->partial_symtabs link is not properly setup (as is the case
before this patch), the symbol for that frame won't be found and we'll
get a frame with incomplete information.
The test fails without the fix when using boards "cc-with-gdb-index" and
"cc-with-debug-names".
gdb/ChangeLog:
* dwarf2/read.c (dwarf2_read_gdb_index): Save partial_symtabs in
the per_bfd object.
(dwarf2_read_debug_names): Likewise.
(dwarf2_initialize_objfile): Use partial_symtabs from per_bfd
object when re-using a per_bfd object with an index.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/share-psymtabs-bt.exp: New file.
* gdb.dwarf2/share-psymtabs-bt.c: New file.
* gdb.dwarf2/share-psymtabs-bt-2.c: New file.
Change-Id: Ibb26210e2dfc03b80ba9fa56b875ba4cc58c0352
Diffstat (limited to 'gas/config/tc-or1k.c')
0 files changed, 0 insertions, 0 deletions