[Lldb-commits] [lldb] r161000 - /lldb/trunk/source/Target/ExecutionContext.cpp

Greg Clayton gclayton at apple.com
Mon Jul 30 15:05:39 PDT 2012


Author: gclayton
Date: Mon Jul 30 17:05:39 2012
New Revision: 161000

URL: http://llvm.org/viewvc/llvm-project?rev=161000&view=rev
Log:
Don't set the thread when adopting selected execution context entries, and use the "lldb_private::StateIsStoppedState(StateType, bool)" function to tell if the state is stopped.


Modified:
    lldb/trunk/source/Target/ExecutionContext.cpp

Modified: lldb/trunk/source/Target/ExecutionContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ExecutionContext.cpp?rev=161000&r1=160999&r2=161000&view=diff
==============================================================================
--- lldb/trunk/source/Target/ExecutionContext.cpp (original)
+++ lldb/trunk/source/Target/ExecutionContext.cpp Mon Jul 30 17:05:39 2012
@@ -8,6 +8,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/Target/ExecutionContext.h"
+
+#include "lldb/Core/State.h"
 #include "lldb/Target/ExecutionContextScope.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Process.h"
@@ -639,18 +641,22 @@
                     m_process_wp = process_sp;
                     if (process_sp)
                     {
-                        lldb::ThreadSP thread_sp (process_sp->GetThreadList().GetSelectedThread());
-                        if (!thread_sp)
-                            thread_sp = process_sp->GetThreadList().GetThreadAtIndex(0);
-                        
-                        if (thread_sp && process_sp->GetState() == lldb::eStateStopped)
+                        // Only fill in the thread and frame if our process is stopped
+                        if (StateIsStoppedState (process_sp->GetState(), true))
                         {
-                            SetThreadSP (thread_sp);
-                            lldb::StackFrameSP frame_sp (thread_sp->GetSelectedFrame());
-                            if (!frame_sp)
-                                frame_sp = thread_sp->GetStackFrameAtIndex(0);
-                            if (frame_sp)
-                                SetFrameSP (frame_sp);
+                            lldb::ThreadSP thread_sp (process_sp->GetThreadList().GetSelectedThread());
+                            if (!thread_sp)
+                                thread_sp = process_sp->GetThreadList().GetThreadAtIndex(0);
+                            
+                            if (thread_sp)
+                            {
+                                SetThreadSP (thread_sp);
+                                lldb::StackFrameSP frame_sp (thread_sp->GetSelectedFrame());
+                                if (!frame_sp)
+                                    frame_sp = thread_sp->GetStackFrameAtIndex(0);
+                                if (frame_sp)
+                                    SetFrameSP (frame_sp);
+                            }
                         }
                     }
                 }





More information about the lldb-commits mailing list