ppsspp_trace_memory_access
Find which code reads or writes a memory address by setting a temporary breakpoint, capturing the program counter, registers, and backtrace on hit, then removing the breakpoint.
Instructions
PURPOSE: One-call answer to 'what code reads/writes this address' — arm a memory breakpoint, wait for the hit, capture pc (+registers/backtrace), remove the breakpoint, and resume.
USAGE: session_id + hex address; access='read'|'write'|'read_write' (default read); size 1/2/4 (default 4); timeout_s default 30; want_registers/want_backtrace optional. Game must be RUNNING (call after session wait_ready).
BEHAVIOR: MUTATING. Arms a temporary breakpoint and always removes it (list-verified real-size removal). The lock is held only for arm/capture/cleanup — the wait is lock-free (concurrent reads OK). Do NOT run other breakpoint/step tools during the wait: the first cpu.stepping broadcast wins. An already-paused CPU short-circuits (nothing can hit). Error paths still remove the breakpoint and resume.
RETURNS: {hit, already_paused, address, access, timeout_s, hits:[{pc, related_address, reason, ticks, mem_hits?, registers?, backtrace?}], bp_removed, resumed, note}. reason/related_address may be null on some builds; mem_hits is the attribution counter.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | Watch size in bytes: 1, 2, or 4 (default 4). | |
| access | No | Access kind to trap: 'read', 'write', or 'read_write' (default 'read'). | read |
| address | Yes | Address to trace, as a hex string (e.g. '0x08A0D000'). | |
| timeout_s | No | Wait budget in seconds (default 30, clamped to [0.5, 300]). On timeout: hit=false, breakpoint removed. | |
| session_id | Yes | Active session ID. | |
| want_backtrace | No | Include the HLE backtrace in the hit (CPU is paused at the hit, so the trace is valid). | |
| want_registers | No | Include the full CPU register dump in the hit. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hit | Yes | True when at least one access was captured. | |
| hits | Yes | Captured hits (pc/related_address hex strings; 'registers' / 'backtrace' included when requested). | |
| note | Yes | Optional human context (e.g. cleanup caveats). | |
| access | Yes | Access kind traced: 'read' / 'write' / 'read_write'. | |
| address | Yes | Traced address, hex string. | |
| resumed | Yes | True when the tool resumed the CPU it had seen running at arm time (a hit pauses the CPU; the tool restores it). | |
| timeout_s | Yes | The wait budget that was applied. | |
| bp_removed | Yes | True when the tool's memory breakpoint is confirmed gone (list-verified) — always true on normal return. | |
| already_paused | Yes | True when the CPU was already paused at arm time — nothing can hit while paused, so no breakpoint was armed. |