diff options
author | Fernando Nasser <fnasser@redhat.com> | 2000-03-30 20:15:35 +0000 |
---|---|---|
committer | Fernando Nasser <fnasser@redhat.com> | 2000-03-30 20:15:35 +0000 |
commit | 8310b29b55fa6a6d33400670331d3e6506773293 (patch) | |
tree | 32e7167635c5de4b5180eec16cd5b7b14ebfd2ee /gdb/varobj.c | |
parent | 1d1358b6679fee0ea559723c6c9b06c900e7c330 (diff) | |
download | gdb-8310b29b55fa6a6d33400670331d3e6506773293.zip gdb-8310b29b55fa6a6d33400670331d3e6506773293.tar.gz gdb-8310b29b55fa6a6d33400670331d3e6506773293.tar.bz2 |
2000-03-30 Fernando Nasser <fnasser@cygnus.com>
* 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.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r-- | gdb/varobj.c | 8 |
1 files changed, 7 insertions, 1 deletions
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: |