diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2008-09-11 14:10:24 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2008-09-11 14:10:24 +0000 |
commit | afc05acb8b7119cd458335298c75d1e6f3ebda7d (patch) | |
tree | 9fd116c63f0144bab48edfaa61dcf09022b7540c /gdb/eval.c | |
parent | 3e79cecf024acb3f5739ec19d6ebd331f08e80e8 (diff) | |
download | gdb-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.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -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); |