From: Tom Tromey Date: Mon, 8 Mar 2021 14:27:57 +0000 (-0700) Subject: Introduce func_static_var_operation X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=176793957a9892b6632710d505873eba43b35223;p=binutils-gdb.git 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 * expop.h (class func_static_var_operation): New. * eval.c (eval_op_func_static_var): No longer static. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f35cb4babab..6e9779e935e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-03-08 Tom Tromey + + * expop.h (class func_static_var_operation): New. + * eval.c (eval_op_func_static_var): No longer static. + 2021-03-08 Tom Tromey * expop.h (class var_entry_value_operation): New. diff --git a/gdb/eval.c b/gdb/eval.c index 7645291a801..56010ee22e9 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1237,7 +1237,7 @@ eval_op_var_msym_value (struct type *expect_type, struct expression *exp, /* Helper function that implements the body of OP_FUNC_STATIC_VAR. */ -static struct value * +struct value * eval_op_func_static_var (struct type *expect_type, struct expression *exp, enum noside noside, value *func, const char *var) diff --git a/gdb/expop.h b/gdb/expop.h index 033ea0b1f0c..8329babd09b 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 +{ +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 */