Skip to content

Commit 12becff

Browse files
[lldb] Create ThreadPlanStepOut ctor that never skips frames (#136163)
The function QueueThreadPlanForStepOutNoShouldStop has the semantics of "go this parent frame"; ThreadPlanStepOut needs to respect that, not skipping over any frames it finds uninteresting. This commit creates a constructor that respects such instruction.
1 parent a0b2a95 commit 12becff

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

lldb/include/lldb/Target/ThreadPlanStepOut.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,22 @@ namespace lldb_private {
1717

1818
class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
1919
public:
20+
/// Creates a thread plan to step out from frame_idx, skipping parent frames
21+
/// if they are artificial or hidden frames. Also skips frames without debug
22+
/// info based on step_out_avoids_code_without_debug_info.
2023
ThreadPlanStepOut(Thread &thread, SymbolContext *addr_context,
2124
bool first_insn, bool stop_others, Vote report_stop_vote,
2225
Vote report_run_vote, uint32_t frame_idx,
2326
LazyBool step_out_avoids_code_without_debug_info,
2427
bool continue_to_next_branch = false,
2528
bool gather_return_value = true);
2629

30+
/// Creates a thread plan to step out from frame_idx to frame_idx + 1.
31+
ThreadPlanStepOut(Thread &thread, bool stop_others, Vote report_stop_vote,
32+
Vote report_run_vote, uint32_t frame_idx,
33+
bool continue_to_next_branch = false,
34+
bool gather_return_value = true);
35+
2736
~ThreadPlanStepOut() override;
2837

2938
void GetDescription(Stream *s, lldb::DescriptionLevel level) override;

lldb/source/Target/Thread.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,9 +1360,8 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop(
13601360
const bool calculate_return_value =
13611361
false; // No need to calculate the return value here.
13621362
ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut(
1363-
*this, addr_context, first_insn, stop_other_threads, report_stop_vote,
1364-
report_run_vote, frame_idx, eLazyBoolNo, continue_to_next_branch,
1365-
calculate_return_value));
1363+
*this, stop_other_threads, report_stop_vote, report_run_vote, frame_idx,
1364+
continue_to_next_branch, calculate_return_value));
13661365

13671366
ThreadPlanStepOut *new_plan =
13681367
static_cast<ThreadPlanStepOut *>(thread_plan_sp.get());

lldb/source/Target/ThreadPlanStepOut.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,28 @@ ThreadPlanStepOut::ThreadPlanStepOut(
8383
continue_to_next_branch);
8484
}
8585

86+
ThreadPlanStepOut::ThreadPlanStepOut(Thread &thread, bool stop_others,
87+
Vote report_stop_vote,
88+
Vote report_run_vote, uint32_t frame_idx,
89+
bool continue_to_next_branch,
90+
bool gather_return_value)
91+
: ThreadPlan(ThreadPlan::eKindStepOut, "Step out", thread, report_stop_vote,
92+
report_run_vote),
93+
ThreadPlanShouldStopHere(this), m_return_bp_id(LLDB_INVALID_BREAK_ID),
94+
m_return_addr(LLDB_INVALID_ADDRESS), m_stop_others(stop_others),
95+
m_immediate_step_from_function(nullptr),
96+
m_calculate_return_value(gather_return_value) {
97+
SetFlagsToDefault();
98+
m_step_from_insn = thread.GetRegisterContext()->GetPC(0);
99+
100+
StackFrameSP return_frame_sp = thread.GetStackFrameAtIndex(frame_idx + 1);
101+
StackFrameSP immediate_return_from_sp =
102+
thread.GetStackFrameAtIndex(frame_idx);
103+
104+
SetupReturnAddress(return_frame_sp, immediate_return_from_sp, frame_idx,
105+
continue_to_next_branch);
106+
}
107+
86108
void ThreadPlanStepOut::SetupReturnAddress(
87109
StackFrameSP return_frame_sp, StackFrameSP immediate_return_from_sp,
88110
uint32_t frame_idx, bool continue_to_next_branch) {

0 commit comments

Comments
 (0)