summaryrefslogtreecommitdiff
path: root/gdb/f-valprint.c
diff options
context:
space:
mode:
authorWu Zhou <woodzltc@cn.ibm.com>2006-02-24 07:26:10 +0000
committerWu Zhou <woodzltc@cn.ibm.com>2006-02-24 07:26:10 +0000
commit7e563cfe5d6c3540600f181d79e623c6fb3e58a7 (patch)
treefedf03aba297f9a9491195e92ff3892407a2d665 /gdb/f-valprint.c
parenta532246df4f3d78df73beee2148ad65008f0d140 (diff)
downloadgdb-7e563cfe5d6c3540600f181d79e623c6fb3e58a7.tar.gz
* 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.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index e724f7665bc..b83597cf3b0 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));
}