This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch 2/2] Accelerate lookup_symbol_aux_objfile 8x
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 20 Oct 2014 23:45:00 +0200
- Subject: [patch 2/2] Accelerate lookup_symbol_aux_objfile 8x
- Authentication-results: sourceware.org; auth=none
Hi,
lookup_symbol_aux_objfile() processing is very ineffective. For each primary
symtab it searches it and also all its secondary symtabs. But that means that
secondary symtabs included in many primary symtabs get needlessly searched
many times during one lookup_symbol_aux_objfile() run.
lookup_symbol_aux_objfile does not care in which primary/secondary symtab the
symbol is found.
Jan
gdb/
2014-10-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* symtab.c (lookup_symbol_aux_objfile): Use ALL_OBJFILE_SYMTABS, inline
lookup_block_symbol.
diff --git a/gdb/symtab.c b/gdb/symtab.c
index c530d50..bc800ef 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1657,15 +1657,25 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index,
const struct block *block;
struct symtab *s;
- ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s)
+ gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK);
+
+ ALL_OBJFILE_SYMTABS (objfile, s)
{
+ struct dict_iterator dict_iter;
+
bv = BLOCKVECTOR (s);
block = BLOCKVECTOR_BLOCK (bv, block_index);
- sym = lookup_block_symbol (block, name, domain);
- if (sym)
+
+ for (sym = dict_iter_name_first (block->dict, name, &dict_iter);
+ sym != NULL;
+ sym = dict_iter_name_next (name, &dict_iter))
{
- block_found = block;
- return fixup_symbol_section (sym, objfile);
+ if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
+ SYMBOL_DOMAIN (sym), domain))
+ {
+ block_found = block;
+ return fixup_symbol_section (sym, objfile);
+ }
}
}