From b2e2f908b863c27abb00108a03ebe2598baec55c Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 27 May 2015 11:50:38 -0700 Subject: PR symtab/18258 gdb/ChangeLog: * block.c (block_find_symbol): New function. (block_find_non_opaque_type): Ditto. (block_find_non_opaque_type_preferred): Ditto. * block.h (block_symbol_matcher_ftype): New typedef. (block_find_symbol): Declare. (block_find_non_opaque_type): Ditto. (block_find_non_opaque_type_preferred): Ditto. * dwarf2read.c (dw2_lookup_symbol): Call block_find_symbol. * psymtab.c (psym_lookup_symbol): Ditto. * symtab.c (basic_lookup_transparent_type_1): New function. (basic_lookup_transparent_type): Call it. gdb/testsuite/ChangeLog: * gdb.dwarf2/opaque-type-lookup-2.c: New file. * gdb.dwarf2/opaque-type-lookup.c: New file. * gdb.dwarf2/opaque-type-lookup.exp: New file. --- gdb/psymtab.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'gdb/psymtab.c') diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 383e4c4..9ee6ed1 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -516,7 +516,7 @@ psym_lookup_symbol (struct objfile *objfile, if (!ps->readin && lookup_partial_symbol (objfile, ps, name, psymtab_index, domain)) { - struct symbol *sym = NULL; + struct symbol *sym, *with_opaque = NULL; struct compunit_symtab *stab = psymtab_to_symtab (objfile, ps); /* Note: While psymtab_to_symtab can return NULL if the partial symtab is empty, we can assume it won't here because lookup_partial_symbol @@ -524,18 +524,20 @@ psym_lookup_symbol (struct objfile *objfile, const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab); struct block *block = BLOCKVECTOR_BLOCK (bv, block_index); + sym = block_find_symbol (block, name, domain, + block_find_non_opaque_type_preferred, + &with_opaque); + /* Some caution must be observed with overloaded functions - and methods, since the psymtab will not contain any overload + and methods, since the index will not contain any overload information (but NAME might contain it). */ - sym = block_lookup_symbol (block, name, domain); - - if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0) - { - if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) - return stab; - stab_best = stab; - } + if (sym != NULL + && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0) + return stab; + if (with_opaque != NULL + && strcmp_iw (SYMBOL_SEARCH_NAME (with_opaque), name) == 0) + stab_best = stab; /* Keep looking through other psymtabs. */ } -- cgit v1.1