diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 17:39:54 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 17:39:54 -0400 |
| commit | 4af363d798adf3b906fcfa5cba37ec9304f27dab (patch) | |
| tree | 9cced5569a7189aac1a06d51299c3e7902159f48 /tools | |
| parent | 2226865a47ed3c97c4f4631ff50660d11a152da7 (diff) | |
Switch 2 GPU memory handles and mappings at requested addresses
nx2:gpu 101 (CreateGpuAccessibleMemory) returns real GpuMemoryHandles; 211
(NormalMapGpuMemory4K) maps handle+offset at the requested GPU address,
including sparse regions, through Nx2GpuMemoryRegistry::MapAt (SMMU ranges are
reused). 102/213/214 complete through their job-slot events. gdbrsp.py waits
for a real thread before driving the stub and gains a write-watch op. Notes
record the current stop: an NVN command buffer with no command memory.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/nx2/gdbrsp.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/nx2/gdbrsp.py b/tools/nx2/gdbrsp.py index f0acd2aebd..d7c8a16460 100644 --- a/tools/nx2/gdbrsp.py +++ b/tools/nx2/gdbrsp.py @@ -66,8 +66,18 @@ class Rsp: def main(): + import re + import time rsp = Rsp(int(sys.argv[1])) - print("halt reason:", rsp.cmd("?")) + # Until the guest process exists the stub answers with a bogus thread id; commands sent then + # are lost, so wait for a real one. + for _ in range(120): + reason = rsp.cmd("?") + m = re.search(r"thread:([0-9a-f]+);", reason) + if m and int(m.group(1), 16) < 0x10000: + break + time.sleep(0.5) + print("halt reason:", reason) regs = {} for line in open(sys.argv[2]): parts = line.split() @@ -236,6 +246,21 @@ def main(): break rsp.cmd(f"z0,{addr:x},4") rsp.cmd("s") + elif op == "watch": + # watch <addr> <n> [stopval]: write watchpoint on a u64; print pc, lr and the new value + # for up to n hits, stopping early once it equals stopval. + addr, n = int(parts[1], 16), int(parts[2]) + stopval = int(parts[3], 16) if len(parts) > 3 else None + print("watch ->", rsp.cmd(f"Z2,{addr:x},8")) + for i in range(n): + reply = rsp.cmd("c") + r = rsp.regs() + regs = r + d = rsp.mem(addr, 8) + val = struct.unpack("<Q", d)[0] if len(d) == 8 else None + print(f" w{i} {reply[:40]} pc={r.get('pc', 0):#x} lr={r.get('x30', 0) & 0xFFFFFFFFFFFF:#x} value={val if val is None else hex(val)}") + if stopval is not None and val == stopval: + break elif op == "sleep": import time time.sleep(float(parts[1])) |
