[Lldb-commits] [lldb] r124525 - in /lldb/trunk: include/lldb/Target/Process.h source/Target/Process.cpp

Jim Ingham jingham at apple.com
Fri Jan 28 20:05:41 PST 2011


Author: jingham
Date: Fri Jan 28 22:05:41 2011
New Revision: 124525

URL: http://llvm.org/viewvc/llvm-project?rev=124525&view=rev
Log:
The m_next_action is simpler if it is an auto_pointer.

Modified:
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=124525&r1=124524&r2=124525&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Jan 28 22:05:41 2011
@@ -1823,12 +1823,10 @@
     
     void SetNextEventAction (Process::NextEventAction *next_event_action)
     {
-        if (m_next_event_action)
-        {
-            m_next_event_action->HandleBeingUnshipped();
-            delete m_next_event_action;
-        }
-        m_next_event_action = next_event_action;
+        if (m_next_event_action_ap.get())
+            m_next_event_action_ap->HandleBeingUnshipped();
+
+        m_next_event_action_ap.reset(next_event_action);
     }
     
     // This is the completer for Attaching:
@@ -1920,7 +1918,7 @@
 
     typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP> LanguageRuntimeCollection; 
     LanguageRuntimeCollection m_language_runtimes;
-    NextEventAction          *m_next_event_action;
+    std::auto_ptr<NextEventAction>          *m_next_event_action_ap;
 
     size_t
     RemoveBreakpointOpcodesFromBuffer (lldb::addr_t addr, size_t size, uint8_t *buf) const;

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=124525&r1=124524&r2=124525&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Jan 28 22:05:41 2011
@@ -238,7 +238,7 @@
     m_stdio_communication_mutex (Mutex::eMutexTypeRecursive),
     m_stdout_data (),
     m_memory_cache (),
-    m_next_event_action(NULL)
+    m_next_event_action_ap(NULL)
 {
     UpdateInstanceName();
 
@@ -274,8 +274,6 @@
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
     if (log)
         log->Printf ("%p Process::~Process()", this);
-    if (m_next_event_action)
-        SetNextEventAction(NULL);
     StopPrivateStateThread();
 }
 
@@ -2142,9 +2140,9 @@
     const StateType new_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
     
     // First check to see if anybody wants a shot at this event:
-    if (m_next_event_action != NULL)
+    if (m_next_event_action_ap.get() != NULL)
     {
-        NextEventAction::EventActionResult action_result = m_next_event_action->PerformAction(event_sp);
+        NextEventAction::EventActionResult action_result = m_next_event_action_ap->PerformAction(event_sp);
         switch (action_result)
         {
             case NextEventAction::eEventActionSuccess:
@@ -2159,7 +2157,7 @@
                 if (new_state != eStateExited)
                 {
                     // FIXME: should cons up an exited event, and discard this one.
-                    SetExitStatus(0, m_next_event_action->GetExitString());
+                    SetExitStatus(0, m_next_event_action_ap->GetExitString());
                     SetNextEventAction(NULL);
                     return;
                 }





More information about the lldb-commits mailing list