This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]