From 160f78c5846c8fe774a1ccfc044d263b7b30ad9c Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Tue, 17 May 2011 01:10:11 +0000 Subject: 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 --- lldb/source/Target/Process.cpp | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'lldb/source/Target/Process.cpp') diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index f185d574536..88b813c640c 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -3498,11 +3498,40 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, 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 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, 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; } -- cgit v1.2.3