2010-06-09 00:52:24 +08:00
|
|
|
//===-- ThreadPlanShouldStopHere.cpp ----------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-12-03 09:52:59 +08:00
|
|
|
#include "lldb/Target/RegisterContext.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
#include "lldb/Target/ThreadPlanShouldStopHere.h"
|
2011-12-03 09:52:59 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// ThreadPlanShouldStopHere constructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
ThreadPlanShouldStopHere::ThreadPlanShouldStopHere(ThreadPlan *owner, ThreadPlanShouldStopHereCallback callback, void *baton) :
|
|
|
|
m_callback (callback),
|
|
|
|
m_baton (baton),
|
|
|
|
m_owner (owner),
|
|
|
|
m_flags (ThreadPlanShouldStopHere::eNone)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Destructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
ThreadPlanShouldStopHere::~ThreadPlanShouldStopHere()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ThreadPlanShouldStopHere::SetShouldStopHereCallback (ThreadPlanShouldStopHereCallback callback, void *baton)
|
|
|
|
{
|
|
|
|
m_callback = callback;
|
|
|
|
m_baton = baton;
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadPlan *
|
|
|
|
ThreadPlanShouldStopHere::InvokeShouldStopHereCallback ()
|
|
|
|
{
|
|
|
|
if (m_callback)
|
2011-12-03 09:52:59 +08:00
|
|
|
{
|
|
|
|
ThreadPlan *return_plan = m_callback (m_owner, m_flags, m_baton);
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
lldb::addr_t current_addr = m_owner->GetThread().GetRegisterContext()->GetPC(0);
|
|
|
|
|
|
|
|
if (return_plan)
|
|
|
|
{
|
|
|
|
StreamString s;
|
|
|
|
return_plan->GetDescription (&s, lldb::eDescriptionLevelFull);
|
2012-11-30 05:49:15 +08:00
|
|
|
log->Printf ("ShouldStopHere callback found a step out plan from 0x%" PRIx64 ": %s.", current_addr, s.GetData());
|
2011-12-03 09:52:59 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-30 05:49:15 +08:00
|
|
|
log->Printf ("ShouldStopHere callback didn't find a step out plan from: 0x%" PRIx64 ".", current_addr);
|
2011-12-03 09:52:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return return_plan;
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
else
|
|
|
|
return NULL;
|
2011-01-26 07:55:37 +08:00
|
|
|
}
|