aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:25 -0700
commit821e72d77536b201b3e6b801d8f0d9c5b624ec96 (patch)
treec0cfed195b7efe6137ed0e6d25e443f9657a4112 /gdb/eval.c
parent085734dd954dd2b3da9445dc517bfdb10f9ca117 (diff)
downloadgdb-821e72d77536b201b3e6b801d8f0d9c5b624ec96.zip
gdb-821e72d77536b201b3e6b801d8f0d9c5b624ec96.tar.gz
gdb-821e72d77536b201b3e6b801d8f0d9c5b624ec96.tar.bz2
Introduce multi_subscript_operation
This adds class multi_subscript_operation, which implements MULTI_SUBSCRIPT. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class multi_subscript_operation): New. * eval.c (multi_subscript_operation::evaluate): New method.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 9196517..655e4ef 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2472,8 +2472,21 @@ objc_msgcall_operation::evaluate (struct type *expect_type,
args.size () + 3));
}
+value *
+multi_subscript_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
+{
+ value *arg1 = std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
+ std::vector<operation_up> &values = std::get<1> (m_storage);
+ value **argvec = XALLOCAVEC (struct value *, values.size ());
+ for (int ix = 0; ix < values.size (); ++ix)
+ argvec[ix] = values[ix]->evaluate_with_coercion (exp, noside);
+ return eval_multi_subscript (expect_type, exp, noside, arg1,
+ gdb::make_array_view (argvec, values.size ()));
}
+}
struct value *
evaluate_subexp_standard (struct type *expect_type,