mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Debugger: Add reason to cpu.stepping event.
This commit is contained in:
parent
2bd13c5d9d
commit
fc2efe5dff
3 changed files with 21 additions and 1 deletions
|
@ -392,6 +392,13 @@ int Core_GetSteppingCounter() {
|
|||
return steppingCounter;
|
||||
}
|
||||
|
||||
SteppingReason Core_GetSteppingReason() {
|
||||
SteppingReason r;
|
||||
r.reason = steppingReason;
|
||||
r.relatedAddress = steppingAddress;
|
||||
return r;
|
||||
}
|
||||
|
||||
const char *ExceptionTypeAsString(ExceptionType type) {
|
||||
switch (type) {
|
||||
case ExceptionType::MEMORY: return "Invalid Memory Access";
|
||||
|
|
|
@ -41,6 +41,11 @@ void Core_UpdateSingleStep();
|
|||
void Core_ProcessStepping();
|
||||
// Changes every time we enter stepping.
|
||||
int Core_GetSteppingCounter();
|
||||
struct SteppingReason {
|
||||
const char *reason = nullptr;
|
||||
u32 relatedAddress = 0;
|
||||
};
|
||||
SteppingReason Core_GetSteppingReason();
|
||||
|
||||
enum class CoreLifecycle {
|
||||
STARTING,
|
||||
|
|
|
@ -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"})");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue