Debugger: Add reason to cpu.stepping event.

This commit is contained in:
Unknown W. Brackets committed 2021-10-23 22:08:15 -07:00
1 parent 2bd13c5d9d
commit fc2efe5dff
3 files changed
+21 -1

No files matched your search

@@ -23,6 +23,9 @@
#include "Core/System.h"
struct CPUSteppingEvent {
CPUSteppingEvent(const SteppingReason &reason) : reason_(reason) {
}
operator std::string() {
JsonWriter j;
j.begin();
@@ -30,9 +33,14 @@ struct CPUSteppingEvent {
j.writeUint("pc", currentMIPS->pc);
// A double ought to be good enough for a 156 day debug session.
j.writeFloat("ticks", CoreTiming::GetTicks());
j.writeString("reason", reason_.reason);
j.writeUint("relatedAddress", reason_.relatedAddress);
j.end();
return j.str();
}
private:
const SteppingReason &reason_;
};
// CPU has begun stepping (cpu.stepping)
@@ -49,7 +57,7 @@ void SteppingBroadcaster::Broadcast(net::WebSocketServer *ws) {
int steppingCounter = Core_GetSteppingCounter();
// We ignore CORE_POWERDOWN as a stepping state.
if (coreState == CORE_STEPPING && steppingCounter != lastCounter_) {
ws->Send(CPUSteppingEvent());
ws->Send(CPUSteppingEvent(Core_GetSteppingReason()));
} else if (prevState_ == CORE_STEPPING && coreState != CORE_STEPPING && Core_IsActive()) {
ws->Send(R"({"event":"cpu.resume"})");
}