From 8310b29b55fa6a6d33400670331d3e6506773293 Mon Sep 17 00:00:00 2001 From: Fernando Nasser Date: Thu, 30 Mar 2000 20:15:35 +0000 Subject: 2000-03-30 Fernando Nasser * wrapper.c (gdb_value_subscript, wrap_value_subscript): New functions. Safe version of value_subscript. * varobj.c (): Use gdb_value_subscript() to get an array element value. --- gdb/varobj.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gdb/varobj.c') diff --git a/gdb/varobj.c b/gdb/varobj.c index e2a2419..fd61203 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1954,7 +1954,7 @@ c_value_of_child (parent, index) struct varobj *parent; int index; { - value_ptr value, temp; + value_ptr value, temp, indval; struct type *type, *target; char *name; @@ -1969,9 +1969,15 @@ c_value_of_child (parent, index) switch (TYPE_CODE (type)) { case TYPE_CODE_ARRAY: +#if 0 + /* This breaks if the array lives in a (vector) register. */ value = value_slice (temp, index, 1); temp = value_coerce_array (value); gdb_value_ind (temp, &value); +#else + indval = value_from_longest (builtin_type_int, (LONGEST) index); + gdb_value_subscript (temp, indval, &value); +#endif break; case TYPE_CODE_STRUCT: -- cgit v1.1