summaryrefslogtreecommitdiff
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:18 -0700
commitab0609be836ef93f6ed4c84484ec1059cfecebf4 (patch)
treebde27a09f8f0591e25c5e56d60beede5bb95a5a2 /gdb/expop.h
parent808b22cfd7e1afdcba7dea700a76401e2f68f2c6 (diff)
downloadbinutils-gdb-ab0609be836ef93f6ed4c84484ec1059cfecebf4.tar.gz
Introduce structop_ptr_operation
This adds class structop_ptr_operation, which implements STRUCTOP_PTR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class structop_ptr_operation): New. * eval.c (eval_op_structop_ptr): No longer static. Remove "op" parameter.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index 9f1625ca7f7..38f3ffb5aef 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -75,6 +75,11 @@ extern struct value *eval_op_structop_struct (struct type *expect_type,
enum noside noside,
struct value *arg1,
const char *string);
+extern struct value *eval_op_structop_ptr (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ struct value *arg1,
+ const char *string);
namespace expr
{
@@ -848,6 +853,40 @@ protected:
}
};
+class structop_ptr_operation
+ : public structop_base_operation
+{
+public:
+
+ using structop_base_operation::structop_base_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ value *val = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ return eval_op_structop_ptr (expect_type, exp, noside, val,
+ std::get<1> (m_storage).c_str ());
+ }
+
+ enum exp_opcode opcode () const override
+ { return STRUCTOP_PTR; }
+
+protected:
+
+ void do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+ override
+ {
+ gen_expr_structop (exp, STRUCTOP_PTR,
+ std::get<0> (this->m_storage).get (),
+ std::get<1> (this->m_storage).c_str (),
+ ax, value);
+ }
+};
+
} /* namespace expr */
#endif /* EXPOP_H */