From fa60cd10a19994e2e87d240c471f752f3b9d7042 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Sun, 21 Jan 2007 16:55:49 +0000 Subject: [PATCH] * objfiles.h (ALL_PRIMARY_SYMTABS): Define. * ada-lang.c (symtab_for_sym, ada_lookup_symbol_list) (ada_lookup_symbol): Use ALL_PRIMARY_SYMTABS. * cp-support.c (make_symbol_overload_list_qualified): Likewise. * symtab.c (lookup_symbol_aux_block, lookup_symbol_aux_symtabs) (basic_lookup_transparent_type, find_pc_sect_symtab, search_symbols) (make_symbol_completion_list): Likewise. --- gdb/ChangeLog | 11 +++++++++++ gdb/ada-lang.c | 12 ++++-------- gdb/cp-support.c | 4 ++-- gdb/objfiles.h | 8 ++++++++ gdb/symtab.c | 24 ++++++++---------------- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 66cd6c7b4e..9752b2bfea 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2007-01-21 Daniel Jacobowitz + + * objfiles.h (ALL_PRIMARY_SYMTABS): Define. + + * ada-lang.c (symtab_for_sym, ada_lookup_symbol_list) + (ada_lookup_symbol): Use ALL_PRIMARY_SYMTABS. + * cp-support.c (make_symbol_overload_list_qualified): Likewise. + * symtab.c (lookup_symbol_aux_block, lookup_symbol_aux_symtabs) + (basic_lookup_transparent_type, find_pc_sect_symtab, search_symbols) + (make_symbol_completion_list): Likewise. + 2007-01-21 Jan Kratochvil Daniel Jacobowitz diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 982a4bb94d..79a5460fa6 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4120,7 +4120,7 @@ symtab_for_sym (struct symbol *sym) struct dict_iterator iter; int j; - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { switch (SYMBOL_CLASS (sym)) { @@ -4549,11 +4549,9 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0, /* Now add symbols from all global blocks: symbol tables, minimal symbol tables, and psymtab's. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; - if (!s->primary) - continue; bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); ada_add_block_symbols (&symbol_list_obstack, block, name, namespace, @@ -4619,11 +4617,9 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0, if (num_defns_collected (&symbol_list_obstack) == 0) { - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; - if (!s->primary) - continue; bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); ada_add_block_symbols (&symbol_list_obstack, block, name, namespace, @@ -4703,7 +4699,7 @@ ada_lookup_symbol (const char *name, const struct block *block0, /* Search the list of symtabs for one which contains the address of the start of this block. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 7c3f8abd59..e694ad6aa3 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -750,7 +750,7 @@ make_symbol_overload_list_qualified (const char *func_name) /* Go through the symtabs and check the externs and statics for symbols which match. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); @@ -764,7 +764,7 @@ make_symbol_overload_list_qualified (const char *func_name) } } - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 6072348477..7b3cf0789a 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -603,6 +603,14 @@ extern void *objfile_data (struct objfile *objfile, ALL_OBJFILES (objfile) \ ALL_OBJFILE_SYMTABS (objfile, s) +/* Traverse all symtabs in all objfiles, skipping included files + (which share a blockvector with their primary symtab). */ + +#define ALL_PRIMARY_SYMTABS(objfile, s) \ + ALL_OBJFILES (objfile) \ + ALL_OBJFILE_SYMTABS (objfile, s) \ + if ((s)->primary) + /* Traverse all psymtabs in all objfiles. */ #define ALL_PSYMTABS(objfile, p) \ diff --git a/gdb/symtab.c b/gdb/symtab.c index e00edf78f0..f12834dd1c 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1269,7 +1269,7 @@ lookup_symbol_aux_block (const char *name, const char *linkage_name, { /* Search the list of symtabs for one which contains the address of the start of this block. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); @@ -1304,7 +1304,7 @@ lookup_symbol_aux_symtabs (int block_index, const struct block *block; struct symtab *s; - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, block_index); @@ -1719,7 +1719,7 @@ basic_lookup_transparent_type (const char *name) of the desired name as a global, then do psymtab-to-symtab conversion on the fly and return the found symbol. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); @@ -1767,7 +1767,7 @@ basic_lookup_transparent_type (const char *name) conversion on the fly and return the found symbol. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK); @@ -1944,7 +1944,7 @@ find_pc_sect_symtab (CORE_ADDR pc, asection *section) It also happens for objfiles that have their functions reordered. For these, the symtab we are looking for is not necessarily read in. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); @@ -2897,7 +2897,6 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], struct symtab *s; struct partial_symtab *ps; struct blockvector *bv; - struct blockvector *prev_bv = 0; struct block *b; int i = 0; struct dict_iterator iter; @@ -3079,15 +3078,9 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], } } - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { bv = BLOCKVECTOR (s); - /* Often many files share a blockvector. - Scan each blockvector only once so that - we don't get every symbol many times. - It happens that the first symtab in the list - for any given blockvector is the main file. */ - if (bv != prev_bv) for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++) { struct symbol_search *prevtail = tail; @@ -3139,7 +3132,6 @@ search_symbols (char *regexp, domain_enum kind, int nfiles, char *files[], tail = sort_search_symbols (prevtail, nfound); } } - prev_bv = bv; } /* If there are no eyes, avoid all contact. I mean, if there are @@ -3704,7 +3696,7 @@ make_symbol_completion_list (char *text, char *word) /* Go through the symtabs and check the externs and statics for symbols which match. */ - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK); @@ -3714,7 +3706,7 @@ make_symbol_completion_list (char *text, char *word) } } - ALL_SYMTABS (objfile, s) + ALL_PRIMARY_SYMTABS (objfile, s) { QUIT; b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK); -- 2.11.0