Re: [PATCH][PR gdb/18706] Calculate size of array of stubbed type

Simon Marchi
2020-04-29T18:26:17Z

On 2020-04-29 12:58 p.m., Hannes Domani via Gdb-patches wrote:
>> For your code to work (and it appears to work, I just want to understand),
>> it means that at some point, we changed the target of the array type to
>> point to a `struct type` that does have size information.  I'm guessing
>> using the information from the other CU.  I'm wondering when/how this happens.
>
> It happens a few lines above the array stuff:
>
>   if (TYPE_TARGET_STUB (type))
>     {
>       struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
>
> At this point, the struct has TYPE_STUB set, so check_typedef replaces the
> stub with the complete type.

Ah I see the lookup_symbol call now, thanks.

> OK, I will remove both the TYPE_NFIELDS and TYPE_CODE_RANGE checks.

Ok, thanks (although please give it a quick look and make sure you reach the
same conclusion as me).

Simon