Skip to content

Control the "step out through thunk" logic explicitly when pushing thread plans #129301

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
Feb 28, 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
3 changes: 2 additions & 1 deletion lldb/include/lldb/Target/ThreadPlanShouldStopHere.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class ThreadPlanShouldStopHere {
eNone = 0,
eAvoidInlines = (1 << 0),
eStepInAvoidNoDebug = (1 << 1),
eStepOutAvoidNoDebug = (1 << 2)
eStepOutAvoidNoDebug = (1 << 2),
eStepOutPastThunks = (1 << 3)
};

// Constructors and Destructors
Expand Down
17 changes: 13 additions & 4 deletions lldb/source/Target/ThreadPlanShouldStopHere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "lldb/Target/ThreadPlanShouldStopHere.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
Expand Down Expand Up @@ -83,7 +84,12 @@ bool ThreadPlanShouldStopHere::DefaultShouldStopHereCallback(
if (Symbol *symbol = frame->GetSymbolContext(eSymbolContextSymbol).symbol) {
ProcessSP process_sp(current_plan->GetThread().GetProcess());
for (auto *runtime : process_sp->GetLanguageRuntimes()) {
if (runtime->IsSymbolARuntimeThunk(*symbol)) {
if (runtime->IsSymbolARuntimeThunk(*symbol) &&
flags.Test(ThreadPlanShouldStopHere::eStepOutPastThunks)) {
LLDB_LOGF(
log, "Stepping out past a language thunk %s for: %s",
frame->GetFunctionName(),
Language::GetNameForLanguageType(runtime->GetLanguageType()));
should_stop_here = false;
break;
}
Expand Down Expand Up @@ -131,9 +137,12 @@ ThreadPlanSP ThreadPlanShouldStopHere::DefaultStepFromHereCallback(
// because it's marked line 0.
bool is_thunk = false;
for (auto *runtime : process_sp->GetLanguageRuntimes()) {
if (runtime->IsSymbolARuntimeThunk(*sc.symbol)) {
LLDB_LOGF(log, "In runtime thunk %s - stepping out.",
sc.symbol->GetName().GetCString());
if (runtime->IsSymbolARuntimeThunk(*sc.symbol) &&
flags.Test(ThreadPlanShouldStopHere::eStepOutPastThunks)) {
LLDB_LOGF(
log, "Stepping out past a language thunk %s for: %s",
frame->GetFunctionName(),
Language::GetNameForLanguageType(runtime->GetLanguageType()));
is_thunk = true;
break;
}
Expand Down
3 changes: 2 additions & 1 deletion lldb/source/Target/ThreadPlanStepInRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ using namespace lldb;
using namespace lldb_private;

uint32_t ThreadPlanStepInRange::s_default_flag_values =
ThreadPlanShouldStopHere::eStepInAvoidNoDebug;
ThreadPlanShouldStopHere::eStepInAvoidNoDebug |
ThreadPlanShouldStopHere::eStepOutPastThunks;

// ThreadPlanStepInRange: Step through a stack range, either stepping over or
// into based on the value of \a type.
Expand Down
Loading