Index: psymtab.c =================================================================== RCS file: /cvs/src/src/gdb/psymtab.c,v retrieving revision 1.12 diff -u -p -r1.12 psymtab.c --- psymtab.c 1 Sep 2010 21:50:26 -0000 1.12 +++ psymtab.c 7 Sep 2010 20:59:54 -0000 @@ -414,15 +414,6 @@ lookup_symbol_aux_psymtabs (struct objfi int block_index, const char *name, const domain_enum domain) { - struct partial_symtab *ps; - const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0); - - ALL_OBJFILE_PSYMTABS (objfile, ps) - { - if (!ps->readin && lookup_partial_symbol (ps, name, psymtab_index, domain)) - return PSYMTAB_TO_SYMTAB (ps); - } - return NULL; } @@ -437,6 +428,23 @@ expand_one_symtab_matching_psymtabs (str void *), void *data) { + struct partial_symtab *pst; + const int psymtab_index = (kind == GLOBAL_BLOCK ? 1 : 0); + + ALL_OBJFILE_PSYMTABS (objfile, pst) + { + if (!pst->readin + && lookup_partial_symbol (pst, name, psymtab_index, domain) != NULL) + { + struct symtab *symtab = PSYMTAB_TO_SYMTAB (pst); + struct symbol *sym; + + sym = matcher (symtab, kind, name, domain, data); + if (sym) + return sym; + } + } + return NULL; } Index: symtab.c =================================================================== RCS file: /cvs/src/src/gdb/symtab.c,v retrieving revision 1.252 diff -u -p -r1.252 symtab.c --- symtab.c 1 Sep 2010 21:50:26 -0000 1.252 +++ symtab.c 7 Sep 2010 20:59:55 -0000 @@ -759,6 +759,32 @@ symbol_search_name (const struct general return symbol_natural_name (gsymbol); } +/* Returns the name used to search psymtabs. The caller is responsible for + freeing the return result. */ + +static const char * +psymtab_search_name (const char *name) +{ + switch (current_language->la_language) + { + case language_cplus: + case language_java: + { + if (strchr (name, '(')) + { + char *ret = cp_remove_params (name); + if (ret) + return ret; + } + } + + default: + break; + } + + return xstrdup (name); +} + /* Initialize the structure fields to zero values. */ void init_sal (struct symtab_and_line *sal) @@ -1409,7 +1435,13 @@ lookup_symbol_aux_symtabs (int block_ind struct blockvector *bv; const struct block *block; struct symtab *s; + const char *psym_search_name; + struct cleanup *cleanup; + + psym_search_name = psymtab_search_name (name); + cleanup = make_cleanup (xfree, (void *) psym_search_name); + sym = NULL; ALL_OBJFILES (objfile) { ALL_OBJFILE_SYMTABS (objfile, s) @@ -1421,7 +1453,8 @@ lookup_symbol_aux_symtabs (int block_ind if (sym) { block_found = block; - return fixup_symbol_section (sym, objfile); + sym = fixup_symbol_section (sym, objfile); + goto done; } } @@ -1429,15 +1462,18 @@ lookup_symbol_aux_symtabs (int block_ind { sym = objfile->sf->qf->expand_one_symtab_matching (objfile, block_index, - name, domain, + psym_search_name, + domain, match_symbol_aux, objfile); if (sym) - return sym; + goto done; } } - return NULL; + done: + do_cleanups (cleanup); + return sym; } /* A helper function for lookup_symbol_aux that interfaces with the @@ -1671,7 +1707,7 @@ match_transparent_type (struct symtab *s struct symbol *sym; bv = BLOCKVECTOR (symtab); - block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); + block = BLOCKVECTOR_BLOCK (bv, kind); sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) return sym; @@ -1694,13 +1730,19 @@ basic_lookup_transparent_type (const cha struct blockvector *bv; struct objfile *objfile; struct block *block; - struct type *t; + struct type *type; + const char *psym_search_name; + struct cleanup *cleanup; /* Now search all the global symbols. Do the symtab's first, then check the psymtab's. If a psymtab indicates the existence of the desired name as a global, then do psymtab-to-symtab conversion on the fly and return the found symbol. */ + psym_search_name = psymtab_search_name (name); + cleanup = make_cleanup (xfree, (void *) psym_search_name); + + type = NULL; ALL_OBJFILES (objfile) { ALL_OBJFILE_SYMTABS (objfile, s) @@ -1711,7 +1753,8 @@ basic_lookup_transparent_type (const cha sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) { - return SYMBOL_TYPE (sym); + type = SYMBOL_TYPE (sym); + goto done; } } @@ -1719,20 +1762,24 @@ basic_lookup_transparent_type (const cha { sym = objfile->sf->qf->expand_one_symtab_matching (objfile, - GLOBAL_BLOCK, name, + GLOBAL_BLOCK, + psym_search_name, STRUCT_DOMAIN, match_transparent_type, NULL); if (sym) - return SYMBOL_TYPE (sym); + { + type = SYMBOL_TYPE (sym); + goto done; + } } } ALL_OBJFILES (objfile) { - t = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name); - if (t) - return t; + type = basic_lookup_transparent_type_quick (objfile, GLOBAL_BLOCK, name); + if (type) + goto done; } /* Now search the static file-level symbols. @@ -1752,7 +1799,8 @@ basic_lookup_transparent_type (const cha sym = lookup_block_symbol (block, name, STRUCT_DOMAIN); if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym))) { - return SYMBOL_TYPE (sym); + type = SYMBOL_TYPE (sym); + goto done; } } @@ -1760,23 +1808,29 @@ basic_lookup_transparent_type (const cha { sym = objfile->sf->qf->expand_one_symtab_matching (objfile, - STATIC_BLOCK, name, + STATIC_BLOCK, + psym_search_name, STRUCT_DOMAIN, match_transparent_type, NULL); if (sym) - return SYMBOL_TYPE (sym); + { + type = SYMBOL_TYPE (sym); + goto done; + } } } ALL_OBJFILES (objfile) { - t = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name); - if (t) - return t; + type = basic_lookup_transparent_type_quick (objfile, STATIC_BLOCK, name); + if (type) + goto done; } - return (struct type *) 0; + done: + do_cleanups (cleanup); + return type; }