From 97ce7f485fc0419df693fdf16d634e9e9a6085fc Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 14:35:56 -0300 Subject: context: what an instruction is about to touch, and the call chain At a stop the instruction at the pc is decoded against the registers it will run with (capstone's operands): a touch event for each memory operand (address, size, read or write), what is there recorded with it, and what a write left there read back at the next stop. An instruction-level recording so has every memory write of the stepped thread, nothing watched. The frames of the call chain are recorded and their return addresses named; telescope.backtrace walks them from the recording and ztrace show prints them. Process.read no longer panics on address 0. --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 73d6a2a..7ecfc92 100644 --- a/README.md +++ b/README.md @@ -202,9 +202,17 @@ $ ztrace record --by break -b fib -- ./fib 5 && ztrace show out.ztrace 34 02:0010│ 7ffc63068920 ◂— 3 ``` -What it costs, on `fib(12)` by instruction (142 000 moments): 185 000 -moments a second and 55 bytes a moment with the disassembly alone, 71 000 -and 66 bytes with the telescope. Capstone is built from source for x86 +A stop also says what its instruction is about to do to memory, worked +out from capstone's operands and the registers: a `touch` event (the +address, the size, read or write) with what is there, and after the step +what a write left there. So an instruction-level recording has every +memory write the stepped thread makes, with nothing watched and nothing +compiled in. And each frame of the call chain is recorded, its return +address named: `zt.telescope.backtrace` walks it again from the recording. + +What it costs, on `fib(12)` by instruction (142 000 moments): 154 000 +moments a second and 64 bytes a moment with the disassembly and the +touches, 58 000 and 72 bytes with the telescope and the call chain. Capstone is built from source for x86 (`build/capstone.zig`), into the command only: the library takes a disassembler as a function (`Debugger.disasm`) and links none. -- cgit v1.3