Merge pull request #9535 from sepalani/threads-freeze

DebugInterface: Check visited addresses in GetThreads
This commit is contained in:
Léo Lam 2021-03-02 16:38:02 +01:00 committed by GitHub
commit 7712f0831f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -4,9 +4,11 @@
#include "Core/Debugger/PPCDebugInterface.h"
#include <algorithm>
#include <array>
#include <cstddef>
#include <string>
#include <vector>
#include <fmt/format.h>
@ -181,9 +183,13 @@ Common::Debug::Threads PPCDebugInterface::GetThreads() const
if (!active_thread->IsValid())
return threads;
const auto insert_threads = [&threads](u32 addr, auto get_next_addr) {
std::vector<u32> visited_addrs{{active_thread->GetAddress()}};
const auto insert_threads = [&threads, &visited_addrs](u32 addr, auto get_next_addr) {
while (addr != 0 && PowerPC::HostIsRAMAddress(addr))
{
if (std::find(visited_addrs.begin(), visited_addrs.end(), addr) != visited_addrs.end())
break;
visited_addrs.push_back(addr);
auto thread = std::make_unique<Core::Debug::OSThreadView>(addr);
if (!thread->IsValid())
break;