mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Debugger: Add cpu.stepping and cpu.resume.
This commit is contained in:
parent
a4044fd6a0
commit
a341994622
3 changed files with 40 additions and 3 deletions
|
@ -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.
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
void *WebSocketCPUCoreInit(DebuggerEventHandlerMap &map);
|
||||
|
||||
void WebSocketCPUStepping(DebuggerRequest &req);
|
||||
void WebSocketCPUResume(DebuggerRequest &req);
|
||||
void WebSocketCPUGetAllRegs(DebuggerRequest &req);
|
||||
void WebSocketCPUGetReg(DebuggerRequest &req);
|
||||
void WebSocketCPUSetReg(DebuggerRequest &req);
|
||||
|
|
|
@ -22,11 +22,14 @@
|
|||
|
||||
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_) {
|
||||
if (Core_IsStepping() && PSP_IsInited()) {
|
||||
if (coreState != prevState_ && PSP_IsInited()) {
|
||||
// We ignore CORE_POWERDOWN.
|
||||
if (coreState == CORE_STEPPING) {
|
||||
// TODO: Should send more data proactively.
|
||||
ws->Send(R"({"event":"cpu.stepping"})");
|
||||
} else if (prevState_ == CORE_STEPPING && Core_IsActive()) {
|
||||
ws->Send(R"({"event":"cpu.resume"})");
|
||||
}
|
||||
prevState_ = coreState;
|
||||
}
|
||||
prevState_ = coreState;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue