Introduce repeat_operation

This adds class repeat_operation, which implements BINOP_REPEAT.

gdb/ChangeLog
2021-03-08  Tom Tromey  <tom@tromey.com>

	* expop.h (class repeat_operation): New.
	* eval.c (eval_op_repeat): No longer static.  Remove "op"
	parameter.
	(evaluate_subexp_standard): Update.
	* ax-gdb.c (repeat_operation::do_generate_ax): New method.
This commit is contained in:
Tom Tromey
2021-03-08 07:27:57 -07:00
parent 46916f2bcb
commit d4eff4c122
4 changed files with 81 additions and 3 deletions

View File

@@ -135,6 +135,11 @@ extern struct value *eval_op_leq (struct type *expect_type,
enum noside noside, enum exp_opcode op,
struct value *arg1,
struct value *arg2);
extern struct value *eval_op_repeat (struct type *expect_type,
struct expression *exp,
enum noside noside, enum exp_opcode op,
struct value *arg1,
struct value *arg2);
namespace expr
{
@@ -1188,6 +1193,21 @@ using gtr_operation = comparison_operation<BINOP_GTR, eval_op_gtr>;
using geq_operation = comparison_operation<BINOP_GEQ, eval_op_geq>;
using leq_operation = comparison_operation<BINOP_LEQ, eval_op_leq>;
/* Implement the GDB '@' repeat operator. */
class repeat_operation
: public binop_operation<BINOP_REPEAT, eval_op_repeat>
{
using binop_operation<BINOP_REPEAT, eval_op_repeat>::binop_operation;
protected:
void do_generate_ax (struct expression *exp,
struct agent_expr *ax,
struct axs_value *value,
struct type *cast_type)
override;
};
} /* namespace expr */
#endif /* EXPOP_H */