* symtab.h (lookup_type_symbol): Declare.

* symtab.c (lookup_symbol_in_language_full): Rename from
	lookup_symbol_in_language.  Add 'for_type' argument.
	(lookup_symbol_in_language): New function.
	(lookup_type_symbol): Likewise.
	(lookup_symbol_aux): Add 'for_type' argument.
	(match_symbol_aux): New function.
	(lookup_symbol_aux_symtabs): Use expand_one_symtab_matching.
	(match_transparent_type): New function.
	(basic_lookup_transparent_type): Use expand_one_symtab_matching.
	* symfile.h (struct quick_symbol_functions)
	<pre_expand_symtabs_matching>: Remove.
	<expand_one_symtab_matching>: New field.
	* psymtab.c (expand_one_symtab_matching_psymtabs): New function.
	(pre_expand_symtabs_matching_psymtabs): Remove.
	(psym_functions): Update.
	* gdbtypes.c (lookup_typename): Use lookup_type_symbol.
	* dwarf2read.c (dw2_lookup_symbol): Update comment.
	(dw2_pre_expand_symtabs_matching): Remove.
	(dw2_expand_one_symtab_matching): New function.
	(dwarf2_gdb_index_functions): Update.
This commit is contained in:
Tom Tromey
2010-09-01 21:50:26 +00:00
parent 248c9dbc16
commit faf68db746
7 changed files with 241 additions and 49 deletions

View File

@@ -2198,7 +2198,7 @@ static struct symtab *
dw2_lookup_symbol (struct objfile *objfile, int block_index,
const char *name, domain_enum domain)
{
/* We do all the work in the pre_expand_symtabs_matching hook
/* We do all the work in the expand_one_symtab_matching hook
instead. */
return NULL;
}
@@ -2229,12 +2229,46 @@ dw2_do_expand_symtabs_matching (struct objfile *objfile, const char *name)
}
}
static void
dw2_pre_expand_symtabs_matching (struct objfile *objfile,
int kind, const char *name,
domain_enum domain)
static struct symbol *
dw2_expand_one_symtab_matching (struct objfile *objfile,
int kind, const char *name,
domain_enum domain,
struct symbol *(*matcher) (struct symtab *,
int,
const char *,
domain_enum,
void *),
void *data)
{
dw2_do_expand_symtabs_matching (objfile, name);
dw2_setup (objfile);
if (dwarf2_per_objfile->index_table)
{
offset_type *vec;
if (find_slot_in_mapped_hash (dwarf2_per_objfile->index_table,
name, &vec))
{
offset_type i, len = MAYBE_SWAP (*vec);
for (i = 0; i < len; ++i)
{
offset_type cu_index = MAYBE_SWAP (vec[i + 1]);
struct dwarf2_per_cu_data *cu = dw2_get_cu (cu_index);
struct symtab *symtab;
struct symbol *sym;
if (cu->v.quick->symtab)
continue;
symtab = dw2_instantiate_symtab (objfile, cu);
sym = matcher (symtab, kind, name, domain, data);
if (sym)
return sym;
}
}
}
return NULL;
}
static void
@@ -2538,7 +2572,7 @@ const struct quick_symbol_functions dwarf2_gdb_index_functions =
dw2_forget_cached_source_info,
dw2_lookup_symtab,
dw2_lookup_symbol,
dw2_pre_expand_symtabs_matching,
dw2_expand_one_symtab_matching,
dw2_print_stats,
dw2_dump,
dw2_relocate,