[Lldb-commits] [lldb] r132599 - /lldb/trunk/source/Target/Process.cpp

Greg Clayton gclayton at apple.com
Fri Jun 3 15:12:43 PDT 2011


Author: gclayton
Date: Fri Jun  3 17:12:42 2011
New Revision: 132599

URL: http://llvm.org/viewvc/llvm-project?rev=132599&view=rev
Log:
Make sure we are ok to stop in a thread plan and have no stop reason for
the thread we were running on (other thread crashed or had exceptional stop
reason).


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

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=132599&r1=132598&r2=132599&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Jun  3 17:12:42 2011
@@ -3439,49 +3439,54 @@
                 switch (stop_state)
                 {
                 case lldb::eStateStopped:
-                {
-                    // Yay, we're done.  Now make sure that our thread plan actually completed.
-                    ThreadSP thread_sp = exe_ctx.process->GetThreadList().FindThreadByIndexID (thread_idx_id);
-                    if (!thread_sp)
-                    {
-                        // Ooh, our thread has vanished.  Unlikely that this was successful execution...
-                        if (log)
-                            log->Printf ("Execution completed but our thread (index-id=%u) has vanished.", thread_idx_id);
-                        return_value = eExecutionInterrupted;
-                    }
-                    else
                     {
-                        StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
-                        StopReason stop_reason = stop_info_sp->GetStopReason();
-                        if (stop_reason == eStopReasonPlanComplete)
+                        // Yay, we're done.  Now make sure that our thread plan actually completed.
+                        ThreadSP thread_sp = exe_ctx.process->GetThreadList().FindThreadByIndexID (thread_idx_id);
+                        if (!thread_sp)
                         {
+                            // Ooh, our thread has vanished.  Unlikely that this was successful execution...
                             if (log)
-                                log->Printf ("Execution completed successfully.");
-                            // Now mark this plan as private so it doesn't get reported as the stop reason
-                            // after this point.  
-                            if (thread_plan_sp)
-                                thread_plan_sp->SetPrivate (orig_plan_private);
-                            return_value = eExecutionCompleted;
+                                log->Printf ("Execution completed but our thread (index-id=%u) has vanished.", thread_idx_id);
+                            return_value = eExecutionInterrupted;
                         }
                         else
                         {
-                            if (log)
-                                log->Printf ("Thread plan didn't successfully complete.");
-                                
-                            return_value = eExecutionInterrupted;
+                            StopInfoSP stop_info_sp (thread_sp->GetStopInfo ());
+                            StopReason stop_reason = eStopReasonInvalid;
+                            if (stop_info_sp)
+                                 stop_reason = stop_info_sp->GetStopReason();
+                            if (stop_reason == eStopReasonPlanComplete)
+                            {
+                                if (log)
+                                    log->Printf ("Execution completed successfully.");
+                                // Now mark this plan as private so it doesn't get reported as the stop reason
+                                // after this point.  
+                                if (thread_plan_sp)
+                                    thread_plan_sp->SetPrivate (orig_plan_private);
+                                return_value = eExecutionCompleted;
+                            }
+                            else
+                            {
+                                if (log)
+                                    log->Printf ("Thread plan didn't successfully complete.");
+
+                                return_value = eExecutionInterrupted;
+                            }
                         }
-                    }
-                }        
-                break;
+                    }        
+                    break;
+
                 case lldb::eStateCrashed:
                     if (log)
                         log->Printf ("Execution crashed.");
                     return_value = eExecutionInterrupted;
                     break;
+
                 case lldb::eStateRunning:
                     do_resume = false;
                     keep_going = true;
                     break;
+
                 default:
                     if (log)
                         log->Printf("Execution stopped with unexpected state: %s.", StateAsCString(stop_state));





More information about the lldb-commits mailing list