Skip to content

Commit

Permalink
Debugger: Track a counter when entering stepping.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
unknownbrackets committed Jun 6, 2018
1 parent e9cc1ee commit 77609bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Core/Core.cpp
Expand Up @@ -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<Core_ShutdownFunc> shutdownFuncs;
static bool windowHidden = false;
static double lastActivity = 0.0;
Expand Down Expand Up @@ -334,10 +335,15 @@ void Core_EnableStepping(bool step) {
sleep_ms(1);
host->SetDebugMode(true);
Core_UpdateState(CORE_STEPPING);
steppingCounter++;
} else {
host->SetDebugMode(false);
coreState = CORE_RUNNING;
coreStatePending = false;
m_StepCond.notify_all();
}
}

int Core_GetSteppingCounter() {
return steppingCounter;
}
4 changes: 2 additions & 2 deletions Core/Core.h
Expand Up @@ -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);
Expand Down

0 comments on commit 77609bb

Please sign in to comment.