If ThreadPlanCallFunction hasn't set its notion of the "real stop info" yet, just return the current PrivateStopInfo.

Also renamed a few more places where we were using StopReason in functions that were returning StopInfo's.

<rdar://problem/14042692>

llvm-svn: 183177
This commit is contained in:
Jim Ingham 2013-06-04 01:40:51 +00:00
parent 19978553d4
commit 60c4118c88
11 changed files with 29 additions and 20 deletions

View File

@ -544,11 +544,11 @@ protected:
return m_thread.GetPreviousPlan (this);
}
// This forwards the private Thread::GetPrivateStopReason which is generally what
// This forwards the private Thread::GetPrivateStopInfo which is generally what
// ThreadPlan's need to know.
lldb::StopInfoSP
GetPrivateStopReason()
GetPrivateStopInfo()
{
return m_thread.GetPrivateStopInfo ();
}

View File

@ -115,12 +115,17 @@ public:
// If the thread plan stops mid-course, this will be the stop reason that interrupted us.
// Once DoTakedown is called, this will be the real stop reason at the end of the function call.
// If it hasn't been set for one or the other of these reasons, we'll return the PrivateStopReason.
// This is needed because we want the CallFunction thread plans not to show up as the stop reason.
// But if something bad goes wrong, it is nice to be able to tell the user what really happened.
virtual lldb::StopInfoSP
GetRealStopInfo()
{
return m_real_stop_info_sp;
if (m_real_stop_info_sp)
return m_real_stop_info_sp;
else
return GetPrivateStopInfo ();
}
lldb::addr_t

View File

@ -102,10 +102,10 @@ ThreadPlanBase::ShouldStop (Event *event_ptr)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
if (stop_info_sp)
{
StopReason reason = stop_info_sp->GetStopReason();
StopReason reason = stop_info_sp->GetStopReason ();
switch (reason)
{
case eStopReasonInvalid:

View File

@ -298,7 +298,7 @@ ThreadPlanCallFunction::DoTakedown (bool success)
log->Printf ("ThreadPlanCallFunction(%p): DoTakedown called for thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", this, m_thread.GetID(), m_valid, IsPlanComplete());
m_takedown_done = true;
m_stop_address = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
m_real_stop_info_sp = GetPrivateStopReason();
m_real_stop_info_sp = GetPrivateStopInfo ();
m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state);
SetPlanComplete(success);
ClearBreakpoints();
@ -365,7 +365,7 @@ bool
ThreadPlanCallFunction::DoPlanExplainsStop (Event *event_ptr)
{
Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP|LIBLLDB_LOG_PROCESS));
m_real_stop_info_sp = GetPrivateStopReason();
m_real_stop_info_sp = GetPrivateStopInfo ();
// If our subplan knows why we stopped, even if it's done (which would forward the question to us)
// we answer yes.
@ -584,7 +584,7 @@ ThreadPlanCallFunction::ClearBreakpoints ()
bool
ThreadPlanCallFunction::BreakpointsExplainStop()
{
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
if ((m_cxx_language_runtime &&
m_cxx_language_runtime->ExceptionBreakpointsExplainStop(stop_info_sp))

View File

@ -67,12 +67,16 @@ StopInfoSP
ThreadPlanCallUserExpression::GetRealStopInfo()
{
StopInfoSP stop_info_sp = ThreadPlanCallFunction::GetRealStopInfo();
lldb::addr_t addr = GetStopAddress();
DynamicCheckerFunctions *checkers = m_thread.GetProcess()->GetDynamicCheckers();
StreamString s;
if (checkers && checkers->DoCheckersExplainStop(addr, s))
stop_info_sp->SetDescription(s.GetData());
if (stop_info_sp)
{
lldb::addr_t addr = GetStopAddress();
DynamicCheckerFunctions *checkers = m_thread.GetProcess()->GetDynamicCheckers();
StreamString s;
if (checkers && checkers->DoCheckersExplainStop(addr, s))
stop_info_sp->SetDescription(s.GetData());
}
return stop_info_sp;
}

View File

@ -403,7 +403,7 @@ ThreadPlanStepInRange::DoPlanExplainsStop (Event *event_ptr)
}
else
{
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
if (stop_info_sp)
{
StopReason reason = stop_info_sp->GetStopReason();

View File

@ -83,7 +83,7 @@ ThreadPlanStepInstruction::ValidatePlan (Stream *error)
bool
ThreadPlanStepInstruction::DoPlanExplainsStop (Event *event_ptr)
{
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
if (stop_info_sp)
{
StopReason reason = stop_info_sp->GetStopReason();

View File

@ -200,7 +200,7 @@ ThreadPlanStepOut::DoPlanExplainsStop (Event *event_ptr)
// We don't explain signals or breakpoints (breakpoints that handle stepping in or
// out will be handled by a child plan.
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
if (stop_info_sp)
{
StopReason reason = stop_info_sp->GetStopReason();

View File

@ -61,7 +61,7 @@ ThreadPlanStepOverBreakpoint::ValidatePlan (Stream *error)
bool
ThreadPlanStepOverBreakpoint::DoPlanExplainsStop (Event *event_ptr)
{
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
if (stop_info_sp)
{
StopReason reason = stop_info_sp->GetStopReason();

View File

@ -300,7 +300,7 @@ ThreadPlanStepOverRange::DoPlanExplainsStop (Event *event_ptr)
// unexplained breakpoint/crash.
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
bool return_value;
if (stop_info_sp)

View File

@ -176,7 +176,7 @@ ThreadPlanStepUntil::AnalyzeStop()
if (m_ran_analyze)
return;
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
m_should_stop = true;
m_explains_stop = false;
@ -320,7 +320,7 @@ ThreadPlanStepUntil::ShouldStop (Event *event_ptr)
// do so here. Otherwise, as long as this thread has stopped for a reason,
// we will stop.
StopInfoSP stop_info_sp = GetPrivateStopReason();
StopInfoSP stop_info_sp = GetPrivateStopInfo ();
if (!stop_info_sp || stop_info_sp->GetStopReason() == eStopReasonNone)
return false;