Re: possible fix for PR symtab/23010

Tom Tromey
2018-05-17T16:19:41Z

>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:

Keith> This patch looks reasonable to me, but I would ask you to consider
Keith> mentioning why partial_units are skipped where they are (even if to
Keith> just reference the problem or bug?). That's these two hunks, I think:

>> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
>> index e3f544a6a4..406aa0d52e 100644
>> --- a/gdb/dwarf2read.c
>> +++ b/gdb/dwarf2read.c
>> @@ -2870,7 +2870,7 @@ dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu)
>> : (per_cu->v.psymtab == NULL || !per_cu->v.psymtab->readin))
>> {
>> queue_comp_unit (per_cu, language_minimal);
>> - load_cu (per_cu);
>> + load_cu (per_cu, true);
>>
>> /* If we just loaded a CU from a DWO, and we're working with an index
>> that may badly handle TUs, load all the TUs in that DWO as well.

This use of "true" actually seems weird to me on re-reading.
dw2_do_instantiate_symtab doesn't actually use the skip_partial
parameter I added.

So, I changed this to pass skip_partial to load_cu.
I verified that the -readnow test on libwebkit2gtk still works.

>> @@ -4144,7 +4144,7 @@ dw2_expand_all_symtabs (struct objfile *objfile)
>> {
>> dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i);
>>
>> - dw2_instantiate_symtab (per_cu);
>> + dw2_instantiate_symtab (per_cu, true);
>> }
>> }
>>

Here I added this comment:

/* We don't want to directly expand a partial CU, because if we
read it with the wrong language, then assertion failures can
be triggered later on. See PR symtab/23010. So, tell
dw2_instantiate_symtab to skip partial CUs -- any important
partial CU will be read via DW_TAG_imported_unit anyway. */

I looked at your test case a bit but I also couldn't make it fail.

I'm pushing this patch in now.

Tom