Skip to content

Commit 65e4a9a

Browse files
[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 52e9068 commit 65e4a9a

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
@@ -88,6 +88,10 @@ class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
8888
LazyBool step_out_avoids_code_without_debug_info);
8989

9090
void SetupAvoidNoDebug(LazyBool step_out_avoids_code_without_debug_info);
91+
92+
void SetupReturnAddress(lldb::StackFrameSP return_frame_sp,
93+
lldb::StackFrameSP immediate_return_from_sp,
94+
uint32_t frame_idx, bool continue_to_next_branch);
9195
// Need an appropriate marker for the current stack so we can tell step out
9296
// from step in.
9397

lldb/source/Target/ThreadPlanStepOut.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ ThreadPlanStepOut::ThreadPlanStepOut(
8989
ComputeTargetFrame(thread, frame_idx, m_stepped_past_frames);
9090
StackFrameSP immediate_return_from_sp(thread.GetStackFrameAtIndex(frame_idx));
9191

92+
SetupReturnAddress(return_frame_sp, immediate_return_from_sp, frame_idx,
93+
continue_to_next_branch);
94+
}
95+
96+
void ThreadPlanStepOut::SetupReturnAddress(
97+
StackFrameSP return_frame_sp, StackFrameSP immediate_return_from_sp,
98+
uint32_t frame_idx, bool continue_to_next_branch) {
9299
if (!return_frame_sp || !immediate_return_from_sp)
93100
return; // we can't do anything here. ValidatePlan() will return false.
94101

@@ -104,8 +111,8 @@ ThreadPlanStepOut::ThreadPlanStepOut(
104111
// First queue a plan that gets us to this inlined frame, and when we get
105112
// there we'll queue a second plan that walks us out of this frame.
106113
m_step_out_to_inline_plan_sp = std::make_shared<ThreadPlanStepOut>(
107-
thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion,
108-
frame_idx - 1, eLazyBoolNo, continue_to_next_branch);
114+
GetThread(), nullptr, false, m_stop_others, eVoteNoOpinion,
115+
eVoteNoOpinion, frame_idx - 1, eLazyBoolNo, continue_to_next_branch);
109116
static_cast<ThreadPlanStepOut *>(m_step_out_to_inline_plan_sp.get())
110117
->SetShouldStopHereCallbacks(nullptr, nullptr);
111118
m_step_out_to_inline_plan_sp->SetPrivate(true);

0 commit comments

Comments
 (0)