diff options
Diffstat (limited to 'src/core/debugger/debugger.cpp')
| -rw-r--r-- | src/core/debugger/debugger.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/core/debugger/debugger.cpp b/src/core/debugger/debugger.cpp index 7924ea0d45..f90e78f959 100644 --- a/src/core/debugger/debugger.cpp +++ b/src/core/debugger/debugger.cpp @@ -247,17 +247,19 @@ private: case DebuggerAction::Continue: MarkResumed([&] { ResumeEmulation(); }); break; - case DebuggerAction::StepThreadUnlocked: - MarkResumed([&] { - state->active_thread->SetStepState(Kernel::StepState::StepPending); - state->active_thread->Resume(Kernel::SuspendType::Debug); - ResumeEmulation(state->active_thread.GetPointerUnsafe()); + case DebuggerAction::ContinueThreads: { + auto* gdb = static_cast<GDBStub*>(frontend.get()); + MarkResumed([this, threads = std::move(gdb->resume_threads)] { + ResumeThreads(threads); }); break; - case DebuggerAction::StepThreadLocked: { - MarkResumed([&] { + } + case DebuggerAction::StepThread: { + auto* gdb = static_cast<GDBStub*>(frontend.get()); + MarkResumed([this, threads = std::move(gdb->resume_threads)] { state->active_thread->SetStepState(Kernel::StepState::StepPending); state->active_thread->Resume(Kernel::SuspendType::Debug); + ResumeThreads(threads, state->active_thread.GetPointerUnsafe()); }); break; } @@ -298,6 +300,22 @@ private: } } + void ResumeThreads(const std::vector<Kernel::KThread*>& threads, + Kernel::KThread* except = nullptr) { + Kernel::KScopedLightLock ll{debug_process->GetListLock()}; + Kernel::KScopedSchedulerLock sl{system.Kernel()}; + + // Wake up only the specified threads. + for (auto* thread : threads) { + if (!thread || thread == except) { + continue; + } + + thread->SetStepState(Kernel::StepState::NotStepping); + thread->Resume(Kernel::SuspendType::Debug); + } + } + template <typename Callback> void MarkResumed(Callback&& cb) { stopped = false; |
