Re: [PATCH v3 2/2] [gdb/exp] Fix ignoring of incorrect namespace prefix

Tom de Vries
2026-04-15T10:12:49Z

On 4/14/26 8:26 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>
> Tom> @@ -431,7 +431,14 @@ cp_lookup_symbol_via_imports (const char *scope,
>
> I find this function and related functions pretty hard to follow, so I'm
> not really sure about the bug or the patch, but:
>
> Tom> + const char *current_scope = (block->function () != nullptr
> Tom> + ? block->scope ()
> Tom> + : nullptr /* Don't know. */);
>
> ... this line struck me as a bit weird, in that block->function() isn't
> set for all blocks inside a function, so this would mean that stepping
> into some nested block would seem to reproduce the bug again.

Hi Tom,

thanks for the review.

I've extended the test-case with the nested block scenario you describe,
and indeed the bug reproduced again. I've fixed that by checking for
"block->function_block () != nullptr" instead.

V4 submitted here (
https://sourceware.org/pipermail/gdb-patches/2026-April/226488.html ).

Thanks,
- Tom