Skip to content

[lldb] Consider "hidden" frames in ThreadPlanShouldStopHere #131800

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

Closed
Closed
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
3 changes: 2 additions & 1 deletion lldb/include/lldb/Target/Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,8 @@ class Thread : public std::enable_shared_from_this<Thread>,
virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop(
bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
uint32_t frame_idx, Status &status, bool continue_to_next_branch = false);
uint32_t frame_idx, Status &status, bool continue_to_next_branch = false,
const Flags *flags = nullptr);

/// Gets the plan used to step through the code that steps from a function
/// call site at the current PC into the actual function call.
Expand Down
3 changes: 2 additions & 1 deletion lldb/include/lldb/Target/ThreadPlanShouldStopHere.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class ThreadPlanShouldStopHere {
eAvoidInlines = (1 << 0),
eStepInAvoidNoDebug = (1 << 1),
eStepOutAvoidNoDebug = (1 << 2),
eStepOutPastThunks = (1 << 3)
eStepOutPastThunks = (1 << 3),
eStepOutPastHiddenFunctions = (1 << 4),
};

// Constructors and Destructors
Expand Down
3 changes: 2 additions & 1 deletion lldb/include/lldb/Target/ThreadPlanStepOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class ThreadPlanStepOut : public ThreadPlan, public ThreadPlanShouldStopHere {
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);
bool gather_return_value = true,
const Flags *flags = nullptr);

~ThreadPlanStepOut() override;

Expand Down
5 changes: 3 additions & 2 deletions lldb/source/Target/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,13 +1356,14 @@ ThreadPlanSP Thread::QueueThreadPlanForStepOut(
ThreadPlanSP Thread::QueueThreadPlanForStepOutNoShouldStop(
bool abort_other_plans, SymbolContext *addr_context, bool first_insn,
bool stop_other_threads, Vote report_stop_vote, Vote report_run_vote,
uint32_t frame_idx, Status &status, bool continue_to_next_branch) {
uint32_t frame_idx, Status &status, bool continue_to_next_branch,
const Flags *flags) {
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));
calculate_return_value, flags));

ThreadPlanStepOut *new_plan =
static_cast<ThreadPlanStepOut *>(thread_plan_sp.get());
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Target/ThreadPlanShouldStopHere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ ThreadPlanSP ThreadPlanShouldStopHere::DefaultStepFromHereCallback(
return_plan_sp =
current_plan->GetThread().QueueThreadPlanForStepOutNoShouldStop(
false, nullptr, true, stop_others, eVoteNo, eVoteNoOpinion,
frame_index, status, true);
frame_index, status, true, &flags);
return return_plan_sp;
}

Expand Down
14 changes: 10 additions & 4 deletions lldb/source/Target/ThreadPlanStepOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@
using namespace lldb;
using namespace lldb_private;

uint32_t ThreadPlanStepOut::s_default_flag_values = 0;
uint32_t ThreadPlanStepOut::s_default_flag_values =
ThreadPlanShouldStopHere::eStepOutPastHiddenFunctions;

// ThreadPlanStepOut: Step out of the current frame
ThreadPlanStepOut::ThreadPlanStepOut(
Thread &thread, SymbolContext *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, bool gather_return_value)
bool continue_to_next_branch, bool gather_return_value, const Flags *flags)
: ThreadPlan(ThreadPlan::eKindStepOut, "Step out", thread, report_stop_vote,
report_run_vote),
ThreadPlanShouldStopHere(this), m_step_from_insn(LLDB_INVALID_ADDRESS),
Expand All @@ -45,7 +46,10 @@ ThreadPlanStepOut::ThreadPlanStepOut(
m_immediate_step_from_function(nullptr),
m_calculate_return_value(gather_return_value) {
Log *log = GetLog(LLDBLog::Step);
SetFlagsToDefault();
if (flags)
m_flags = *flags;
else
SetFlagsToDefault();
SetupAvoidNoDebug(step_out_avoids_code_without_debug_info);

m_step_from_insn = thread.GetRegisterContext()->GetPC(0);
Expand All @@ -58,7 +62,9 @@ ThreadPlanStepOut::ThreadPlanStepOut(
return; // we can't do anything here. ValidatePlan() will return false.

// While stepping out, behave as-if artificial frames are not present.
while (return_frame_sp->IsArtificial() || return_frame_sp->IsHidden()) {
while (return_frame_sp->IsArtificial() ||
(m_flags.Test(eStepOutPastHiddenFunctions) &&
return_frame_sp->IsHidden())) {
m_stepped_past_frames.push_back(return_frame_sp);

++return_frame_index;
Expand Down