aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorBernhard Heckel <bernhard.heckel@intel.com>2016-04-26 16:38:19 +0200
committerBernhard Heckel <bernhard.heckel@intel.com>2016-04-26 16:38:19 +0200
commit8f07e298b16e6419a11f9e9d75b15658e42ea775 (patch)
tree0fe5a42edc4159d987214b1423591c1f9e1b054b /gdb/valarith.c
parent9920b4348edbdd83e3f91c85d7174cb92bba204d (diff)
downloadbinutils-8f07e298b16e6419a11f9e9d75b15658e42ea775.zip
binutils-8f07e298b16e6419a11f9e9d75b15658e42ea775.tar.gz
binutils-8f07e298b16e6419a11f9e9d75b15658e42ea775.tar.bz2
fort_dyn_array: Support evaluation of dynamic elements inside arrays.
Resolve type of an array's element to be printed in case it is dynamic. Otherwise we don't use the correct boundaries nor the right location. Before: ptype fivearr(1) type = Type five Type one integer(kind=4) :: ivla(34196784:34196832,34197072:34197120,34197360:34197408) End Type one :: tone End Type five After: ptype fivearr(1) type = Type five Type one integer(kind=4) :: ivla(2,4,6) End Type one :: tone End Type five 2016-04-26 Bernhard Heckel <bernhard.heckel@intel.com> gdb/Changelog: * valarith.c (value_address): Resolve dynamic types. gdb/testsuite/Changelog: * gdb.fortran/vla-type.f90: Add test for static and dynamic arrays of dynamic types. * gdb.fortran/vla-type.exp: Add test for static and dynamic arrays of dynamic types.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 7959f3b..254d998 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -207,6 +207,14 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
error (_("no such vector element"));
}
+ if (is_dynamic_type (elt_type))
+ {
+ CORE_ADDR address;
+
+ address = value_address (array) + elt_offs;
+ elt_type = resolve_dynamic_type (elt_type, NULL, address);
+ }
+
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
v = allocate_value_lazy (elt_type);
else