diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -173,6 +173,41 @@ breakpoints and the debugger's own syscall stops. Strings never collide: the pass counts its from 1, a symbol's name has its address as its id, and every other producer uses `event.stringId`, a hash with the top bit set. +## Context + +A viewer of a recording should be able to show what pwndbg's context +shows, so the debugger records what that takes while the memory is there +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 +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. + +``` +$ ztrace record --by break -b fib -- ./fib 5 && ztrace show out.ztrace 34 + rbp 7ffc63068910 —▸ 7ffc63068930 —▸ 7ffc63068950 —▸ 7ffc63068970 —▸ 7ffc63068990 + r12 7ffc63068ae8 —▸ 7ffc63069f22 ◂— "/tmp/..." + rip 1001794 (fib+4) + + ► 000001001794 push r14 + 000001001796 push rbx + 000001001797 mov ebx, edi + + 00:0000│ rsp 7ffc63068910 —▸ 7ffc63068930 —▸ 7ffc63068950 —▸ ... + 01:0008│ 7ffc63068918 —▸ 10017b8 (fib+40) + 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 +(`build/capstone.zig`), into the command only: the library takes a +disassembler as a function (`Debugger.disasm`) and links none. + ## The debugger `ztrace dbg -- PROGRAM` starts a program stopped and reads commands (from a @@ -448,5 +483,6 @@ runs them for real: this machine's kernel in QEMU, where we are root. manim-style `anim` module, frame export. - [pardes](../02-pardes-code): tree-sitter parsing, highlighting, themes. - [xitdb](https://github.com/xit-vcs/xitdb): the recording. +- [capstone](https://github.com/capstone-engine/capstone): disassembly, in the command. x86-64 Linux, Zig 0.17. |
