Re: [PATCH v2 10/28] Have expand_symtabs_matching work for already-expanded CUs

Tom Tromey
2025-04-23T20:40:18Z

>> This changes the contract of expand_symtabs_matching to also call the
>> callback for an already-expanded symtab. With this change, the number
>> of searched symtabs should sometimes be reduced. This also cuts down
>> on the amount of redundant code.

Simon> Not particularly important, but I'm not sure I understand how this patch
Simon> alone would result in fewer symtabs being searched. I understand that
Simon> it's a step towards the ultimate goal of this series, but I suppose you
Simon> need the changes to the symbol lookup functions (that come later in this
Simon> series) to reduce the number of searched symtabs?

Yeah. I added some text to the commit message here.

>> + /* We always need the file names filled in so that
>> + expand_symtabs_matching can match filenames. It's convenient to
>> + do this here. */
>> + if (!this_cu->files_read)
>> + dw2_get_file_names_reader (reader.cu (), reader.top_level_die ());

Simon> In other spots, this is initialized lazily when something calls
Simon> dw2_get_file_names. Why would it not work with expand_symtabs_matching?

It's been a long time since I wrote this but my recollection is that if
the CU is already expanded, then this is never done.

I will take another look.

Tom