ThreadPlanStepOverRange.cpp [plain text]
#include "lldb/Target/ThreadPlanStepOverRange.h"
#include "lldb/lldb-private-log.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Target/ThreadPlanStepThrough.h"
using namespace lldb_private;
using namespace lldb;
ThreadPlanStepOverRange::ThreadPlanStepOverRange
(
Thread &thread,
const AddressRange &range,
const SymbolContext &addr_context,
lldb::RunMode stop_others,
bool okay_to_discard
) :
ThreadPlanStepRange (ThreadPlan::eKindStepOverRange, "Step range stepping over", thread, range, addr_context, stop_others)
{
SetOkayToDiscard (okay_to_discard);
}
ThreadPlanStepOverRange::~ThreadPlanStepOverRange ()
{
}
void
ThreadPlanStepOverRange::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
if (level == lldb::eDescriptionLevelBrief)
s->Printf("step over");
else
{
s->Printf ("stepping through range (stepping over functions): ");
DumpRanges(s);
}
}
bool
ThreadPlanStepOverRange::PlanExplainsStop ()
{
StopInfoSP stop_info_sp = GetPrivateStopReason();
if (stop_info_sp)
{
StopReason reason = stop_info_sp->GetStopReason();
switch (reason)
{
case eStopReasonBreakpoint:
case eStopReasonWatchpoint:
case eStopReasonSignal:
case eStopReasonException:
return false;
default:
return true;
}
}
return true;
}
bool
ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
StreamString s;
s.Address (m_thread.GetRegisterContext()->GetPC(),
m_thread.GetProcess().GetTarget().GetArchitecture().GetAddressByteSize());
log->Printf("ThreadPlanStepOverRange reached %s.", s.GetData());
}
if (InRange())
return false;
bool stop_others;
if (m_stop_others == lldb::eOnlyThisThread)
stop_others = true;
else
stop_others = false;
ThreadPlan* new_plan = NULL;
if (FrameIsOlder())
{
new_plan = m_thread.QueueThreadPlanForStepThrough (false, stop_others);
if (new_plan != NULL && log)
log->Printf("Thought I stepped out, but in fact arrived at a trampoline.");
}
else if (FrameIsYounger())
{
new_plan = m_thread.QueueThreadPlanForStepOut (false,
NULL,
true,
stop_others,
eVoteNo,
eVoteNoOpinion,
0);
}
else if (!InSymbol())
{
new_plan = m_thread.QueueThreadPlanForStepThrough (false, stop_others);
}
if (new_plan == NULL)
m_no_more_plans = true;
else
m_no_more_plans = false;
if (new_plan == NULL)
{
SetPlanComplete();
return true;
}
else
return false;
}