This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 4/8] Search global block from basic_lookup_symbol_nonlocal
On Tue, Aug 27, 2019 at 4:54 AM Andrew Burgess
<andrew.burgess@embecosm.com> wrote:
> @@ -2662,6 +2646,22 @@ lookup_global_symbol (const char *name,
> if (objfile != NULL)
> result = solib_global_lookup (objfile, name, domain);
>
> + /* If a block was passed in, we want to search the corresponding
> + global block first. This yields "more expected" behavior, and is
> + needed to support 'FILENAME'::VARIABLE lookups. */
> + const struct block *global_block = block_global_block (block);
> + if (global_block != nullptr)
> + {
> + result.symbol = lookup_symbol_in_block (name,
> + symbol_name_match_type::FULL,
> + global_block, domain);
> + if (result.symbol != nullptr)
> + {
> + result.block = global_block;
> + return result;
> + }
> + }
> +
> /* If that didn't work go a global search (of global blocks, heh). */
> if (result.symbol == NULL)
> {
I like this change but shouldn't this call happen before solib_global_lookup?
(That said, I would like to remove that function...
https://patches-gcc.linaro.org/patch/21673/)
Christian