diff options
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/elfread.c | 27 | ||||
-rw-r--r-- | gdb/minsyms.c | 6 | ||||
-rw-r--r-- | gdb/objfiles.h | 7 | ||||
-rw-r--r-- | gdb/symmisc.c | 4 |
5 files changed, 41 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1d1a370..f5df2f2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2014-02-26 Tom Tromey <tromey@redhat.com> + * 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) <n_minsyms>: Move... + (struct objfile_per_bfd_storage) <n_minsyms>: ... here. + * symmisc.c (print_objfile_statistics): Update. + +2014-02-26 Tom Tromey <tromey@redhat.com> + * elfread.c (elf_read_minimal_symbols): New function, from elf_symfile_read. (elf_symfile_read): Call it. diff --git a/gdb/elfread.c b/gdb/elfread.c index 3aec352..88fb018 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1084,7 +1084,8 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b) symbols. */ static void -elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags) +elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags, + const struct elfinfo *ei) { bfd *synth_abfd, *abfd = objfile->obfd; struct cleanup *back_to; @@ -1100,6 +1101,21 @@ elf_read_minimal_symbols (struct objfile *objfile, int symfile_flags) objfile_name (objfile)); } + /* If we already have minsyms, then we can skip some work here. + However, if there were stabs or mdebug sections, we go ahead and + redo all the work anyway, because the psym readers for those + kinds of debuginfo need extra information found here. This can + go away once all types of symbols are in the per-BFD object. */ + if (objfile->per_bfd->minsyms_read + && ei->stabsect == NULL + && ei->mdebugsect == NULL) + { + if (symtab_create_debug) + fprintf_unfiltered (gdb_stdlog, + "... minimal symbols previously read\n"); + return; + } + init_minimal_symbol_collection (); back_to = make_cleanup_discard_minimal_symbols (); @@ -1242,16 +1258,11 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) bfd *abfd = objfile->obfd; struct elfinfo ei; - elf_read_minimal_symbols (objfile, symfile_flags); - memset ((char *) &ei, 0, sizeof (ei)); - - /* Now process debugging information, which is contained in - special ELF sections. */ - - /* We first have to find them... */ bfd_map_over_sections (abfd, elf_locate_sections, (void *) & ei); + elf_read_minimal_symbols (objfile, symfile_flags, &ei); + /* ELF debugging information is inserted into the psymtab in the order of least informative first - most informative last. Since the psymtab table is searched `most recent insertion first' this diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 1dc86eb..6f1fb35 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -977,9 +977,11 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name, /* If we already read minimal symbols for this objfile, then don't ever allocate a new one. */ if (!objfile->per_bfd->minsyms_read) - msym_bunch_index++; + { + msym_bunch_index++; + objfile->per_bfd->n_minsyms++; + } msym_count++; - OBJSTAT (objfile, n_minsyms++); return msymbol; } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index d585bc4..dc06c7b 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -151,7 +151,6 @@ struct obj_section struct objstats { - int n_minsyms; /* Number of minimal symbols read */ int n_psyms; /* Number of partial symbols read */ int n_syms; /* Number of full symbols read */ int n_stabs; /* Number of ".stabs" read (if applicable) */ @@ -224,6 +223,12 @@ struct objfile_per_bfd_storage struct minimal_symbol *msymbols; int minimal_symbol_count; + /* The number of minimal symbols read, before any minimal symbol + de-duplication is applied. Note in particular that this has only + a passing relationship with the actual size of the table above; + use minimal_symbol_count if you need the true size. */ + int n_minsyms; + /* This is true if minimal symbols have already been read. Symbol readers can use this to bypass minimal symbol reading. Also, the minimal symbol table management code in minsyms.c uses this to 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)); |