Re: [PATCH v3 7/9] gdb: make expanded_symbols_functions hold compunit symtabs

Simon Marchi
2026-03-09T18:57:34Z

On 3/4/26 2:32 PM, Tom Tromey wrote:
> Simon> Change the expanded_symbols_functions quick functions type to hold and
> Simon> use a list of compunit symtab to search.
>
> Simon> Right now the sole user of expanded_symbols_functions is JIT. Update it
> Simon> to keep a vector of compunits as they are finalized, and pass this
> Simon> vector to the expanded_symbols_functions object.
>
> Tom> I think this is a good direction but this patch isn't quite complete.
> Tom> The issue is that there are still a handful of spots in gdb that loop
> Tom> over all compunits. But with this change, these spots will skip some
> Tom> compunits.
>
> It took me a while but I finally realized that the new vector is in
> addition to the objfile's compunits.
>
> This seems kind of ugly to me but OTOH it doesn't have the problems I
> ascribed to it.

I just saw this reponse after sending my other email.

I don't really see how it could be less ugly, given that the
expanded_symbols_functions needs to know which compunits it is
responsible for. An alternative would be for compunit_symtabs to have a
backlink to the quick_symbol_functions that is responsible for it, but
it would make iterating on all the compunits for which a
quick_symbol_functions is responsible for less efficient.

Simon