aboutsummaryrefslogtreecommitdiff
path: root/gdb/ax-gdb.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:20 -0700
commitae64ba58b3bc5a9a023974f37515aee9862548fd (patch)
tree1e3490af3e496eaae203886c75a69649ac9bf3d5 /gdb/ax-gdb.c
parentd4eff4c122e06e913452e2039e29e8db6b15b1dd (diff)
downloadgdb-ae64ba58b3bc5a9a023974f37515aee9862548fd.zip
gdb-ae64ba58b3bc5a9a023974f37515aee9862548fd.tar.gz
gdb-ae64ba58b3bc5a9a023974f37515aee9862548fd.tar.bz2
Introduce comma_operation
This adds class comma_operation, which implements BINOP_COMMA. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * ax-gdb.c (comma_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 3328404..8d5e4ff 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2469,6 +2469,28 @@ repeat_operation::do_generate_ax (struct expression *exp,
value->type = array;
}
+void
+comma_operation::do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+{
+ /* Note that we need to be a little subtle about generating code
+ for comma. In C, we can do some optimizations here because
+ we know the left operand is only being evaluated for effect.
+ However, if the tracing kludge is in effect, then we always
+ need to evaluate the left hand side fully, so that all the
+ variables it mentions get traced. */
+ struct axs_value value1;
+ std::get<0> (m_storage)->generate_ax (exp, ax, &value1);
+ /* Don't just dispose of the left operand. We might be tracing,
+ in which case we want to emit code to trace it if it's an
+ lvalue. */
+ gen_traced_pop (ax, &value1);
+ std::get<1> (m_storage)->generate_ax (exp, ax, value);
+ /* It's the consumer's responsibility to trace the right operand. */
+}
+
}
/* This handles the middle-to-right-side of code generation for binary