aboutsummaryrefslogtreecommitdiff
path: root/gdb/psympriv.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-20 17:23:40 -0600
committerTom Tromey <tom@tromey.com>2021-03-20 17:23:44 -0600
commit17d66340ebb4528307c6c5d08383859aab785db7 (patch)
tree8ac73162b98501fb1d60f0961a6487a568095220 /gdb/psympriv.h
parent84685904937577dabf4fb0b458784f853fc648be (diff)
downloadgdb-17d66340ebb4528307c6c5d08383859aab785db7.zip
gdb-17d66340ebb4528307c6c5d08383859aab785db7.tar.gz
gdb-17d66340ebb4528307c6c5d08383859aab785db7.tar.bz2
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 <tom@tromey.com> * 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. <m_partial_symtabs>: New member. <set_partial_symtabs>: New method.
Diffstat (limited to 'gdb/psympriv.h')
-rw-r--r--gdb/psympriv.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 943d6c1..b1b8027 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -476,6 +476,11 @@ class psymtab_discarder
partial symbols. */
struct psymbol_functions : public quick_symbol_functions
{
+ explicit psymbol_functions (const std::shared_ptr<psymtab_storage> &storage)
+ : m_partial_symtabs (storage)
+ {
+ }
+
bool has_symbols (struct objfile *objfile) override;
struct symtab *find_last_source_symtab (struct objfile *objfile) override;
@@ -540,6 +545,13 @@ struct psymbol_functions : public quick_symbol_functions
m_psymbol_map.clear ();
}
+ /* Replace the partial symbol table storage in this object with
+ SYMS. */
+ void set_partial_symtabs (const std::shared_ptr<psymtab_storage> &syms)
+ {
+ m_partial_symtabs = syms;
+ }
+
private:
void fill_psymbol_map (struct objfile *objfile,
@@ -547,6 +559,9 @@ private:
std::set<CORE_ADDR> *seen_addrs,
const std::vector<partial_symbol *> &symbols);
+ /* Storage for the partial symbols. */
+ std::shared_ptr<psymtab_storage> m_partial_symtabs;
+
/* Map symbol addresses to the partial symtab that defines the
object at that address. */