diff options
author | Franco M <francomaro@gmail.com> | 2023-11-04 21:28:16 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-04 21:28:16 -0300 |
commit | 728aca770317b3f86961c8669ba9ae5c68570d3f (patch) | |
tree | 29adffcb1d264cc16cacb478a8f6645ef6259b3b /src/core/debugger/debugger.cpp | |
parent | 7f62a48ab507d3874378c10944662d5b841c6c2e (diff) | |
parent | 940618a64dc048790291e240dca6a085a4f1c27c (diff) |
Merge branch 'master' into new-shortcut
Diffstat (limited to 'src/core/debugger/debugger.cpp')
-rw-r--r-- | src/core/debugger/debugger.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/core/debugger/debugger.cpp b/src/core/debugger/debugger.cpp index a1589fecb..0e270eb50 100644 --- a/src/core/debugger/debugger.cpp +++ b/src/core/debugger/debugger.cpp @@ -258,20 +258,20 @@ private: Kernel::KScopedSchedulerLock sl{system.Kernel()}; // Put all threads to sleep on next scheduler round. - for (auto* thread : ThreadList()) { - thread->RequestSuspend(Kernel::SuspendType::Debug); + for (auto& thread : ThreadList()) { + thread.RequestSuspend(Kernel::SuspendType::Debug); } } void ResumeEmulation(Kernel::KThread* except = nullptr) { // Wake up all threads. - for (auto* thread : ThreadList()) { - if (thread == except) { + for (auto& thread : ThreadList()) { + if (std::addressof(thread) == except) { continue; } - thread->SetStepState(Kernel::StepState::NotStepping); - thread->Resume(Kernel::SuspendType::Debug); + thread.SetStepState(Kernel::StepState::NotStepping); + thread.Resume(Kernel::SuspendType::Debug); } } @@ -283,13 +283,17 @@ private: } void UpdateActiveThread() { - const auto& threads{ThreadList()}; - if (std::find(threads.begin(), threads.end(), state->active_thread) == threads.end()) { - state->active_thread = threads.front(); + auto& threads{ThreadList()}; + for (auto& thread : threads) { + if (std::addressof(thread) == state->active_thread) { + // Thread is still alive, no need to update. + return; + } } + state->active_thread = std::addressof(threads.front()); } - const std::list<Kernel::KThread*>& ThreadList() { + Kernel::KProcess::ThreadList& ThreadList() { return system.ApplicationProcess()->GetThreadList(); } |