[PATCH 3 PR gdb/16959] gdb hangs in infinite recursion

Simon Marchi simon.marchi@polymtl.ca
Sat Mar 24 12:33:00 GMT 2018


On 2018-03-24 06:10, Pedro Alves wrote:
> On 03/23/2018 09:25 PM, Weimin Pan wrote:
> 
>> -  if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
>> +  struct type *real_type = check_typedef (type);
>> +  if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT)
>>      {
>>        CORE_ADDR *first_dont_print;
>>        CORE_ADDR addr;
>> @@ -658,15 +659,14 @@ cp_print_static_field (struct type *type,
>>        addr = value_address (val);
>>        obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
>>  		    sizeof (CORE_ADDR));
>> -      type = check_typedef (type);
>> -      cp_print_value_fields (type, value_enclosing_type (val),
>> +      cp_print_value_fields (real_type, value_enclosing_type (val),
> 
> This is still passing the resolved type down instead of the
> original type.

I did not point this out because cp_print_value_fields does a 
check_typedef anyway, so it doesn't change anything.  But it's true that 
to be consistent it would be better to always pass down the original 
type, and let the callee decide whether it wants to resolve the typedef 
or not.  Please consider this comment when preparing the next version.

Thanks,

Simon



More information about the Gdb-patches mailing list