This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH V2] Improve user experience in printing Fortran derived types.
- From: Walfred Tedeschi <walfred dot tedeschi at intel dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 5 Apr 2016 14:17:19 +0200
- Subject: Re: [PATCH V2] Improve user experience in printing Fortran derived types.
- Authentication-results: sourceware.org; auth=none
- References: <1458296757-6795-1-git-send-email-walfred dot tedeschi at intel dot com> <86a8l8nuqk dot fsf at gmail dot com>
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 <email@example.com> writes:
+ int printed_field = 0; /* Number of fields printed. */
struct type *elttype;
@@ -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
We need print_field due to the code below. There we discard function
+ 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,
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