mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 13:59:56 -04:00
Add floor_watch: hardware watchpoints on the floor the scan finds log which game code reads and writes it, at 60 fps and again at 120 fps or more.
floor_watch.c takes up to twelve of the floor scan's survivors (the platform's rigid body controller unit first, then one per object at the pivot's height), watches them four at a time through the debug registers on every thread (platform.h plat_watch_set, Windows only), counts each access's call chain in a lock-free table and logs the chains with the executable's symbol names after each pass. prof_syms gains a callback form for that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,16 @@ int plat_intr_stop(PlatIntr *t, uint64_t *rip, uint64_t *rsp);
|
||||
// on where it stopped).
|
||||
int plat_intr_resume(PlatIntr *t, uint64_t to);
|
||||
|
||||
// Hardware data watchpoints (diagnosis: floor_watch.c). Up to four addresses, each watched for any read or write of its
|
||||
// len bytes (1, 2, 4 or 8, the address aligned to it), on every thread the process has when they are set; threads
|
||||
// started later have none. After each access hit(slot, frames, depth) runs on the thread that made it, inside its
|
||||
// exception handling: frames[0] is the instruction after the access, then up to PLAT_WATCH_DEPTH - 1 return addresses.
|
||||
// hit must not lock, allocate or log, and its nonzero return clears that thread's watchpoints. n = 0 clears them on
|
||||
// every thread. Returns the threads changed; -1 where the platform has none (Linux) or the change failed.
|
||||
#define PLAT_WATCH_DEPTH 4
|
||||
typedef int (*PlatWatchHit)(int slot, const uint64_t *frames, int depth);
|
||||
int plat_watch_set(const uint64_t *addr, const int *len, int n, PlatWatchHit hit);
|
||||
|
||||
// Fibers: execution contexts with stacks of their own that threads switch between; a fiber may resume on another
|
||||
// thread. Each switch keeps the callee-saved registers and the floating-point control state.
|
||||
typedef struct PlatFiber PlatFiber;
|
||||
|
||||
Reference in New Issue
Block a user