Fix inline stepping test case on Linux because Thread::ThreadStoppedForAReason ignored virtual steps.

- add IsVirtualStep() virtual function to ThreadPlan, and implement it for
  ThreadPlanStepInRange
- make GetPrivateStopReason query the current thread plan for a virtual stop to
  decide if the current stop reason needs to be preserved
- remove extra check for an existing process in GetPrivateStopReason

llvm-svn: 181795
This commit is contained in:
Daniel Malea 2013-05-14 15:20:12 +00:00
parent 61101ba419
commit 246cb61104
5 changed files with 47 additions and 27 deletions

View File

@ -895,9 +895,19 @@ public:
return !m_destroy_called;
}
// When you implement this method, make sure you don't overwrite the m_actual_stop_info if it claims to be
// valid. The stop info may be a "checkpointed and restored" stop info, so if it is still around it is right
// even if you have not calculated this yourself, or if it disagrees with what you might have calculated.
// Sets and returns a valid stop info based on the process stop ID and the
// current thread plan. If the thread stop ID does not match the process'
// stop ID, the private stop reason is not set and an invalid StopInfoSP may
// be returned.
//
// NOTE: This function must be called before the current thread plan is
// moved to the completed plan stack (in Thread::ShouldStop()).
//
// NOTE: If subclasses override this function, ensure they do not overwrite
// the m_actual_stop_info if it is valid. The stop info may be a
// "checkpointed and restored" stop info, so if it is still around it is
// right even if you have not calculated this yourself, or if it disagrees
// with what you might have calculated.
virtual lldb::StopInfoSP
GetPrivateStopInfo ();

View File

@ -516,6 +516,12 @@ public:
// Nothing to do in general.
return true;
}
virtual bool
IsVirtualStep()
{
return false;
}
protected:
//------------------------------------------------------------------

View File

@ -60,6 +60,9 @@ public:
static void
SetDefaultFlagValue (uint32_t new_value);
bool
IsVirtualStep();
protected:
virtual bool DoWillResume (lldb::StateType resume_state, bool current_plan);

View File

@ -390,32 +390,23 @@ Thread::GetPrivateStopInfo ()
ProcessSP process_sp (GetProcess());
if (process_sp)
{
ProcessSP process_sp (GetProcess());
if (process_sp)
const uint32_t process_stop_id = process_sp->GetStopID();
if (m_stop_info_stop_id != process_stop_id)
{
const uint32_t process_stop_id = process_sp->GetStopID();
if (m_stop_info_stop_id != process_stop_id)
if (m_stop_info_sp)
{
if (m_stop_info_sp)
{
if (m_stop_info_sp->IsValid())
{
SetStopInfo (m_stop_info_sp);
}
else
{
if (IsStillAtLastBreakpointHit())
SetStopInfo(m_stop_info_sp);
else
m_stop_info_sp.reset();
}
}
if (!m_stop_info_sp)
{
if (CalculateStopInfo() == false)
SetStopInfo (StopInfoSP());
}
if (m_stop_info_sp->IsValid()
|| IsStillAtLastBreakpointHit()
|| GetCurrentPlan()->IsVirtualStep())
SetStopInfo (m_stop_info_sp);
else
m_stop_info_sp.reset();
}
if (!m_stop_info_sp)
{
if (CalculateStopInfo() == false)
SetStopInfo (StopInfoSP());
}
}
}
@ -693,6 +684,10 @@ Thread::ShouldStop (Event* event_ptr)
return false;
}
// Based on the current thread plan and process stop info, check if this
// thread caused the process to stop. NOTE: this must take place before
// the plan is moved from the current plan stack to the completed plan
// stack.
if (ThreadStoppedForAReason() == false)
{
if (log)

View File

@ -463,3 +463,9 @@ ThreadPlanStepInRange::DoWillResume (lldb::StateType resume_state, bool current_
}
return true;
}
bool
ThreadPlanStepInRange::IsVirtualStep()
{
return m_virtual_step;
}