Files
ppsspp/Core/Debugger/WebSocket/MIPSTracerSubscriber.h
T
Henrik RydgårdandClaude Opus 5 ccdaa94f53 Expose the MIPSTracer over the WebSocket debugger
The tracer records every basic block the CPU executes and can write the
instruction stream out to a file, which is the tool you want when something
corrupts state and the question is "what actually ran just before". It was
only reachable from Developer Tools in the UI, so a scripted session had no
way to turn it on, and reconstructing the same thing from log-only breakpoints
means guessing what to watch before you know what happened.

Five events: cpu.tracer.start/stop/flush/clear/status. start takes the two
buffer sizes and clears the JIT cache by default, because blocks compiled
before tracing was on don't carry the LogIRBlock instruction the tracer feeds
on - without that a hot loop compiled earlier simply never appears. The trace
ring is cyclic, so a finished recording holds the last maxTraceSize blocks:
start it, run into a crash, and the tail of the file is the instructions that
led there.

Only the IR cores drive the tracer, so start refuses on the others and says
which core is loaded rather than recording nothing; status reports the same
thing as `supported` so a client can tell that apart from "nothing executed".
Everything that mutates tracer state goes through Core_RunOnCPUThread, per
docs/DebuggerThreading.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 18:43:38 -06:00

29 lines
1.1 KiB
C

// Copyright (c) 2026- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include "Core/Debugger/WebSocket/WebSocketUtils.h"
DebuggerSubscriber *WebSocketMIPSTracerInit(DebuggerEventHandlerMap &map);
void WebSocketMIPSTracerStatus(DebuggerRequest &req);
void WebSocketMIPSTracerStart(DebuggerRequest &req);
void WebSocketMIPSTracerStop(DebuggerRequest &req);
void WebSocketMIPSTracerFlush(DebuggerRequest &req);
void WebSocketMIPSTracerClear(DebuggerRequest &req);