diff options
Diffstat (limited to 'lldb/source/Target/ThreadPlanCallFunction.cpp')
-rw-r--r-- | lldb/source/Target/ThreadPlanCallFunction.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 23d114e30990..dbe26f42c9bf 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -1,4 +1,4 @@ -//===-- ThreadPlanCallFunction.cpp ------------------------------*- C++ -*-===// +//===-- ThreadPlanCallFunction.cpp ----------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -146,7 +146,7 @@ void ThreadPlanCallFunction::ReportRegisterState(const char *message) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log && log->GetVerbose()) { StreamString strm; - RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); + RegisterContext *reg_ctx = GetThread().GetRegisterContext().get(); log->PutCString(message); @@ -178,19 +178,19 @@ void ThreadPlanCallFunction::DoTakedown(bool success) { } if (!m_takedown_done) { + Thread &thread = GetThread(); if (success) { SetReturnValue(); } LLDB_LOGF(log, "ThreadPlanCallFunction(%p): DoTakedown called for thread " "0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", - static_cast<void *>(this), m_thread.GetID(), m_valid, - IsPlanComplete()); + static_cast<void *>(this), m_tid, m_valid, IsPlanComplete()); m_takedown_done = true; m_stop_address = - m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC(); + thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC(); m_real_stop_info_sp = GetPrivateStopInfo(); - if (!m_thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state)) { + if (!thread.RestoreRegisterStateFromCheckpoint(m_stored_thread_state)) { LLDB_LOGF(log, "ThreadPlanCallFunction(%p): DoTakedown failed to restore " "register state", @@ -205,8 +205,7 @@ void ThreadPlanCallFunction::DoTakedown(bool success) { LLDB_LOGF(log, "ThreadPlanCallFunction(%p): DoTakedown called as no-op for " "thread 0x%4.4" PRIx64 ", m_valid: %d complete: %d.\n", - static_cast<void *>(this), m_thread.GetID(), m_valid, - IsPlanComplete()); + static_cast<void *>(this), m_tid, m_valid, IsPlanComplete()); } } @@ -216,9 +215,8 @@ void ThreadPlanCallFunction::GetDescription(Stream *s, DescriptionLevel level) { if (level == eDescriptionLevelBrief) { s->Printf("Function call thread plan"); } else { - TargetSP target_sp(m_thread.CalculateTarget()); s->Printf("Thread plan to call 0x%" PRIx64, - m_function_addr.GetLoadAddress(target_sp.get())); + m_function_addr.GetLoadAddress(&GetTarget())); } } @@ -283,11 +281,9 @@ bool ThreadPlanCallFunction::DoPlanExplainsStop(Event *event_ptr) { // m_ignore_breakpoints. if (stop_reason == eStopReasonBreakpoint) { - ProcessSP process_sp(m_thread.CalculateProcess()); uint64_t break_site_id = m_real_stop_info_sp->GetValue(); BreakpointSiteSP bp_site_sp; - if (process_sp) - bp_site_sp = process_sp->GetBreakpointSiteList().FindByID(break_site_id); + bp_site_sp = m_process.GetBreakpointSiteList().FindByID(break_site_id); if (bp_site_sp) { uint32_t num_owners = bp_site_sp->GetNumberOfOwners(); bool is_internal = true; @@ -374,10 +370,11 @@ void ThreadPlanCallFunction::DidPush() { GetThread().SetStopInfoToNothing(); #ifndef SINGLE_STEP_EXPRESSIONS - m_subplan_sp = std::make_shared<ThreadPlanRunToAddress>( - m_thread, m_start_addr, m_stop_other_threads); + Thread &thread = GetThread(); + m_subplan_sp = std::make_shared<ThreadPlanRunToAddress>(thread, m_start_addr, + m_stop_other_threads); - m_thread.QueueThreadPlan(m_subplan_sp, false); + thread.QueueThreadPlan(m_subplan_sp, false); m_subplan_sp->SetPrivate(true); #endif } @@ -399,11 +396,10 @@ bool ThreadPlanCallFunction::MischiefManaged() { } void ThreadPlanCallFunction::SetBreakpoints() { - ProcessSP process_sp(m_thread.CalculateProcess()); - if (m_trap_exceptions && process_sp) { + if (m_trap_exceptions) { m_cxx_language_runtime = - process_sp->GetLanguageRuntime(eLanguageTypeC_plus_plus); - m_objc_language_runtime = process_sp->GetLanguageRuntime(eLanguageTypeObjC); + m_process.GetLanguageRuntime(eLanguageTypeC_plus_plus); + m_objc_language_runtime = m_process.GetLanguageRuntime(eLanguageTypeObjC); if (m_cxx_language_runtime) { m_should_clear_cxx_exception_bp = @@ -463,11 +459,10 @@ bool ThreadPlanCallFunction::RestoreThreadState() { } void ThreadPlanCallFunction::SetReturnValue() { - ProcessSP process_sp(m_thread.GetProcess()); - const ABI *abi = process_sp ? process_sp->GetABI().get() : nullptr; + const ABI *abi = m_process.GetABI().get(); if (abi && m_return_type.IsValid()) { const bool persistent = false; m_return_valobj_sp = - abi->GetReturnValueObject(m_thread, m_return_type, persistent); + abi->GetReturnValueObject(GetThread(), m_return_type, persistent); } } |