Debugger: Add cpu.stepping and cpu.resume.

This commit is contained in:
Unknown W. Brackets
2018-04-15 15:53:36 -07:00
parent a4044fd6a0
commit a341994622
3 changed files with 40 additions and 3 deletions

View File

@@ -24,6 +24,8 @@
void *WebSocketCPUCoreInit(DebuggerEventHandlerMap &map) {
// No need to bind or alloc state, these are all global.
map["cpu.stepping"] = &WebSocketCPUStepping;
map["cpu.resume"] = &WebSocketCPUResume;
map["cpu.getAllRegs"] = &WebSocketCPUGetAllRegs;
map["cpu.getReg"] = &WebSocketCPUGetReg;
map["cpu.setReg"] = &WebSocketCPUSetReg;
@@ -39,6 +41,36 @@ static std::string RegValueAsFloat(uint32_t u) {
return StringFromFormat("%f", bits.f);
}
// Begin stepping and pause the CPU (cpu.stepping)
//
// No parameters.
//
// No immediate response. Once CPU is stepping, a "cpu.stepping" event will be sent.
void WebSocketCPUStepping(DebuggerRequest &req) {
if (!currentDebugMIPS->isAlive()) {
return req.Fail("CPU not started");
}
if (!Core_IsStepping() && Core_IsActive()) {
Core_EnableStepping(true);
}
}
// Stop stepping and resume the CPU (cpu.resume)
//
// No parameters.
//
// No immediate response. Once CPU is stepping, a "cpu.resume" event will be sent.
void WebSocketCPUResume(DebuggerRequest &req) {
if (!currentDebugMIPS->isAlive()) {
return req.Fail("CPU not started");
}
if (!Core_IsStepping() || coreState == CORE_POWERDOWN) {
return req.Fail("CPU not stepping");
}
Core_EnableStepping(false);
}
// Retrieve all regs and their values (cpu.getAllRegs)
//
// No parameters.