Re: [PATCH V2] Improve user experience in printing Fortran derived types.

Walfred Tedeschi
2016-04-05T12:17:33Z

Yao,

Thanks for your review!

The idea is to have same look and fell as C/C++ code.
Only variables are displayed, not functions.
I based the patch in the C/C++ code, which is much younger.

Am 4/5/2016 um 1:46 PM schrieb Yao Qi:
> Walfred Tedeschi <walfred.tedeschi@intel.com> writes:
>
>> + int printed_field = 0; /* Number of fields printed. */
>> struct type *elttype;
>> CORE_ADDR addr;
>> int index;
>> @@ -375,15 +376,34 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
>> fprintf_filtered (stream, "( ");
>> for (index = 0; index < TYPE_NFIELDS (type); index++)
>> {
>> - int offset = TYPE_FIELD_BITPOS (type, index) / 8;
>> -
>> - val_print (TYPE_FIELD_TYPE (type, index), valaddr,
>> - embedded_offset + offset,
>> - address, stream, recurse + 1,
>> - original_value, options, current_language);
>
>
>> - if (index != TYPE_NFIELDS (type) - 1)
>> - fputs_filtered (", ", stream);
>> - }
>
> Why don't we continue using this code above? so that do need to add
> 'printed_field'.

We need print_field due to the code below. There we discard function
members.

>
>> + struct value *field =
>> + ((struct value *)original_value, index);
>
> A space is needed after ")".
>
>> + struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, index));
>> +
>> +
>> + if (TYPE_CODE (field_type) != TYPE_CODE_FUNC)
>> + {
>
> We didn't do this check before, why do we need this check now?
>

Here member functions, or methods of the derived type, are discarded.

Thanks and regards,
-Fred
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928