Skip to content

[lldb] Create ThreadPlanStepOut ctor that never skips frames #136163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lldb/include/lldb/Target/ThreadPlanStepOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@ namespace lldb_private {

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

/// Creates a thread plan to step out from frame_idx to frame_idx + 1.
ThreadPlanStepOut(Thread &thread, bool stop_others, Vote report_stop_vote,
Vote report_run_vote, uint32_t frame_idx,
bool continue_to_next_branch = false,
bool gather_return_value = true);

~ThreadPlanStepOut() override;

void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Target/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,9 +1360,8 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop(
const bool calculate_return_value =
false; // No need to calculate the return value here.
ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut(
*this, addr_context, first_insn, stop_other_threads, report_stop_vote,
report_run_vote, frame_idx, eLazyBoolNo, continue_to_next_branch,
calculate_return_value));
*this, stop_other_threads, report_stop_vote, report_run_vote, frame_idx,
continue_to_next_branch, calculate_return_value));

ThreadPlanStepOut *new_plan =
static_cast<ThreadPlanStepOut *>(thread_plan_sp.get());
Expand Down
22 changes: 22 additions & 0 deletions lldb/source/Target/ThreadPlanStepOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,28 @@ ThreadPlanStepOut::ThreadPlanStepOut(
continue_to_next_branch);
}

ThreadPlanStepOut::ThreadPlanStepOut(Thread &thread, bool stop_others,
Vote report_stop_vote,
Vote report_run_vote, uint32_t frame_idx,
bool continue_to_next_branch,
bool gather_return_value)
: ThreadPlan(ThreadPlan::eKindStepOut, "Step out", thread, report_stop_vote,
report_run_vote),
ThreadPlanShouldStopHere(this), m_return_bp_id(LLDB_INVALID_BREAK_ID),
m_return_addr(LLDB_INVALID_ADDRESS), m_stop_others(stop_others),
m_immediate_step_from_function(nullptr),
m_calculate_return_value(gather_return_value) {
SetFlagsToDefault();
m_step_from_insn = thread.GetRegisterContext()->GetPC(0);

StackFrameSP return_frame_sp = thread.GetStackFrameAtIndex(frame_idx + 1);
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) {
Expand Down
Loading