Add an API to remove an action from the Process PreResumeActions.
authorJim Ingham <jingham@apple.com>
Thu, 20 Oct 2016 22:50:00 +0000 (22:50 +0000)
committerJim Ingham <jingham@apple.com>
Thu, 20 Oct 2016 22:50:00 +0000 (22:50 +0000)
llvm-svn: 284792

lldb/include/lldb/Target/Process.h
lldb/source/Target/Process.cpp

index 908438c..737304d 100644 (file)
@@ -2608,6 +2608,8 @@ public:
   bool RunPreResumeActions();
 
   void ClearPreResumeActions();
+  
+  void ClearPreResumeAction(PreResumeActionCallback callback, void *baton);
 
   ProcessRunLock &GetRunLock();
 
@@ -2942,6 +2944,9 @@ protected:
     PreResumeCallbackAndBaton(PreResumeActionCallback in_callback,
                               void *in_baton)
         : callback(in_callback), baton(in_baton) {}
+    bool operator== (const PreResumeCallbackAndBaton &rhs) {
+      return callback == rhs.callback && baton == rhs.baton;
+    }
   };
 
   using StructuredDataPluginMap =
index b539ea3..a87ab4d 100644 (file)
@@ -5860,6 +5860,16 @@ bool Process::RunPreResumeActions() {
 
 void Process::ClearPreResumeActions() { m_pre_resume_actions.clear(); }
 
+void Process::ClearPreResumeAction(PreResumeActionCallback callback, void *baton)
+{
+    PreResumeCallbackAndBaton element(callback, baton);
+    auto found_iter = std::find(m_pre_resume_actions.begin(), m_pre_resume_actions.end(), element);
+    if (found_iter != m_pre_resume_actions.end())
+    {
+        m_pre_resume_actions.erase(found_iter);
+    }
+}
+
 ProcessRunLock &Process::GetRunLock() {
   if (m_private_state_thread.EqualsThread(Host::GetCurrentThread()))
     return m_private_run_lock;