diff options
author | Joel Brobecker <brobecker@adacore.com> | 2015-02-02 07:28:12 +0400 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2015-02-02 07:36:58 +0400 |
commit | b9f28929592990231bdce7b44369afc184a55f5d (patch) | |
tree | 548bb565cd994752b0f8443b1c3ed49480a7607b | |
parent | [Ada] pspace_data->sym_cache is always NULL (diff) | |
download | binutils-gdb-b9f28929592990231bdce7b44369afc184a55f5d.tar.gz binutils-gdb-b9f28929592990231bdce7b44369afc184a55f5d.tar.bz2 binutils-gdb-b9f28929592990231bdce7b44369afc184a55f5d.zip |
[Ada] Do not re-cache symbol-lookup result found from cache lookup.
When ada-lang.c:ada_lookup_symbol_list_worker finds a match in
the symbol cache, it caches the result again, which is unecessary.
This patch fixes the code to avoid that.
gdb/ChangeLog:
PR gdb/17856:
* ada-lang.c (ada_lookup_symbol_list_worker): Do not re-cache
results found in the cache.
Tested on x86_64-linux, no regression.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-lang.c | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2434e2f87c7..d40e1e0e244 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2015-02-02 Joel Brobecker <brobecker@adacore.com> + PR gdb/17856: + * ada-lang.c (ada_lookup_symbol_list_worker): Do not re-cache + results found in the cache. + +2015-02-02 Joel Brobecker <brobecker@adacore.com> + PR gdb/17854: * ada-lang.c (ada_get_symbol_cache): Set pspace_data->sym_cache when allocating a new one. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2dc541937d3..a62a0496d54 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -5401,14 +5401,12 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0, const struct block *block; const char *name; const int wild_match_p = should_use_wild_match (name0); - int cacheIfUnique; + int syms_from_global_search = 0; int ndefns; obstack_free (&symbol_list_obstack, NULL); obstack_init (&symbol_list_obstack); - cacheIfUnique = 0; - /* Search specified block and its superiors. */ name = name0; @@ -5452,7 +5450,6 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0, already performed this search before. If we have, then return the same result. */ - cacheIfUnique = 1; if (lookup_cached_symbol (name0, namespace, &sym, &block)) { if (sym != NULL) @@ -5460,6 +5457,8 @@ ada_lookup_symbol_list_worker (const char *name0, const struct block *block0, goto done; } + syms_from_global_search = 1; + /* Search symbols from all global blocks. */ add_nonlocal_symbols (&symbol_list_obstack, name, namespace, 1, @@ -5478,10 +5477,10 @@ done: ndefns = remove_extra_symbols (*results, ndefns); - if (ndefns == 0 && full_search) + if (ndefns == 0 && full_search && syms_from_global_search) cache_symbol (name0, namespace, NULL, NULL); - if (ndefns == 1 && full_search && cacheIfUnique) + if (ndefns == 1 && full_search && syms_from_global_search) cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block); ndefns = remove_irrelevant_renamings (*results, ndefns, block0); |