From ed46c51fe127377eb1fde8dee83da984e0f61860 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 14:39:55 -0300 Subject: context: eight instructions above the pc and eight below; where a branch goes A function is decoded once from its start, so the instructions before the pc are known: each instruction's string now says the length of the one before it, and ztrace show prints eight above and eight below, as pwndbg does. A call, a jump or a return at the pc is a branch event with its target (named) and, for a conditional jump, whether the flags take it. --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 7ecfc92..3e181ca 100644 --- a/README.md +++ b/README.md @@ -181,8 +181,9 @@ to read. At every stop it follows each register and the top sixteen words of the stack as pointers, three deep (`--telescope N`; 0 for not at all): the memory they lead to is recorded, every code address met gets a name (the string whose id is the address: `fib+40`, `libc.so.6!write+18`), and -eight instructions from the pc are disassembled by capstone (strings with -id `event.codeId(addr)`). `zt.telescope` reads it back: `chase` gives a +the instructions round the pc are disassembled by capstone, eight above +and eight below it (strings with id `event.codeId(addr)`; inside a function +the ones above are known, the function decoded once from its start). `zt.telescope` reads it back: `chase` gives a value's chain, each link with the kind of memory it points into (code, stack, heap, data, read-only, writable-and-executable: what a pointer is coloured by), a name for code and a string where the chain ends on one. @@ -207,12 +208,13 @@ 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 +compiled in. A call, a jump or a return at the pc is a `branch` event: +where it goes, and for a conditional jump whether it will. 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 +touches, 57 000 and 77 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