diff options
author | Wu Zhou <woodzltc@cn.ibm.com> | 2006-02-24 07:26:10 +0000 |
---|---|---|
committer | Wu Zhou <woodzltc@cn.ibm.com> | 2006-02-24 07:26:10 +0000 |
commit | 2a5e440cb420e37baa7e716febb0d48586e8f44b (patch) | |
tree | bf00c094d3a9129e7e15ff61bb9f12c03e67132a /gdb/f-valprint.c | |
parent | 4e219700c3a6a15522ab94b42cc8f7160df9424d (diff) | |
download | gdb-2a5e440cb420e37baa7e716febb0d48586e8f44b.zip gdb-2a5e440cb420e37baa7e716febb0d48586e8f44b.tar.gz gdb-2a5e440cb420e37baa7e716febb0d48586e8f44b.tar.bz2 |
* f-exp.y: Symbol '%' is not used as the modulus operator in
Fortran. Delete this from Fortran expression.
It is now used by Fortran 90 and later to access the member
of derived type. Add this into Fortran expression.
* f-valprint.c (f_val_print): Add code to handle TYPE_CODE_STRUCT.
Print each elements in the derived type.
* f-typeprint.c (print_equivalent_f77_float_type): Add a parameter
level into the function definition to do indented printing. And
call fprintfi_filtered instead to do indented printing.
(f_type_print_base): Replace fprintf_filtered with the indented
version (fprintfi_filtered).
(f_type_print_base): Call indented print_equivalent_f77_float_type.
(f_type_print_base): Add code to handle TYPE_CODE_STRUCT. Print
the definition of the derived type.
Diffstat (limited to 'gdb/f-valprint.c')
-rw-r--r-- | gdb/f-valprint.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index e724f76..b83597c 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -366,6 +366,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, struct type *elttype; LONGEST val; CORE_ADDR addr; + int index; CHECK_TYPEDEF (type); switch (TYPE_CODE (type)) @@ -583,6 +584,22 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, fprintf_filtered (stream, "<incomplete type>"); break; + case TYPE_CODE_STRUCT: + /* Starting from the Fortran 90 standard, Fortran supports derived + types. */ + fprintf_filtered (stream, "{ "); + for (index = 0; index < TYPE_NFIELDS (type); index++) + { + int offset = TYPE_FIELD_BITPOS (type, index) / 8; + f_val_print (TYPE_FIELD_TYPE (type, index), valaddr + offset, + embedded_offset, address, stream, + format, deref_ref, recurse, pretty); + if (index != TYPE_NFIELDS (type) - 1) + fputs_filtered (", ", stream); + } + fprintf_filtered (stream, "}"); + break; + default: error (_("Invalid F77 type code %d in symbol table."), TYPE_CODE (type)); } |