+2019-10-30 Christian Biesinger <cbiesinger@google.com>
+
+ * minsyms.c (clear_minimal_symbol_hash_tables): New function.
+ (build_minimal_symbol_hash_tables): Code to clear the table moved
+ to clear_minimal_symbol_hash_tables.
+ (minimal_symbol_reader::install): Call clear_minimal_symbol_hash_tables
+ when needed.
+
2019-10-29 Simon Marchi <simon.marchi@polymtl.ca>
* infcmd.c: Remove includes.
return (mcount);
}
+static void
+clear_minimal_symbol_hash_tables (struct objfile *objfile)
+{
+ for (size_t i = 0; i < MINIMAL_SYMBOL_HASH_SIZE; i++)
+ {
+ objfile->per_bfd->msymbol_hash[i] = 0;
+ objfile->per_bfd->msymbol_demangled_hash[i] = 0;
+ }
+}
+
/* Build (or rebuild) the minimal symbol hash tables. This is necessary
after compacting or sorting the table since the entries move around
thus causing the internal minimal_symbol pointers to become jumbled. */
int i;
struct minimal_symbol *msym;
- /* Clear the hash tables. */
- for (i = 0; i < MINIMAL_SYMBOL_HASH_SIZE; i++)
- {
- objfile->per_bfd->msymbol_hash[i] = 0;
- objfile->per_bfd->msymbol_demangled_hash[i] = 0;
- }
-
- /* Now, (re)insert the actual entries. */
+ /* (Re)insert the actual entries. */
for ((i = objfile->per_bfd->minimal_symbol_count,
msym = objfile->per_bfd->msymbols.get ());
i > 0;
The strings themselves are also located in the storage_obstack
of this objfile. */
+ if (m_objfile->per_bfd->minimal_symbol_count != 0)
+ clear_minimal_symbol_hash_tables (m_objfile);
+
m_objfile->per_bfd->minimal_symbol_count = mcount;
m_objfile->per_bfd->msymbols = std::move (msym_holder);