From 34643a32c6b17041b7ebc13ac3077f6eaec7ec80 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Oct 2013 11:37:19 -0600 Subject: 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 * 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) : Move from struct objfile. : New field. (struct objfile) : Move. (ALL_OBJFILE_MSYMBOLS): Update. * symfile.c (read_symbols): Set minsyms_read. (reread_symbols): Update. * symmisc.c (dump_objfile, dump_msymbols): Update. --- gdb/symmisc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gdb/symmisc.c') diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 0fc78d5..eb15ecc 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -168,7 +168,7 @@ dump_objfile (struct objfile *objfile) printf_filtered (", bfd at "); gdb_print_host_address (objfile->obfd, gdb_stdout); printf_filtered (", %d minsyms\n\n", - objfile->minimal_symbol_count); + objfile->per_bfd->minimal_symbol_count); if (objfile->sf) objfile->sf->qf->dump (objfile); @@ -204,7 +204,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) char ms_type; fprintf_filtered (outfile, "\nObject file %s:\n\n", objfile_name (objfile)); - if (objfile->minimal_symbol_count == 0) + if (objfile->per_bfd->minimal_symbol_count == 0) { fprintf_filtered (outfile, "No minimal symbols found.\n"); return; @@ -274,10 +274,10 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) fputs_filtered ("\n", outfile); index++; } - if (objfile->minimal_symbol_count != index) + if (objfile->per_bfd->minimal_symbol_count != index) { warning (_("internal error: minimal symbol count %d != %d"), - objfile->minimal_symbol_count, index); + objfile->per_bfd->minimal_symbol_count, index); } fprintf_filtered (outfile, "\n"); } -- cgit v1.1