From 247d935b83da28edeb0894f5425190d92a2e786a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 8 Mar 2021 07:27:57 -0700 Subject: [PATCH] Introduce last_operation This adds class last_operation, which implements OP_LAST. gdb/ChangeLog 2021-03-08 Tom Tromey * expop.h (class last_operation): New. --- gdb/ChangeLog | 4 ++++ gdb/expop.h | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6e9779e935e..b237cade176 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2021-03-08 Tom Tromey + + * expop.h (class last_operation): New. + 2021-03-08 Tom Tromey * expop.h (class func_static_var_operation): New. diff --git a/gdb/expop.h b/gdb/expop.h index 8329babd09b..73b66bf154b 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -579,6 +579,24 @@ public: { return OP_FUNC_STATIC_VAR; } }; +class last_operation + : public tuple_holding_operation +{ +public: + + using tuple_holding_operation::tuple_holding_operation; + + value *evaluate (struct type *expect_type, + struct expression *exp, + enum noside noside) override + { + return access_value_history (std::get<0> (m_storage)); + } + + enum exp_opcode opcode () const override + { return OP_LAST; } +}; + } /* namespace expr */ #endif /* EXPOP_H */ -- 2.30.2