From 77609bbea280d2d079bf7bbca22546826c5e1f54 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 19 Apr 2018 21:14:01 -0700 Subject: [PATCH] Debugger: Track a counter when entering stepping. This allows us to poll coreState and know if a new stepping needs to be sent. This is useful to allow e.g. regs to show changes per step. --- Core/Core.cpp | 6 ++++++ Core/Core.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Core/Core.cpp b/Core/Core.cpp index 9d4a280e2c..0c5b37ddc1 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -54,6 +54,7 @@ static std::mutex m_hStepMutex; static std::condition_variable m_InactiveCond; static std::mutex m_hInactiveMutex; static bool singleStepPending = false; +static int steppingCounter = 0; static std::set shutdownFuncs; static bool windowHidden = false; static double lastActivity = 0.0; @@ -334,6 +335,7 @@ void Core_EnableStepping(bool step) { sleep_ms(1); host->SetDebugMode(true); Core_UpdateState(CORE_STEPPING); + steppingCounter++; } else { host->SetDebugMode(false); coreState = CORE_RUNNING; @@ -341,3 +343,7 @@ void Core_EnableStepping(bool step) { m_StepCond.notify_all(); } } + +int Core_GetSteppingCounter() { + return steppingCounter; +} diff --git a/Core/Core.h b/Core/Core.h index 9adbd6356e..1c98ccdc49 100644 --- a/Core/Core.h +++ b/Core/Core.h @@ -31,12 +31,12 @@ void Core_ErrorPause(); // For platforms that don't call Core_Run void Core_SetGraphicsContext(GraphicsContext *ctx); -void Core_RunRenderThreadFrame(); - // called from gui void Core_EnableStepping(bool step); void Core_DoSingleStep(); void Core_UpdateSingleStep(); +// Changes every time we enter stepping. +int Core_GetSteppingCounter(); typedef void (* Core_ShutdownFunc)(); void Core_ListenShutdown(Core_ShutdownFunc func);