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
commit176793957a9892b6632710d505873eba43b35223 (patch)
treead96faa7b021392a7035206239b059ee55e9e5ee /gdb/expop.h
parentb5cc3923def975c28d44421a11bac671ede5b92c (diff)
downloadgdb-176793957a9892b6632710d505873eba43b35223.zip
gdb-176793957a9892b6632710d505873eba43b35223.tar.gz
gdb-176793957a9892b6632710d505873eba43b35223.tar.bz2
Introduce func_static_var_operation
This adds class func_static_var_operation, which implements OP_FUNC_STATIC_VAR. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class func_static_var_operation): New. * eval.c (eval_op_func_static_var): No longer static.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r--gdb/expop.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/expop.h b/gdb/expop.h
index 033ea0b..8329bab 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -54,6 +54,10 @@ extern struct value *eval_op_var_msym_value (struct type *expect_type,
extern struct value *eval_op_var_entry_value (struct type *expect_type,
struct expression *exp,
enum noside noside, symbol *sym);
+extern struct value *eval_op_func_static_var (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside,
+ value *func, const char *var);
namespace expr
{
@@ -555,6 +559,26 @@ public:
{ return OP_VAR_ENTRY_VALUE; }
};
+class func_static_var_operation
+ : public maybe_constant_operation<operation_up, std::string>
+{
+public:
+
+ using maybe_constant_operation::maybe_constant_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override
+ {
+ value *func = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
+ return eval_op_func_static_var (expect_type, exp, noside, func,
+ std::get<1> (m_storage).c_str ());
+ }
+
+ enum exp_opcode opcode () const override
+ { return OP_FUNC_STATIC_VAR; }
+};
+
} /* namespace expr */
#endif /* EXPOP_H */