[core/debugger] Protocol-compliant vCont support (#3896)
Some checks are pending
tx-src / sources (push) Waiting to run
Check Strings / check-strings (push) Waiting to run

(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 <lizzie@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
Duncan Ogilvie 2026-06-04 05:49:23 +02:00 committed by crueter
parent 89199f4d27
commit aadcc24aac
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
4 changed files with 169 additions and 35 deletions

View file

@ -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;