[lldb][nfc] Split the constructor of ThreadPlanStepOut (#136160)

A subsequent commit will create a new constructor for ThreadPlanStepOut,
which needs to reuse much of the same logic of the existing constructor.
This commit places all of that reusable logic into a separate function.
This commit is contained in:
Felipe de Azevedo Piovezan
2025-04-17 12:53:25 -07:00
committed by GitHub
parent 1c35f8145a
commit 9f9c1f9381
2 changed files with 13 additions and 2 deletions

View File

@@ -82,6 +82,10 @@ private:
LazyBool step_out_avoids_code_without_debug_info);
void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
void SetupReturnAddress(lldb::StackFrameSP return_frame_sp,
lldb::StackFrameSP immediate_return_from_sp,
uint32_t frame_idx, bool continue_to_next_branch);
// Need an appropriate marker for the current stack so we can tell step out
// from step in.

View File

@@ -79,6 +79,13 @@ ThreadPlanStepOut::ThreadPlanStepOut(
ComputeTargetFrame(thread, frame_idx, m_stepped_past_frames);
StackFrameSP immediate_return_from_sp(thread.GetStackFrameAtIndex(frame_idx));
SetupReturnAddress(return_frame_sp, immediate_return_from_sp, frame_idx,
continue_to_next_branch);
}
void ThreadPlanStepOut::SetupReturnAddress(
StackFrameSP return_frame_sp, StackFrameSP immediate_return_from_sp,
uint32_t frame_idx, bool continue_to_next_branch) {
if (!return_frame_sp || !immediate_return_from_sp)
return; // we can't do anything here. ValidatePlan() will return false.
@@ -94,8 +101,8 @@ 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 = std::make_shared<ThreadPlanStepOut>(
thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion,
frame_idx - 1, eLazyBoolNo, continue_to_next_branch);
GetThread(), nullptr, false, m_stop_others, eVoteNoOpinion,
eVoteNoOpinion, frame_idx - 1, eLazyBoolNo, continue_to_next_branch);
static_cast<ThreadPlanStepOut *>(m_step_out_to_inline_plan_sp.get())
->SetShouldStopHereCallbacks(nullptr, nullptr);
m_step_out_to_inline_plan_sp->SetPrivate(true);