After this patch, the psymtab address map will now be allocated on the
psymtab obstack rather than the objfile obstack. This also changes
the psymtab storage object to make the obstack private; this will be
used later.
gdb/ChangeLog
2019-01-10 Tom Tromey <
[email protected]>
* psymtab.h (psymtab_storage::obstack): New method.
<m_obstack>: Rename from obstack; now private.
* psymtab.c (psymtab_storage): Update.
* dwarf2read.c (create_addrmap_from_index)
(create_addrmap_from_aranges, dwarf2_build_psymtabs_hard):
Update.
+
+ * psymtab.h (psymtab_storage::obstack): New method.
+ <m_obstack>: Rename from obstack; now private.
+ * psymtab.c (psymtab_storage): Update.
+ * dwarf2read.c (create_addrmap_from_index)
+ (create_addrmap_from_aranges, dwarf2_build_psymtabs_hard):
+ Update.
+
* symfile.c (reread_symbols): Call objfile->reset_psymtabs.
}
objfile->partial_symtabs->psymtabs_addrmap
- = addrmap_create_fixed (mutable_map, &objfile->objfile_obstack);
+ = addrmap_create_fixed (mutable_map, objfile->partial_symtabs->obstack ());
}
/* Read the address map data from DWARF-5 .debug_aranges, and use it to
}
objfile->partial_symtabs->psymtabs_addrmap
- = addrmap_create_fixed (mutable_map, &objfile->objfile_obstack);
+ = addrmap_create_fixed (mutable_map, objfile->partial_symtabs->obstack ());
}
/* Find a slot in the mapped index INDEX for the object named NAME.
objfile->partial_symtabs->psymtabs_addrmap
= addrmap_create_fixed (objfile->partial_symtabs->psymtabs_addrmap,
- &objfile->objfile_obstack);
+ objfile->partial_symtabs->obstack ());
/* At this point we want to keep the address map. */
save_psymtabs_addrmap.release ();
\f
psymtab_storage::psymtab_storage (struct objfile *objfile)
- : obstack (&objfile->objfile_obstack),
- psymbol_cache (psymbol_bcache_init ())
+ : psymbol_cache (psymbol_bcache_init ()),
+ m_obstack (&objfile->objfile_obstack)
{
}
void discard_psymtab (struct partial_symtab *pst);
+ /* Return the obstack that is used for storage by this object. */
+
+ struct obstack *obstack ()
+ {
+ return m_obstack;
+ }
+
/* Each objfile points to a linked list of partial symtabs derived from
this file, one partial symtab structure for each compilation unit
struct partial_symtab *free_psymtabs = nullptr;
- /* The obstack where allocations are made. */
-
- struct obstack *obstack;
-
/* A byte cache where we can stash arbitrary "chunks" of bytes that
will not change. */
std::vector<partial_symbol *> global_psymbols;
std::vector<partial_symbol *> static_psymbols;
+
+private:
+
+ /* The obstack where allocations are made. */
+
+ struct obstack *m_obstack;
};