struct partial_symtab *
start_psymtab_common (struct objfile *objfile,
const char *filename,
- CORE_ADDR textlow,
- std::vector<partial_symbol *> &global_psymbols,
- std::vector<partial_symbol *> &static_psymbols)
+ CORE_ADDR textlow)
{
struct partial_symtab *psymtab;
psymtab = allocate_psymtab (filename, objfile);
psymtab->set_text_low (textlow);
psymtab->set_text_high (psymtab->raw_text_low ()); /* default */
- psymtab->globals_offset = global_psymbols.size ();
- psymtab->statics_offset = static_psymbols.size ();
+ psymtab->globals_offset = objfile->global_psymbols.size ();
+ psymtab->statics_offset = objfile->static_psymbols.size ();
return psymtab;
}
domain_enum domain,
enum address_class theclass,
short section,
- std::vector<partial_symbol *> *list,
+ psymbol_placement where,
CORE_ADDR coreaddr,
enum language language, struct objfile *objfile)
{
section, coreaddr, language, objfile, &added);
/* Do not duplicate global partial symbols. */
- if (list == &objfile->global_psymbols
- && !added)
+ if (where == psymbol_placement::GLOBAL && !added)
return;
/* Save pointer to partial symbol in psymtab, growing symtab if needed. */
+ std::vector<partial_symbol *> *list
+ = (where == psymbol_placement::STATIC
+ ? &objfile->static_psymbols
+ : &objfile->global_psymbols);
append_psymbol_to_list (list, psym, objfile);
}
-/* Initialize storage for partial symbols. */
+/* See psympriv.h. */
void
init_psymbol_list (struct objfile *objfile, int total_symbols)
{
- /* Free any previously allocated psymbol lists. */
- objfile->global_psymbols.clear ();
- objfile->static_psymbols.clear ();
-
- /* Current best guess is that approximately a twentieth
- of the total symbols (in a debugging file) are global or static
- oriented symbols, then multiply that by slop factor of two. */
- objfile->global_psymbols.reserve (total_symbols / 10);
- objfile->static_psymbols.reserve (total_symbols / 10);
+ if (objfile->global_psymbols.capacity () == 0
+ && objfile->static_psymbols.capacity () == 0)
+ {
+ /* Current best guess is that approximately a twentieth of the
+ total symbols (in a debugging file) are global or static
+ oriented symbols, then multiply that by slop factor of
+ two. */
+ objfile->global_psymbols.reserve (total_symbols / 10);
+ objfile->static_psymbols.reserve (total_symbols / 10);
+ }
}
+/* See psympriv.h. */
+
struct partial_symtab *
allocate_psymtab (const char *filename, struct objfile *objfile)
{