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

Tom Tromey
2026-03-10T17:10:48Z

>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

>> Now, arguably some of these spots aren't really needed in the current
>> setup. For instance, objfile relocation in practice is probably not
>> needed by the current expanded-symbols users (though it seems a little
>> less future-proof to assume this).

Simon> I don't understand this. If some code wants to iterate on all compunit
Simon> symtabs of a given objfile, it would use objfile::compunits. Why would
Simon> changing expanded_symbols_functions affect that?

That note was based on a misconception. But anyway I think it would
be a better design for the 'quick' subclasses to own their own compunits.
Then it would be less possible to accidentally iterate over "other" compunits.

Generic code iterating over all compunits is often a bug.
Like, it's fine for dumping or for relocation. But searches done this
way can be susceptible to the old expansion order problems.

Tom