diff options
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: | |||
| 258 | Kernel::KScopedSchedulerLock sl{system.Kernel()}; | 258 | Kernel::KScopedSchedulerLock sl{system.Kernel()}; |
| 259 | 259 | ||
| 260 | // Put all threads to sleep on next scheduler round. | 260 | // Put all threads to sleep on next scheduler round. |
| 261 | for (auto* thread : ThreadList()) { | 261 | for (auto& thread : ThreadList()) { |
| 262 | thread->RequestSuspend(Kernel::SuspendType::Debug); | 262 | thread.RequestSuspend(Kernel::SuspendType::Debug); |
| 263 | } | 263 | } |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | void ResumeEmulation(Kernel::KThread* except = nullptr) { | 266 | void ResumeEmulation(Kernel::KThread* except = nullptr) { |
| 267 | // Wake up all threads. | 267 | // Wake up all threads. |
| 268 | for (auto* thread : ThreadList()) { | 268 | for (auto& thread : ThreadList()) { |
| 269 | if (thread == except) { | 269 | if (std::addressof(thread) == except) { |
| 270 | continue; | 270 | continue; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | thread->SetStepState(Kernel::StepState::NotStepping); | 273 | thread.SetStepState(Kernel::StepState::NotStepping); |
| 274 | thread->Resume(Kernel::SuspendType::Debug); | 274 | thread.Resume(Kernel::SuspendType::Debug); |
| 275 | } | 275 | } |
| 276 | } | 276 | } |
| 277 | 277 | ||
| @@ -283,13 +283,17 @@ private: | |||
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | void UpdateActiveThread() { | 285 | void UpdateActiveThread() { |
| 286 | const auto& threads{ThreadList()}; | 286 | auto& threads{ThreadList()}; |
| 287 | if (std::find(threads.begin(), threads.end(), state->active_thread) == threads.end()) { | 287 | for (auto& thread : threads) { |
| 288 | state->active_thread = threads.front(); | 288 | if (std::addressof(thread) == state->active_thread) { |
| 289 | // Thread is still alive, no need to update. | ||
| 290 | return; | ||
| 291 | } | ||
| 289 | } | 292 | } |
| 293 | state->active_thread = std::addressof(threads.front()); | ||
| 290 | } | 294 | } |
| 291 | 295 | ||
| 292 | const std::list<Kernel::KThread*>& ThreadList() { | 296 | Kernel::KProcess::ThreadList& ThreadList() { |
| 293 | return system.ApplicationProcess()->GetThreadList(); | 297 | return system.ApplicationProcess()->GetThreadList(); |
| 294 | } | 298 | } |
| 295 | 299 | ||