1 //===-- ThreadPlanShouldStopHere.cpp ----------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Target/RegisterContext.h"
11 #include "lldb/Target/Thread.h"
12 #include "lldb/Target/ThreadPlanShouldStopHere.h"
13 #include "lldb/Core/Log.h"
16 using namespace lldb_private;
20 // Other libraries and framework includes
23 //----------------------------------------------------------------------
24 // ThreadPlanShouldStopHere constructor
25 //----------------------------------------------------------------------
26 ThreadPlanShouldStopHere::ThreadPlanShouldStopHere(ThreadPlan *owner, ThreadPlanShouldStopHereCallback callback, void *baton) :
27 m_callback (callback),
30 m_flags (ThreadPlanShouldStopHere::eNone)
34 //----------------------------------------------------------------------
36 //----------------------------------------------------------------------
37 ThreadPlanShouldStopHere::~ThreadPlanShouldStopHere()
42 ThreadPlanShouldStopHere::SetShouldStopHereCallback (ThreadPlanShouldStopHereCallback callback, void *baton)
44 m_callback = callback;
49 ThreadPlanShouldStopHere::InvokeShouldStopHereCallback ()
53 ThreadPlanSP return_plan_sp(m_callback (m_owner, m_flags, m_baton));
54 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
57 lldb::addr_t current_addr = m_owner->GetThread().GetRegisterContext()->GetPC(0);
62 return_plan_sp->GetDescription (&s, lldb::eDescriptionLevelFull);
63 log->Printf ("ShouldStopHere callback found a step out plan from 0x%" PRIx64 ": %s.", current_addr, s.GetData());
67 log->Printf ("ShouldStopHere callback didn't find a step out plan from: 0x%" PRIx64 ".", current_addr);
70 return return_plan_sp;
73 return ThreadPlanSP();