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:24 -0700
commite82a5afcedd98a2ca9c1915bef2938c77e967959 (patch)
tree3fd2cb49eba253dec29d7ae3ace902c11d831cb2 /gdb/expop.h
parentd9ad79d8800c18b70e90e9672b5085246e4fd537 (diff)
downloadgdb-e82a5afcedd98a2ca9c1915bef2938c77e967959.zip
gdb-e82a5afcedd98a2ca9c1915bef2938c77e967959.tar.gz
gdb-e82a5afcedd98a2ca9c1915bef2938c77e967959.tar.bz2
Introduce var_value_operation
This adds class var_value_operation, which implements OP_VAR_VALUE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class var_value_operation): New. * eval.c (var_value_operation::evaluate) (var_value_operation::evaluate_for_address) (var_value_operation::evaluate_with_coercion) (var_value_operation::evaluate_for_sizeof) (var_value_operation::evaluate_for_cast): New methods. * ax-gdb.c (var_value_operation::do_generate_ax): New method.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index 3ab412e..ef5b9bb 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -609,6 +609,43 @@ protected:
override;
};
+/* Compute the value of a variable. */
+class var_value_operation
+ : public maybe_constant_operation<symbol *, const block *>
+{
+public:
+
+ using maybe_constant_operation::maybe_constant_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override;
+
+ value *evaluate_with_coercion (struct expression *exp,
+ enum noside noside) override;
+
+ value *evaluate_for_sizeof (struct expression *exp, enum noside noside)
+ override;
+
+ value *evaluate_for_cast (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override;
+
+ value *evaluate_for_address (struct expression *exp, enum noside noside)
+ override;
+
+ enum exp_opcode opcode () const override
+ { return OP_VAR_VALUE; }
+
+protected:
+
+ void do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type)
+ override;
+};
+
class long_const_operation
: public tuple_holding_operation<struct type *, LONGEST>
{