From 17d66340ebb4528307c6c5d08383859aab785db7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 20 Mar 2021 17:23:40 -0600 Subject: Attach partial symtab storage to psymbol_functions Currently, the storage for partial symtabs is attached to the objfile. Ultimately, though, this direct assocation will be removed, and the storage will be owned by the psymbol_functions object. This patch is a step toward this goal. The storage is already managed as a shared_ptr, to enable cross-objfile sharing, so this adds a reference from the psymbol_functions, and changes some code in psymtab.c to use this reference instead. gdb/ChangeLog 2021-03-20 Tom Tromey * dwarf2/read.c (dwarf2_build_psymtabs): Call set_partial_symtabs. * symfile.c (syms_from_objfile_1, reread_symbols): Update. * psymtab.h (make_psymbol_functions): Add partial_symtabs parameter. * psymtab.c (find_pc_sect_psymtab): Add partial_symtabs parameter. (psymbol_functions::find_pc_sect_compunit_symtab) (psymbol_functions::print_stats, psymbol_functions::dump) (psymbol_functions::has_symbols): Update. (make_psymbol_functions, dump_psymtab_addrmap): Add partial_symtabs parameter. (maintenance_print_psymbols): Update. (psymbol_functions::expand_symtabs_matching): Update. * psympriv.h (struct psymbol_functions): Add constructor. : New member. : New method. --- gdb/dwarf2/read.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/dwarf2') diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index befaea5..c4acf29 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -6128,6 +6128,12 @@ dwarf2_build_psymtabs (struct objfile *objfile) /* Partial symbols were already read, so now we can simply attach them. */ objfile->partial_symtabs = per_bfd->partial_symtabs; + /* This is a temporary hack to ensure that the objfile and 'qf' + psymtabs are identical. */ + psymbol_functions *psf + = dynamic_cast (objfile->qf.get ()); + gdb_assert (psf != nullptr); + psf->set_partial_symtabs (per_bfd->partial_symtabs); per_objfile->resize_symtabs (); return; } -- cgit v1.1