Skip to content

Disable ThreadPlanSingleThreadTimeout during step over breakpoint #104532

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
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
8 changes: 7 additions & 1 deletion lldb/include/lldb/Target/ThreadPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,13 @@ class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>,
virtual void SetStopOthers(bool new_value);

virtual bool StopOthers();


// Returns true if the thread plan supports ThreadPlanSingleThreadTimeout to
// resume other threads after timeout. If the thread plan returns false it
// will prevent ThreadPlanSingleThreadTimeout from being created when this
// thread plan is alive.
virtual bool SupportsResumeOthers() { return true; }

virtual bool ShouldRunBeforePublicStop() { return false; }

// This is the wrapper for DoWillResume that does generic ThreadPlan logic,
Expand Down
1 change: 1 addition & 0 deletions lldb/include/lldb/Target/ThreadPlanStepOverBreakpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ThreadPlanStepOverBreakpoint : public ThreadPlan {
void GetDescription(Stream *s, lldb::DescriptionLevel level) override;
bool ValidatePlan(Stream *error) override;
bool ShouldStop(Event *event_ptr) override;
bool SupportsResumeOthers() override;
bool StopOthers() override;
lldb::StateType GetPlanRunState() override;
bool WillStop() override;
Expand Down
6 changes: 6 additions & 0 deletions lldb/source/Target/ThreadPlanSingleThreadTimeout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ void ThreadPlanSingleThreadTimeout::PushNewWithTimeout(Thread &thread,
if (!thread.GetCurrentPlan()->StopOthers())
return;

if (!thread.GetCurrentPlan()->SupportsResumeOthers())
return;

auto timeout_plan = new ThreadPlanSingleThreadTimeout(thread, info);
ThreadPlanSP thread_plan_sp(timeout_plan);
auto status = thread.QueueThreadPlan(thread_plan_sp,
Expand All @@ -102,6 +105,9 @@ void ThreadPlanSingleThreadTimeout::ResumeFromPrevState(Thread &thread,
if (!thread.GetCurrentPlan()->StopOthers())
return;

if (!thread.GetCurrentPlan()->SupportsResumeOthers())
return;

auto timeout_plan = new ThreadPlanSingleThreadTimeout(thread, info);
ThreadPlanSP thread_plan_sp(timeout_plan);
auto status = thread.QueueThreadPlan(thread_plan_sp,
Expand Down
7 changes: 7 additions & 0 deletions lldb/source/Target/ThreadPlanStepOverBreakpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ bool ThreadPlanStepOverBreakpoint::ShouldStop(Event *event_ptr) {

bool ThreadPlanStepOverBreakpoint::StopOthers() { return true; }

// This thread plan does a single instruction step over a breakpoint instruction
// and needs to not resume other threads, so return false to stop the
// ThreadPlanSingleThreadTimeout from timing out and trying to resume all
// threads. If all threads gets resumed before we disable, single step and
// re-enable the breakpoint, we can miss breakpoints on other threads.
bool ThreadPlanStepOverBreakpoint::SupportsResumeOthers() { return false; }

StateType ThreadPlanStepOverBreakpoint::GetPlanRunState() {
return eStateStepping;
}
Expand Down
Loading