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

Yao Qi
2016-04-05T11:47:05Z

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'.

> + 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?

--
Yao (齐尧)