From 5f6cac4085c95c5339b9549dc06d4f9184184fa6 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 15 Oct 2013 11:50:58 -0600 Subject: add short-circuit logic to elfread.c If minimal symbols have already been read into a per-BFD object, then a symbol reader can skip re-reading them. This changes the ELF reader to do so. We only skip the work if the file is ELF+DWARF. If it has stabs or mdebug sections, then I think extra information is computed during the minsym creation pass; and so we must still repeat it. Eventually even this will go away, once all symbol types have switched to being progspace-independent. In the meantime this has no negative effect -- it is just a missing optimization for a small set of users. This change also required a somewhat non-obvious change to the OBJSTAT accounting code. If a symbol reader skips re-reading minimal symbols, then the corresponding OBJSTAT will not be updated. This leads to a test failure in gdb.base/maint.exp. To fix this, I've moved the needed stat field out of objfile and into the per-BFD object. 2014-02-26 Tom Tromey * elfread.c (elf_read_minimal_symbols): Return early if minimal symbols have already been read. Add "ei" parameter. (elf_symfile_read): Call elf_read_minimal_symbols earlier. * minsyms.c (prim_record_minimal_symbol_full): Update. * objfiles.h (struct objstats) : Move... (struct objfile_per_bfd_storage) : ... here. * symmisc.c (print_objfile_statistics): Update. --- gdb/symmisc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/symmisc.c') diff --git a/gdb/symmisc.c b/gdb/symmisc.c index eb15ecc..7ea97bd 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -111,9 +111,9 @@ print_objfile_statistics (void) if (OBJSTAT (objfile, n_stabs) > 0) printf_filtered (_(" Number of \"stab\" symbols read: %d\n"), OBJSTAT (objfile, n_stabs)); - if (OBJSTAT (objfile, n_minsyms) > 0) + if (objfile->per_bfd->n_minsyms > 0) printf_filtered (_(" Number of \"minimal\" symbols read: %d\n"), - OBJSTAT (objfile, n_minsyms)); + objfile->per_bfd->n_minsyms); if (OBJSTAT (objfile, n_psyms) > 0) printf_filtered (_(" Number of \"partial\" symbols read: %d\n"), OBJSTAT (objfile, n_psyms)); -- cgit v1.1