summaryrefslogtreecommitdiff
path: root/source/Target/ThreadPlanStepOut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Target/ThreadPlanStepOut.cpp')
-rw-r--r--source/Target/ThreadPlanStepOut.cpp79
1 files changed, 26 insertions, 53 deletions
diff --git a/source/Target/ThreadPlanStepOut.cpp b/source/Target/ThreadPlanStepOut.cpp
index 8b702a20ccd2..92403cb92ed3 100644
--- a/source/Target/ThreadPlanStepOut.cpp
+++ b/source/Target/ThreadPlanStepOut.cpp
@@ -7,12 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Target/ThreadPlanStepOut.h"
-
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Value.h"
@@ -53,7 +52,7 @@ ThreadPlanStepOut::ThreadPlanStepOut
m_return_bp_id (LLDB_INVALID_BREAK_ID),
m_return_addr (LLDB_INVALID_ADDRESS),
m_stop_others (stop_others),
- m_immediate_step_from_function(NULL)
+ m_immediate_step_from_function(nullptr)
{
SetFlagsToDefault();
SetupAvoidNoDebug(step_out_avoids_code_without_debug_info);
@@ -80,14 +79,14 @@ ThreadPlanStepOut::ThreadPlanStepOut
{
// First queue a plan that gets us to this inlined frame, and when we get there we'll queue a second
// plan that walks us out of this frame.
- m_step_out_to_inline_plan_sp.reset (new ThreadPlanStepOut(m_thread,
- NULL,
- false,
- stop_others,
- eVoteNoOpinion,
- eVoteNoOpinion,
- frame_idx - 1,
- eLazyBoolNo));
+ m_step_out_to_inline_plan_sp.reset(new ThreadPlanStepOut(m_thread,
+ nullptr,
+ false,
+ stop_others,
+ eVoteNoOpinion,
+ eVoteNoOpinion,
+ frame_idx - 1,
+ eLazyBoolNo));
static_cast<ThreadPlanStepOut *>(m_step_out_to_inline_plan_sp.get())->SetShouldStopHereCallbacks(nullptr, nullptr);
m_step_out_to_inline_plan_sp->SetPrivate(true);
}
@@ -96,7 +95,6 @@ ThreadPlanStepOut::ThreadPlanStepOut
// If we're already at the inlined frame we're stepping through, then just do that now.
QueueInlinedStepPlan(false);
}
-
}
else if (return_frame_sp)
{
@@ -109,7 +107,7 @@ ThreadPlanStepOut::ThreadPlanStepOut
return;
Breakpoint *return_bp = m_thread.CalculateTarget()->CreateBreakpoint (m_return_addr, true, false).get();
- if (return_bp != NULL)
+ if (return_bp != nullptr)
{
return_bp->SetThreadID(m_thread.GetID());
m_return_bp_id = return_bp->GetID();
@@ -125,7 +123,6 @@ ThreadPlanStepOut::ThreadPlanStepOut
}
}
}
-
}
void
@@ -192,7 +189,7 @@ ThreadPlanStepOut::GetDescription (Stream *s, lldb::DescriptionLevel level)
// FIXME: find some useful way to present the m_return_id, since there may be multiple copies of the
// same function on the stack.
- s->Printf ("returning to frame at ");
+ s->Printf (" returning to frame at ");
if (tmp_address.SetLoadAddress (m_return_addr, &GetTarget()))
{
tmp_address.Dump(s, &GetThread(), Address::DumpStyleResolvedDescription, Address::DumpStyleLoadAddress);
@@ -231,10 +228,7 @@ ThreadPlanStepOut::DoPlanExplainsStop (Event *event_ptr)
// If the step out plan is done, then we just need to step through the inlined frame.
if (m_step_out_to_inline_plan_sp)
{
- if (m_step_out_to_inline_plan_sp->MischiefManaged())
- return true;
- else
- return false;
+ return m_step_out_to_inline_plan_sp->MischiefManaged();
}
else if (m_step_through_inline_plan_sp)
{
@@ -249,10 +243,7 @@ ThreadPlanStepOut::DoPlanExplainsStop (Event *event_ptr)
}
else if (m_step_out_further_plan_sp)
{
- if (m_step_out_further_plan_sp->MischiefManaged())
- return true;
- else
- return false;
+ return m_step_out_further_plan_sp->MischiefManaged();
}
// We don't explain signals or breakpoints (breakpoints that handle stepping in or
@@ -262,9 +253,7 @@ ThreadPlanStepOut::DoPlanExplainsStop (Event *event_ptr)
if (stop_info_sp)
{
StopReason reason = stop_info_sp->GetStopReason();
- switch (reason)
- {
- case eStopReasonBreakpoint:
+ if (reason == eStopReasonBreakpoint)
{
// If this is OUR breakpoint, we're fine, otherwise we don't know why this happened...
BreakpointSiteSP site_sp (m_thread.GetProcess()->GetBreakpointSiteList().FindByID (stop_info_sp->GetValue()));
@@ -284,10 +273,7 @@ ThreadPlanStepOut::DoPlanExplainsStop (Event *event_ptr)
}
else
{
- if (m_immediate_step_from_id < frame_zero_id)
- done = true;
- else
- done = false;
+ done = (m_immediate_step_from_id < frame_zero_id);
}
if (done)
@@ -306,20 +292,13 @@ ThreadPlanStepOut::DoPlanExplainsStop (Event *event_ptr)
if (site_sp->GetNumberOfOwners() == 1)
return true;
-
}
return false;
}
- case eStopReasonWatchpoint:
- case eStopReasonSignal:
- case eStopReasonException:
- case eStopReasonExec:
- case eStopReasonThreadExiting:
+ else if (IsUsuallyUnexplainedStopReason(reason))
return false;
-
- default:
+ else
return true;
- }
}
return true;
}
@@ -367,10 +346,7 @@ ThreadPlanStepOut::ShouldStop (Event *event_ptr)
if (!done)
{
StackID frame_zero_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
- if (frame_zero_id < m_step_out_to_id)
- done = false;
- else
- done = true;
+ done = !(frame_zero_id < m_step_out_to_id);
}
// The normal step out computations think we are done, so all we need to do is consult the ShouldStopHere,
@@ -417,7 +393,7 @@ ThreadPlanStepOut::DoWillResume (StateType resume_state, bool current_plan)
if (current_plan)
{
Breakpoint *return_bp = m_thread.CalculateTarget()->GetBreakpointByID(m_return_bp_id).get();
- if (return_bp != NULL)
+ if (return_bp != nullptr)
return_bp->SetEnabled (true);
}
return true;
@@ -429,7 +405,7 @@ ThreadPlanStepOut::WillStop ()
if (m_return_bp_id != LLDB_INVALID_BREAK_ID)
{
Breakpoint *return_bp = m_thread.CalculateTarget()->GetBreakpointByID(m_return_bp_id).get();
- if (return_bp != NULL)
+ if (return_bp != nullptr)
return_bp->SetEnabled (false);
}
@@ -539,14 +515,14 @@ ThreadPlanStepOut::CalculateReturnValue ()
if (m_return_valobj_sp)
return;
- if (m_immediate_step_from_function != NULL)
+ if (m_immediate_step_from_function != nullptr)
{
- ClangASTType return_clang_type = m_immediate_step_from_function->GetClangType().GetFunctionReturnType();
- if (return_clang_type)
+ CompilerType return_compiler_type = m_immediate_step_from_function->GetCompilerType().GetFunctionReturnType();
+ if (return_compiler_type)
{
lldb::ABISP abi_sp = m_thread.GetProcess()->GetABI();
if (abi_sp)
- m_return_valobj_sp = abi_sp->GetReturnValueObject(m_thread, return_clang_type);
+ m_return_valobj_sp = abi_sp->GetReturnValueObject(m_thread, return_compiler_type);
}
}
}
@@ -558,8 +534,5 @@ ThreadPlanStepOut::IsPlanStale()
// there's something for us to do. Otherwise, we're stale.
StackID frame_zero_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
- if (frame_zero_id < m_step_out_to_id)
- return false;
- else
- return true;
+ return !(frame_zero_id < m_step_out_to_id);
}