Permalink
Browse files

Debugger: Allow GPU actions while stepping.

This allows pulling the display/target while paused.  It may also allow
other actions that work outside a display list.
  • Loading branch information...
unknownbrackets committed Jun 16, 2018
1 parent 469d8a6 commit a0608d7fc5e69312c80e7fba1084a6fd74391073
Showing with 38 additions and 2 deletions.
  1. +4 −0 Core/Core.cpp
  2. +33 −2 GPU/Debugger/Stepping.cpp
  3. +1 −0 GPU/Debugger/Stepping.h
@@ -37,6 +37,7 @@
#include "Core/System.h"
#include "Core/Debugger/Breakpoints.h"
#include "Core/MIPS/MIPS.h"
#include "GPU/Debugger/Stepping.h"
#ifdef _WIN32
#include "Common/CommonWindows.h"
@@ -280,6 +281,9 @@ void Core_ProcessStepping() {
return;
}
// Or any GPU actions.
GPUStepping::SingleStep();
// We're not inside jit now, so it's safe to clear the breakpoints.
CBreakPoints::ClearTemporaryBreakPoints();
host->UpdateDisassembly();
@@ -66,6 +66,9 @@ static void SetPauseAction(PauseAction act, bool waitComplete = true) {
pauseAction = act;
pauseLock.unlock();
if (coreState == CORE_STEPPING && act != PAUSE_CONTINUE)
Core_UpdateSingleStep();
actionComplete = false;
pauseWait.notify_all();
while (waitComplete && !actionComplete) {
@@ -117,13 +120,41 @@ static void RunPauseAction() {
pauseAction = PAUSE_BREAK;
}
bool SingleStep() {
std::unique_lock<std::mutex> guard(pauseLock);
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME && coreState != CORE_STEPPING) {
// Shutting down, don't try to step.
actionComplete = true;
actionWait.notify_all();
return false;
}
if (!gpuDebug || pauseAction == PAUSE_CONTINUE) {
actionComplete = true;
actionWait.notify_all();
return false;
}
gpuDebug->NotifySteppingEnter();
isStepping = true;
RunPauseAction();
gpuDebug->NotifySteppingExit();
isStepping = false;
return true;
}
bool EnterStepping(std::function<void()> callback) {
std::unique_lock<std::mutex> guard(pauseLock);
if (coreState != CORE_RUNNING && coreState != CORE_NEXTFRAME) {
// Shutting down, don't try to step.
actionComplete = true;
actionWait.notify_all();
return false;
}
if (!gpuDebug) {
actionComplete = true;
actionWait.notify_all();
return false;
}
@@ -152,7 +183,7 @@ bool IsStepping() {
}
static bool GetBuffer(const GPUDebugBuffer *&buffer, PauseAction type, const GPUDebugBuffer &resultBuffer) {
if (!isStepping) {
if (!isStepping && coreState != CORE_STEPPING) {
return false;
}
@@ -184,7 +215,7 @@ bool GPU_GetCurrentClut(const GPUDebugBuffer *&buffer) {
}
bool GPU_SetCmdValue(u32 op) {
if (!isStepping) {
if (!isStepping && coreState != CORE_STEPPING) {
return false;
}
@@ -28,6 +28,7 @@ namespace GPUStepping {
// Begins stepping and calls callback while inside a lock preparing stepping.
// This would be a good place to deliver a message to code that stepping is ready.
bool EnterStepping(std::function<void()> callback);
bool SingleStep();
bool IsStepping();
bool GPU_GetCurrentFramebuffer(const GPUDebugBuffer *&buffer, GPUDebugFramebufferType type);

0 comments on commit a0608d7

Please sign in to comment.