Skip to content

Commit 1260751

Browse files
felipepiovezanIanWood1
authored andcommitted
[lldb][nfc] Split the constructor of ThreadPlanStepOut (llvm#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.
1 parent 2405447 commit 1260751

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lldb/include/lldb/Target/ThreadPlanStepOut.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
8282
LazyBool step_out_avoids_code_without_debug_info);
8383

8484
void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
85+
86+
void SetupReturnAddress(lldb::StackFrameSP return_frame_sp,
87+
lldb::StackFrameSP immediate_return_from_sp,
88+
uint32_t frame_idx, bool continue_to_next_branch);
8589
// Need an appropriate marker for the current stack so we can tell step out
8690
// from step in.
8791

lldb/source/Target/ThreadPlanStepOut.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ ThreadPlanStepOut::ThreadPlanStepOut(
7979
ComputeTargetFrame(thread, frame_idx, m_stepped_past_frames);
8080
StackFrameSP immediate_return_from_sp(thread.GetStackFrameAtIndex(frame_idx));
8181

82+
SetupReturnAddress(return_frame_sp, immediate_return_from_sp, frame_idx,
83+
continue_to_next_branch);
84+
}
85+
86+
void ThreadPlanStepOut::SetupReturnAddress(
87+
StackFrameSP return_frame_sp, StackFrameSP immediate_return_from_sp,
88+
uint32_t frame_idx, bool continue_to_next_branch) {
8289
if (!return_frame_sp || !immediate_return_from_sp)
8390
return; // we can't do anything here. ValidatePlan() will return false.
8491

@@ -94,8 +101,8 @@ ThreadPlanStepOut::ThreadPlanStepOut(
94101
// First queue a plan that gets us to this inlined frame, and when we get
95102
// there we'll queue a second plan that walks us out of this frame.
96103
m_step_out_to_inline_plan_sp = std::make_shared<ThreadPlanStepOut>(
97-
thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion,
98-
frame_idx - 1, eLazyBoolNo, continue_to_next_branch);
104+
GetThread(), nullptr, false, m_stop_others, eVoteNoOpinion,
105+
eVoteNoOpinion, frame_idx - 1, eLazyBoolNo, continue_to_next_branch);
99106
static_cast<ThreadPlanStepOut *>(m_step_out_to_inline_plan_sp.get())
100107
->SetShouldStopHereCallbacks(nullptr, nullptr);
101108
m_step_out_to_inline_plan_sp->SetPrivate(true);

0 commit comments

Comments
 (0)