GE Debugger: Track last gstate on stepping.

This commit is contained in:
Unknown W. Brackets committed 2022-02-13 10:22:59 -08:00
1 parent b654ee9d44
commit 71e855a822
2 files changed
+29 -10

No files matched your search

+26 -10
View File
@@ -65,6 +65,8 @@ static GPUDebugBuffer bufferClut;
static int bufferLevel;
static u32 pauseSetCmdValue;
static GPUgstate lastGState;
static void SetPauseAction(PauseAction act, bool waitComplete = true) {
pauseLock.lock();
std::unique_lock<std::mutex> guard(actionLock);
@@ -133,6 +135,22 @@ static void RunPauseAction() {
pauseAction = PAUSE_BREAK;
}
static void StartStepping() {
if (lastGState.cmdmem[1] == 0) {
lastGState = gstate;
// Play it safe so we don't keep resetting.
lastGState.cmdmem[1] |= 0x01000000;
}
gpuDebug->NotifySteppingEnter();
isStepping = true;
}
static void StopStepping() {
gpuDebug->NotifySteppingExit();
lastGState = gstate;
isStepping = false;
}
bool SingleStep() {
std::unique_lock<std::mutex> guard(pauseLock);
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME && coreState != CORE_STEPPING) {
@@ -147,13 +165,9 @@ bool SingleStep() {
return false;
}
gpuDebug->NotifySteppingEnter();
isStepping = true;
StartStepping();
RunPauseAction();
gpuDebug->NotifySteppingExit();
isStepping = false;
StopStepping();
return true;
}
@@ -171,13 +185,12 @@ bool EnterStepping() {
return false;
}
gpuDebug->NotifySteppingEnter();
StartStepping();
// Just to be sure.
if (pauseAction == PAUSE_CONTINUE) {
pauseAction = PAUSE_BREAK;
}
isStepping = true;
stepCounter++;
do {
@@ -185,8 +198,7 @@ bool EnterStepping() {
pauseWait.wait(guard);
} while (pauseAction != PAUSE_CONTINUE);
gpuDebug->NotifySteppingExit();
isStepping = false;
StopStepping();
return true;
}
@@ -263,4 +275,8 @@ void ForceUnpause() {
actionWait.notify_all();
}
GPUgstate LastState() {
return lastGState;
}
} // namespace
+3
View File
@@ -22,6 +22,7 @@
#include "Common/CommonTypes.h"
#include "Core/Core.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUState.h"
namespace GPUStepping {
// Should be called from the emu thread.
@@ -42,4 +43,6 @@ namespace GPUStepping {
void ResumeFromStepping();
void ForceUnpause();
GPUgstate LastState();
};