Skip to content

Commit bde0158

Browse files
[lldb] Create ThreadPlanStepOut ctor that never skips frames
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 e668877 commit bde0158

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

lldb/include/lldb/Target/ThreadPlanStepOut.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@ 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+
/// that artificial and hidden frames. Also skips frames without debug info
22+
/// based on step_out_avoids_code_without_debug_info.
2023
ThreadPlanStepOut(Thread &thread, bool stop_others, Vote report_stop_vote,
2124
Vote report_run_vote, uint32_t frame_idx,
2225
LazyBool step_out_avoids_code_without_debug_info,
2326
bool continue_to_next_branch = false,
2427
bool gather_return_value = true);
2528

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

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

lldb/source/Target/Thread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop(
13601360
false; // No need to calculate the return value here.
13611361
ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut(
13621362
*this, stop_other_threads, report_stop_vote, report_run_vote, frame_idx,
1363-
eLazyBoolNo, continue_to_next_branch, calculate_return_value));
1363+
continue_to_next_branch, calculate_return_value));
13641364

13651365
ThreadPlanStepOut *new_plan =
13661366
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
frame_idx, 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)