aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:10:24 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:10:24 +0000
commitafc05acb8b7119cd458335298c75d1e6f3ebda7d (patch)
tree9fd116c63f0144bab48edfaa61dcf09022b7540c /gdb/eval.c
parent3e79cecf024acb3f5739ec19d6ebd331f08e80e8 (diff)
downloadgdb-afc05acb8b7119cd458335298c75d1e6f3ebda7d.zip
gdb-afc05acb8b7119cd458335298c75d1e6f3ebda7d.tar.gz
gdb-afc05acb8b7119cd458335298c75d1e6f3ebda7d.tar.bz2
* value.h (value_bitstring_subscript): New prototype.
* valarith.h (value_bitstring_subscript): New function. (value_subscript): No longer handle TYPE_CODE_BITSTRING. * eval.c (evaluate_subexp_standard): Call value_bitstring_subscript instead of value_subscript to handle TYPE_CODE_BITSTRING.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index ca36762..9400ef4 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1666,7 +1666,28 @@ evaluate_subexp_standard (struct type *expect_type,
}
else
{
- arg1 = value_subscript (arg1, arg2);
+ arg1 = coerce_ref (arg1);
+ type = check_typedef (value_type (arg1));
+
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_PTR:
+ case TYPE_CODE_ARRAY:
+ case TYPE_CODE_STRING:
+ arg1 = value_subscript (arg1, arg2);
+ break;
+
+ case TYPE_CODE_BITSTRING:
+ arg1 = value_bitstring_subscript (LA_BOOL_TYPE, arg1, arg2);
+ break;
+
+ default:
+ if (TYPE_NAME (type))
+ error (_("cannot subscript something of type `%s'"),
+ TYPE_NAME (type));
+ else
+ error (_("cannot subscript requested type"));
+ }
}
}
return (arg1);