Fix the error message when an expression evaluation is interrupted by a crash/breakpoint hit to
give the reason for the interrupt. Also make sure it we don't want to unwind from the evaluation
we print something if it is interrupted.
llvm-svn: 131448
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f185d57..88b813c 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -3498,11 +3498,40 @@
switch (stop_state)
{
case lldb::eStateStopped:
- // Yay, we're done.
- if (log)
- log->Printf ("Execution completed successfully.");
- return_value = eExecutionCompleted;
- break;
+ {
+ // Yay, we're done. Now make sure that our thread plan actually completed.
+ ThreadSP thread_sp = exe_ctx.process->GetThreadList().FindThreadByIndexID (tid);
+ if (!thread_sp)
+ {
+ // Ooh, our thread has vanished. Unlikely that this was successful execution...
+ if (log)
+ log->Printf ("Execution completed but our thread has vanished.");
+ return_value = eExecutionInterrupted;
+ }
+ else
+ {
+ StopInfoSP stop_info_sp = thread_sp->GetStopInfo ();
+ StopReason 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 (true);
+ return_value = eExecutionCompleted;
+ }
+ else
+ {
+ if (log)
+ log->Printf ("Thread plan didn't successfully complete.");
+
+ return_value = eExecutionInterrupted;
+ }
+ }
+ }
+ break;
case lldb::eStateCrashed:
if (log)
log->Printf ("Execution crashed.");
@@ -3515,6 +3544,8 @@
default:
if (log)
log->Printf("Execution stopped with unexpected state: %s.", StateAsCString(stop_state));
+
+ errors.Printf ("Execution stopped with unexpected state.");
return_value = eExecutionInterrupted;
break;
}