From aadcc24aac4da5f421bf114551240298fada2aff Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 4 Jun 2026 05:49:23 +0200 Subject: [core/debugger] Protocol-compliant vCont support (#3896) (gdb) set scheduler-locking on (gdb) continue As discussed in #3848, follow-up to implement vCont support according to spec. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3896 Reviewed-by: Lizzie Reviewed-by: crueter --- src/core/debugger/debugger.cpp | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'src/core/debugger/debugger.cpp') 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(frontend.get()); + MarkResumed([this, threads = std::move(gdb->resume_threads)] { + ResumeThreads(threads); }); break; - case DebuggerAction::StepThreadLocked: { - MarkResumed([&] { + } + case DebuggerAction::StepThread: { + auto* gdb = static_cast(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& 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 void MarkResumed(Callback&& cb) { stopped = false; -- cgit v1.2.3