Revert "Search global symbols from the expression's block objfile first."

The search order used in this patch breaks global symbol lookups
for certain symbols when copy-relocation is used.  A slightly different
search order will be implemented later.

gdb/ChangeLog:

        Revert the following patch:
        * findvar.c (default_read_var_value): For LOC_UNRESOLVED symbols,
        try locating the symbol in the symbol's own objfile first, before
        extending the search to all objfiles.
        * symtab.c (lookup_symbol_aux_objfile): New function, extracted
        out of lookup_symbol_aux_symtabs.
        (lookup_symbol_aux_symtabs): Add new parameter "exclude_objfile".
        Replace extracted-out code by call to lookup_symbol_aux_objfile.
        Do not search EXCLUDE_OBJFILE.
        (lookup_static_symbol_aux): Update call to lookup_symbol_aux_symtabs.
        (lookup_symbol_global): Search for matches in the block's objfile
        first, before searching all other objfiles.
This commit is contained in:
Joel Brobecker
2012-06-05 13:50:40 +00:00
parent c56e7c4390
commit 67ff19f7de
3 changed files with 48 additions and 84 deletions

View File

@ -562,15 +562,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
struct minimal_symbol *msym;
struct obj_section *obj_section;
/* First, try locating the associated minimal symbol within
the same objfile. This prevents us from selecting another
symbol with the same name but located in a different objfile. */
msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL,
SYMBOL_SYMTAB (var)->objfile);
/* If the lookup failed, try expanding the search to all
objfiles. */
if (msym == NULL)
msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL);
msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL);
if (msym == NULL)
error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var));
if (overlay_debugging)