diff options
author | Joel Brobecker <brobecker@gnat.com> | 2012-05-10 16:24:40 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2012-05-10 16:24:40 +0000 |
commit | 99a547d6792f51503719e01937129b94597c5a67 (patch) | |
tree | eaf163b5d17c124f62efb4a227734dd7b7854c83 /gdb/findvar.c | |
parent | 0ece64fd6fb4dcbb1cbe579fed01dcac2c19f888 (diff) | |
download | gdb-99a547d6792f51503719e01937129b94597c5a67.zip gdb-99a547d6792f51503719e01937129b94597c5a67.tar.gz gdb-99a547d6792f51503719e01937129b94597c5a67.tar.bz2 |
Search global symbols from the expression's block objfile first.
gdb/ChangeLog:
* 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.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r-- | gdb/findvar.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c index 9009e6f..ed7903c 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -562,7 +562,15 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) struct minimal_symbol *msym; struct obj_section *obj_section; - msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL); + /* 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); if (msym == NULL) error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var)); if (overlay_debugging) |