[NativeProcessLinux] Use lambdas in DoOperation calls

Summary:
This removes a lot of boilerplate, which was needed to execute monitor operations. Previously one
needed do declare a separate class for each operation which would manually capture all needed
arguments, which was very verbose. In addition to less code, I believe this also makes the code
more readable, since now the implementation of the operation can be physically closer to the code
that invokes it.

Test Plan: Code compiles on x86, arm and mips, tests pass on x86 linux.

Reviewers: tberghammer, chaoren

Subscribers: aemerson, lldb-commits

Differential Revision: http://reviews.llvm.org/D10694

llvm-svn: 240772
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
index 1964aea..d72217e 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -63,28 +63,8 @@
         /// one that spawned or attached to the process from the start.  Therefore, when
         /// a NativeProcessLinux is asked to deliver or change the state of an inferior
         /// process the operation must be "funneled" to a specific thread to perform the
-        /// task.  The Operation class provides an abstract base for all services the
-        /// NativeProcessLinux must perform via the single virtual function Execute, thus
-        /// encapsulating the code that needs to run in the privileged context.
-        class Operation
-        {
-        public:
-            Operation () : m_error() { }
-
-            virtual
-            ~Operation() {}
-
-            virtual void
-            Execute (NativeProcessLinux *process) = 0;
-
-            const Error &
-            GetError () const { return m_error; }
-
-        protected:
-            Error m_error;
-        };
-
-        typedef std::unique_ptr<Operation> OperationUP;
+        /// task.
+        typedef std::function<Error()> Operation;
 
         // ---------------------------------------------------------------------
         // NativeProcessProtocol Interface
@@ -159,10 +139,7 @@
         // Interface used by NativeRegisterContext-derived classes.
         // ---------------------------------------------------------------------
         Error
-        DoOperation(Operation* op);
-
-        Error
-        DoOperation(OperationUP op) { return DoOperation(op.get()); }
+        DoOperation(const Operation &op);
 
         static long
         PtraceWrapper(int req, lldb::pid_t pid, void *addr, void *data, size_t data_size, Error& error);