diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-02 11:44:31 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-02 11:44:31 -0400 |
| commit | 1c99bfbeffff04529f6f669601fdf835a73778da (patch) | |
| tree | 5867bab46e5848541df36c703f6fd8d6d0256e54 /debug/risc-v-gsp-rm-vm/greeneye/session.py | |
| parent | 2fd653044127a665e4677a2cdfb58120d7b3e16b (diff) | |
| download | open-iov-1c99bfbeffff04529f6f669601fdf835a73778da.tar.gz open-iov-1c99bfbeffff04529f6f669601fdf835a73778da.zip | |
rename (cosmetic): green-eye -> risc-v-gsp-rm-debugger in user-facing names, docs, CLI, launcher and CI workflow; internal greeneye package/module identifiers unchanged (includes in-flight greeneye module edits present in the tree)
Diffstat (limited to 'debug/risc-v-gsp-rm-vm/greeneye/session.py')
| -rw-r--r-- | debug/risc-v-gsp-rm-vm/greeneye/session.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/debug/risc-v-gsp-rm-vm/greeneye/session.py b/debug/risc-v-gsp-rm-vm/greeneye/session.py index fffc60e..2ef13a4 100644 --- a/debug/risc-v-gsp-rm-vm/greeneye/session.py +++ b/debug/risc-v-gsp-rm-vm/greeneye/session.py @@ -1,4 +1,4 @@ -"""green-eye instrumentation session: hooks, breakpoints, watchpoints, events. +"""risc-v-gsp-rm-debugger instrumentation session: hooks, breakpoints, watchpoints, events. This is the Frida-like core. It is deliberately transport-agnostic; the RSP client is the default backend, and a Session can also be constructed around a @@ -18,14 +18,22 @@ from .rsp import RspClient, StopReply from .symbols import Symbol, SymbolDB #: Registers saved and restored around ``Session.call`` (RISC-V ABI + pc). +#: ``fp`` is x8/s0 under QEMU's target.xml name; both spellings are listed so +#: the restore works whichever name the transport exposes. RESTORE_REGS = ( - ["ra", "sp", "gp", "tp", "t0", "t1", "t2", "s0", "s1"] + ["ra", "sp", "gp", "tp", "t0", "t1", "t2", "s0", "fp", "s1"] + [f"a{i}" for i in range(8)] + [f"s{i}" for i in range(2, 12)] + [f"t{i}" for i in range(3, 7)] + ["pc"] ) +#: Budget for the stop reply after a budget-interrupt. The default client +#: socket timeout can be exhausted on a heavily loaded host before QEMU gets +#: scheduled; a longer explicit budget keeps a probe from being misclassified +#: as an error just because the host was busy. +INTERRUPT_TIMEOUT = 30.0 + @dataclass class Hit: @@ -392,7 +400,7 @@ class Session: try: stop = self.client.continue_(timeout=remaining) except RspTimeout: - self.client.interrupt() + self.client.interrupt(timeout=INTERRUPT_TIMEOUT) raise RspTimeout(f"run_until {addr:#x}: not reached in {timeout}s") hit = self._dispatch_stop(stop) if hit is not None and hit.addr == addr and hit.kind == "breakpoint": @@ -433,7 +441,7 @@ class Session: try: stop = self.client.continue_(timeout=remaining) except RspTimeout: - self.client.interrupt() + self.client.interrupt(timeout=INTERRUPT_TIMEOUT) raise RspTimeout(f"call {addr:#x}: no return in {timeout}s") hit = self._dispatch_stop(stop) pc = self.client.pc @@ -483,7 +491,7 @@ class Session: except RspTimeout: if deadline is None: raise - stop = self.client.interrupt() + stop = self.client.interrupt(timeout=INTERRUPT_TIMEOUT) interrupted = True stops += 1 self._dispatch_stop(stop) @@ -496,7 +504,7 @@ class Session: return stops def stop(self) -> Hit | None: - stop = self.client.interrupt() + stop = self.client.interrupt(timeout=INTERRUPT_TIMEOUT) return self._dispatch_stop(stop) # -- stop dispatch ----------------------------------------------------- |
