Introduce last_operation
authorTom Tromey <tom@tromey.com>
Mon, 8 Mar 2021 14:27:57 +0000 (07:27 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 8 Mar 2021 14:28:15 +0000 (07:28 -0700)
This adds class last_operation, which implements OP_LAST.

gdb/ChangeLog
2021-03-08  Tom Tromey  <tom@tromey.com>

* expop.h (class last_operation): New.

gdb/ChangeLog
gdb/expop.h

index 6e9779e935e3da1db2487ad648204526c29479eb..b237cade1760e486c3dba1c6b409134995d254ee 100644 (file)
@@ -1,3 +1,7 @@
+2021-03-08  Tom Tromey  <tom@tromey.com>
+
+       * expop.h (class last_operation): New.
+
 2021-03-08  Tom Tromey  <tom@tromey.com>
 
        * expop.h (class func_static_var_operation): New.
index 8329babd09bd1db4b6502dd91a53c3d78f82b07d..73b66bf154bed2c2ba96c40863055796e07f4e42 100644 (file)
@@ -579,6 +579,24 @@ public:
   { return OP_FUNC_STATIC_VAR; }
 };
 
+class last_operation
+  : public tuple_holding_operation<int>
+{
+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 */
This page took 0.028404 seconds and 4 git commands to generate.