From 962d6d933651e62669808c0ba27b7b94de60ba5f Mon Sep 17 00:00:00 2001 From: David Lecomber Date: Tue, 9 Sep 2003 23:09:37 +0000 Subject: [PATCH] Reverting until I learn how to conform.. --- gdb/eval.c | 14 +++++--------- gdb/f-valprint.c | 23 ++++++++--------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/gdb/eval.c b/gdb/eval.c index 7b18723774b..914a5520704 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1666,6 +1666,10 @@ evaluate_subexp_standard (struct type *expect_type, offset_item = array_size_array[i] * offset_item + subscript_array[i]; + /* Construct a value node with the value of the offset */ + + arg2 = value_from_longest (builtin_type_f_integer, offset_item); + /* Let us now play a dirty trick: we will take arg1 which is a value node pointing to the topmost level of the multidimensional array-set and pretend @@ -1674,15 +1678,7 @@ evaluate_subexp_standard (struct type *expect_type, returns the correct type value */ VALUE_TYPE (arg1) = tmp_type; - - f77_get_dynamic_lowerbound (tmp_type, &lower); - - /* Construct a value node with the value of the offset */ - /* lower will get subtracted off in value_subscript, hence add it here */ - - arg2 = value_from_longest (builtin_type_f_integer, offset_item + lower); - - return value_subscript(arg1, arg2); + return value_ind (value_add (value_coerce_array (arg1), arg2)); } case BINOP_LOGICAL_AND: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 9d89da47b2b..f67a260d24c 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -47,8 +47,7 @@ static void f77_print_array (struct type *, char *, CORE_ADDR, enum val_prettyprint); static void f77_print_array_1 (int, int, struct type *, char *, CORE_ADDR, struct ui_file *, int, int, int, - enum val_prettyprint, - int *elts); + enum val_prettyprint); static void f77_create_arrayprint_offset_tbl (struct type *, struct ui_file *); static void f77_get_dynamic_length_of_aggregate (struct type *); @@ -272,36 +271,31 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) } } - - /* Actual function which prints out F77 arrays, Valaddr == address in the superior. Address == the address in the inferior. */ + static void f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, CORE_ADDR address, struct ui_file *stream, int format, - int deref_ref, int recurse, enum val_prettyprint pretty, - int *elts) + int deref_ref, int recurse, enum val_prettyprint pretty) { int i; if (nss != ndimensions) { - for (i = 0; i < F77_DIM_SIZE (nss) && *elts < print_max; i++) + for (i = 0; i < F77_DIM_SIZE (nss); i++) { fprintf_filtered (stream, "( "); f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type), valaddr + i * F77_DIM_OFFSET (nss), address + i * F77_DIM_OFFSET (nss), - stream, format, deref_ref, recurse, pretty, elts); + stream, format, deref_ref, recurse, pretty); fprintf_filtered (stream, ") "); } - if (*elts >= print_max && i < F77_DIM_SIZE (nss)) { - fprintf_filtered (stream, "..."); - } } else { - for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++ , (*elts)++) + for (i = 0; (i < F77_DIM_SIZE (nss) && i < print_max); i++) { val_print (TYPE_TARGET_TYPE (type), valaddr + i * F77_DIM_OFFSET (ndimensions), @@ -312,7 +306,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, char *valaddr, if (i != (F77_DIM_SIZE (nss) - 1)) fprintf_filtered (stream, ", "); - if ((( *elts) == print_max - 1) &&(i != (F77_DIM_SIZE (nss) - 1))) + if (i == print_max - 1) fprintf_filtered (stream, "..."); } } @@ -327,7 +321,6 @@ f77_print_array (struct type *type, char *valaddr, CORE_ADDR address, enum val_prettyprint pretty) { int ndimensions; - int elts = 0; ndimensions = calc_f77_array_dims (type); @@ -342,7 +335,7 @@ f77_print_array (struct type *type, char *valaddr, CORE_ADDR address, f77_create_arrayprint_offset_tbl (type, stream); f77_print_array_1 (1, ndimensions, type, valaddr, address, stream, format, - deref_ref, recurse, pretty, &elts); + deref_ref, recurse, pretty); } -- 2.30.2