diff options
author | Tom Tromey <tromey@redhat.com> | 2013-10-15 11:37:19 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-02-26 12:11:17 -0700 |
commit | 34643a32c6b17041b7ebc13ac3077f6eaec7ec80 (patch) | |
tree | 5febf13c3c8c850bc9a8303ab20ab871981023e6 /gdb/symfile.c | |
parent | 2273f0ac95a79ce29ef42025c63f90e82cf907d7 (diff) | |
download | gdb-34643a32c6b17041b7ebc13ac3077f6eaec7ec80.zip gdb-34643a32c6b17041b7ebc13ac3077f6eaec7ec80.tar.gz gdb-34643a32c6b17041b7ebc13ac3077f6eaec7ec80.tar.bz2 |
move minimal symbols to per-bfd
Now that minimal symbols are independent of the program space, we can
move them to the per-BFD object. This lets us save memory in the
multi-inferior case; and, once the symbol readers are updated, time.
The other prerequisite for this move is that all the objects referred
to by the minimal symbols have a lifetime at least as long as the
per-BFD object. I think this is satisfied partially by this patch
(moving the copied names there) and partially by earlier patches
moving the demangled name hash.
This patch contains a bit of logic to avoid creating new minimal
symbols if they have already been read for a given BFD. This allows
us to avoid trying to update all the symbol readers for this
condition. At first glance this may seem like a hack, but some symbol
readers mix psym and minsym reading, and would require logic just like
this regardless -- and it is simpler and less error-prone to just do
the work in a central spot.
2014-02-26 Tom Tromey <tromey@redhat.com>
* minsyms.c (lookup_minimal_symbol, iterate_over_minimal_symbols)
(lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name)
(lookup_minimal_symbol_solib_trampoline)
(lookup_minimal_symbol_by_pc_section_1)
(lookup_minimal_symbol_and_objfile): Update.
(prim_record_minimal_symbol_full): Use the per-BFD obstack.
Don't allocate a minimal symbol if minsyms have already been read.
(build_minimal_symbol_hash_tables): Update.
(install_minimal_symbols): Do nothing if minsyms already read.
Use the per-BFD obstack.
(terminate_minimal_symbol_table): Use the per-BFD obstack.
* objfiles.c (allocate_objfile): Call
terminate_minimal_symbol_table later.
(have_minimal_symbols): Update.
* objfiles.h (struct objfile_per_bfd_storage) <msymbols,
minimal_symbol_count, msymbol_hash, msymbol_demangled_hash>:
Move from struct objfile.
<minsyms_read>: New field.
(struct objfile) <msymbols, minimal_symbol_count,
msymbol_hash, msymbol_demangled_hash>: Move.
(ALL_OBJFILE_MSYMBOLS): Update.
* symfile.c (read_symbols): Set minsyms_read.
(reread_symbols): Update.
* symmisc.c (dump_objfile, dump_msymbols): Update.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r-- | gdb/symfile.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index d5cb7cb..aee7ef5 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -836,6 +836,7 @@ static void read_symbols (struct objfile *objfile, int add_flags) { (*objfile->sf->sym_read) (objfile, add_flags); + objfile->per_bfd->minsyms_read = 1; /* find_separate_debug_file_in_section should be called only if there is single binary with no existing separate debug info file. */ @@ -2608,12 +2609,6 @@ reread_symbols (void) objfile->psymtabs_addrmap = NULL; objfile->free_psymtabs = NULL; objfile->template_symbols = NULL; - objfile->msymbols = NULL; - objfile->minimal_symbol_count = 0; - memset (&objfile->msymbol_hash, 0, - sizeof (objfile->msymbol_hash)); - memset (&objfile->msymbol_demangled_hash, 0, - sizeof (objfile->msymbol_demangled_hash)); /* obstack_init also initializes the obstack so it is empty. We could use obstack_specify_allocation but |