aboutsummaryrefslogtreecommitdiff
path: root/gdb/expop.h
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:16 -0700
commit55bdbff857f80da9e3464968f1ada2be3484fcf9 (patch)
tree64222256f769da20623e489abd09751792736747 /gdb/expop.h
parent247d935b83da28edeb0894f5425190d92a2e786a (diff)
downloadgdb-55bdbff857f80da9e3464968f1ada2be3484fcf9.zip
gdb-55bdbff857f80da9e3464968f1ada2be3484fcf9.tar.gz
gdb-55bdbff857f80da9e3464968f1ada2be3484fcf9.tar.bz2
Introduce register_operation
This adds class register_operation, which implements OP_REGISTER. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class register_operation): New. * eval.c (eval_op_register): No longer static. * ax-gdb.c (register_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index 73b66bf..a0e0030 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -58,6 +58,9 @@ extern struct value *eval_op_func_static_var (struct type *expect_type,
struct expression *exp,
enum noside noside,
value *func, const char *var);
+extern struct value *eval_op_register (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside, const char *name);
namespace expr
{
@@ -597,6 +600,33 @@ public:
{ return OP_LAST; }
};
+class register_operation
+ : public tuple_holding_operation<std::string>
+{
+public:
+
+ using tuple_holding_operation::tuple_holding_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ return eval_op_register (expect_type, exp, noside,
+ std::get<0> (m_storage).c_str ());
+ }
+
+ enum exp_opcode opcode () const override
+ { return OP_REGISTER; }
+
+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 */