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:15 -0700
commitd336c29e3f1b9adc314fcf44af38fb1d2b65b5e6 (patch)
treee76b05efc4d4dd1e609922133b17f499f9c8bed6 /gdb/expop.h
parentd5ab122c48fec1eb617598c02c6efdf9ba1ee23f (diff)
downloadgdb-d336c29e3f1b9adc314fcf44af38fb1d2b65b5e6.zip
gdb-d336c29e3f1b9adc314fcf44af38fb1d2b65b5e6.tar.gz
gdb-d336c29e3f1b9adc314fcf44af38fb1d2b65b5e6.tar.bz2
Introduce long_const_operation
This adds class long_const_operation, which holds a scalar constant. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class long_const_operation): New. * ax-gdb.c (long_const_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 cd1a161..ed883be 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -451,6 +451,36 @@ protected:
override;
};
+class long_const_operation
+ : public tuple_holding_operation<struct type *, LONGEST>
+{
+public:
+
+ using tuple_holding_operation::tuple_holding_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ return value_from_longest (std::get<0> (m_storage),
+ std::get<1> (m_storage));
+ }
+
+ enum exp_opcode opcode () const override
+ { return OP_LONG; }
+
+ bool constant_p () const override
+ { return true; }
+
+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 */