Re: [PATCH v5 09/15] gdb, ada: update ada_lookup_simple_minsym

Tom Tromey
2022-07-18T17:02:33Z

>>>>> "Markus" == Markus Metzger via Gdb-patches <gdb-patches@sourceware.org> writes:

Markus> Iterate over objfile in search order using the objfile of the context
Markus> block as current_objfile so the iteration can stay inside the block's
Markus> linker namespace.

Markus> diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
Markus> index 8660205809a..85569b841eb 100644
Markus> --- a/gdb/ada-exp.y
Markus> +++ b/gdb/ada-exp.y
Markus> @@ -1700,8 +1700,15 @@ write_var_or_type (struct parser_state *par_state,
Markus> }
Markus> else if (syms.empty ())
Markus> {
Markus> + if (block == nullptr)
Markus> + block = get_selected_block (nullptr);

I don't think 'block' can be null here, since it's handled at the top of
the function:

if (block == NULL)
block = par_state->expression_context_block;

Tom