Permalink
Browse files

Debugger: Use 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.
  • Loading branch information...
unknownbrackets committed Apr 20, 2018
1 parent d67a1d4 commit f02bd4daff968d44c9c348cec93cd3ef64d4754b
Showing with 10 additions and 6 deletions.
  1. +9 −6 Core/Debugger/WebSocket/SteppingBroadcaster.cpp
  2. +1 −0 Core/Debugger/WebSocket/SteppingBroadcaster.h
@@ -21,15 +21,18 @@
#include "Core/System.h"
void SteppingBroadcaster::Broadcast(net::WebSocketServer *ws) {
// TODO: This is somewhat primitive. It'd be nice to register a callback with Core instead?
if (coreState != prevState_ && PSP_IsInited()) {
// We ignore CORE_POWERDOWN.
if (coreState == CORE_STEPPING) {
if (PSP_IsInited()) {
int steppingCounter = Core_GetSteppingCounter();
// We ignore CORE_POWERDOWN as a stepping state.
if (coreState == CORE_STEPPING && steppingCounter != lastCounter_) {
// TODO: Should send more data proactively.
ws->Send(R"({"event":"cpu.stepping"})");
} else if (prevState_ == CORE_STEPPING && Core_IsActive()) {
} else if (prevState_ == CORE_STEPPING && coreState != CORE_STEPPING && Core_IsActive()) {
ws->Send(R"({"event":"cpu.resume"})");
}
lastCounter_ = steppingCounter;
prevState_ = coreState;
} else {
prevState_ = CORE_POWERDOWN;
}
prevState_ = coreState;
}
@@ -33,4 +33,5 @@ struct SteppingBroadcaster {
private:
CoreState prevState_;
int lastCounter_ = 0;
};

0 comments on commit f02bd4d

Please sign in to comment.