Debugger Core: Initial QT core work

Revert 3ce242886b (Disabled force symbol loading) until solution is found

If this isn't caught when the game is loaded, the symbols will not be properly loaded while the game is running.

DisassemblyManager: Don't spin continuously if the guest CPU is dead
This commit is contained in:
Ty Lamontagne 2022-02-02 23:05:38 -05:00 committed by refractionpcsx2
parent 9f461253a8
commit 78c9b7f33e
7 changed files with 33 additions and 8 deletions

View File

@ -26,6 +26,7 @@
#include "R3000A.h"
#include "IopMem.h"
#include "SymbolMap.h"
#include "VMManager.h"
#include "common/StringUtil.h"
@ -176,7 +177,7 @@ bool DebugInterface::isAlive()
#ifndef PCSX2_CORE
return GetCoreThread().IsOpen() && g_FrameCount > 0;
#else
return false;
return VMManager::HasValidVM() && g_FrameCount > 0;
#endif
}
@ -185,7 +186,7 @@ bool DebugInterface::isCpuPaused()
#ifndef PCSX2_CORE
return GetCoreThread().IsPaused();
#else
return false;
return VMManager::GetState() == VMState::Paused;
#endif
}
@ -195,6 +196,8 @@ void DebugInterface::pauseCpu()
SysCoreThread& core = GetCoreThread();
if (!core.IsPaused())
core.Pause({}, true);
#else
VMManager::SetPaused(true);
#endif
}
@ -204,6 +207,8 @@ void DebugInterface::resumeCpu()
SysCoreThread& core = GetCoreThread();
if (core.IsPaused())
core.Resume();
#else
VMManager::SetPaused(false);
#endif
}

View File

@ -311,6 +311,9 @@ u32 DisassemblyManager::getNthPreviousAddress(u32 address, int n)
u32 DisassemblyManager::getNthNextAddress(u32 address, int n)
{
if (!cpu->isAlive())
return address + n * 4;
while (cpu->isValidAddress(address))
{
auto it = findDisassemblyEntry(entries,address,false);

View File

@ -60,6 +60,8 @@ void intBreakpoint(bool memcheck)
CBreakPoints::SetBreakpointTriggered(true);
#ifndef PCSX2_CORE
GetCoreThread().PauseSelfDebug();
#else
VMManager::SetPaused(true);
#endif
throw Exception::ExitCpuExecute();
}

View File

@ -19,6 +19,10 @@
#include "Common.h"
#include "Config.h"
#ifdef PCSX2_CORE
#include "VMManager.h"
#endif
#include "R5900OpcodeTables.h"
#include "DebugTools/Breakpoints.h"
#include "IopBios.h"
@ -149,6 +153,8 @@ void psxBreakpoint(bool memcheck)
CBreakPoints::SetBreakpointTriggered(true);
#ifndef PCSX2_CORE
GetCoreThread().PauseSelfDebug();
#else
VMManager::SetPaused(true);
#endif
throw Exception::ExitCpuExecute();
}

View File

@ -753,13 +753,9 @@ void VMManager::UpdateRunningGame(bool resetting, bool game_starting)
Host::OnGameChanged(s_disc_path, s_elf_override, s_game_serial, s_game_name, s_game_crc);
#if 0
// TODO: Enable this when the debugger is added to Qt, and it's active. Otherwise, this is just a waste of time.
// In other words, it should be lazily initialized.
MIPSAnalyst::ScanForFunctions(R5900SymbolMap, ElfTextRange.first, ElfTextRange.first + ElfTextRange.second, true);
R5900SymbolMap.UpdateActiveSymbols();
R3000SymbolMap.UpdateActiveSymbols();
#endif
}
void VMManager::ReloadPatches(bool verbose, bool show_messages_when_disabled)

View File

@ -35,6 +35,10 @@
#include <sys/types.h>
#endif
#ifdef PCSX2_CORE
#include "VMManager.h"
#endif
#include "iCore.h"
#include "Config.h"
@ -1418,6 +1422,8 @@ static bool psxDynarecCheckBreakpoint()
CBreakPoints::SetBreakpointTriggered(true);
#ifndef PCSX2_CORE
GetCoreThread().PauseSelfDebug();
#else
VMManager::SetPaused(true);
#endif
// Exit the EE too.
@ -1434,6 +1440,8 @@ static bool psxDynarecMemcheck()
CBreakPoints::SetBreakpointTriggered(true);
#ifndef PCSX2_CORE
GetCoreThread().PauseSelfDebug();
#else
VMManager::SetPaused(true);
#endif
// Exit the EE too.
@ -1572,8 +1580,9 @@ void psxRecompileNextInstruction(bool delayslot, bool swapped_delayslot)
// add breakpoint
if (!delayslot)
{
psxEncodeBreakpoint();
psxEncodeMemcheck();
// Broken on x64
// psxEncodeBreakpoint();
// psxEncodeMemcheck();
}
else
{

View File

@ -1617,6 +1617,8 @@ void dynarecCheckBreakpoint()
CBreakPoints::SetBreakpointTriggered(true);
#ifndef PCSX2_CORE
GetCoreThread().PauseSelfDebug();
#else
VMManager::SetPaused(true);
#endif
recExitExecution();
}
@ -1630,6 +1632,8 @@ void dynarecMemcheck()
CBreakPoints::SetBreakpointTriggered(true);
#ifndef PCSX2_CORE
GetCoreThread().PauseSelfDebug();
#else
VMManager::SetPaused(true);
#endif
recExitExecution();
}