diff --git a/pcsx2/DebugTools/DebugInterface.cpp b/pcsx2/DebugTools/DebugInterface.cpp index 9b2c804ccf..b480adcef2 100644 --- a/pcsx2/DebugTools/DebugInterface.cpp +++ b/pcsx2/DebugTools/DebugInterface.cpp @@ -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 } diff --git a/pcsx2/DebugTools/DisassemblyManager.cpp b/pcsx2/DebugTools/DisassemblyManager.cpp index 3536f1b766..2e7e52f57d 100644 --- a/pcsx2/DebugTools/DisassemblyManager.cpp +++ b/pcsx2/DebugTools/DisassemblyManager.cpp @@ -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); diff --git a/pcsx2/Interpreter.cpp b/pcsx2/Interpreter.cpp index c448fd6526..3a72362c21 100644 --- a/pcsx2/Interpreter.cpp +++ b/pcsx2/Interpreter.cpp @@ -60,6 +60,8 @@ void intBreakpoint(bool memcheck) CBreakPoints::SetBreakpointTriggered(true); #ifndef PCSX2_CORE GetCoreThread().PauseSelfDebug(); +#else + VMManager::SetPaused(true); #endif throw Exception::ExitCpuExecute(); } diff --git a/pcsx2/R3000AInterpreter.cpp b/pcsx2/R3000AInterpreter.cpp index b6a528bf77..29518ed3f3 100644 --- a/pcsx2/R3000AInterpreter.cpp +++ b/pcsx2/R3000AInterpreter.cpp @@ -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(); } diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index c6875af46b..ddc124fe3a 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -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) diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index 9969fcce95..5c502664a0 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -35,6 +35,10 @@ #include #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 { diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 027dd447be..af082941e1 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -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(); }