summaryrefslogtreecommitdiff
path: root/src/trace/store.zig
Commit message (Collapse)AuthorAge
* trace: the call chain by the unwind tables; what each word of the stack isGabriel Schneider7 days
| | | | | | | | | | | | | | | | | | | backtrace and frames follow .debug_frame or .eh_frame where there is one (PLT entries expanded into exact rows) and the frame pointer where there is none: the caller is no longer lost in a prologue, in a function that keeps no frame, in a PLT entry or inside libc's syscall wrappers. Against gdb: the same chains on fib and on SQLite, where the old walk lost __sbrk and unixSync. A recording holds, once a function, its unwind rows and its locals on the stack (DW_OP_fbreg, with the block each lives in), and the process's first stack pointer. telescope.slots says of each word what it is: a saved register and which, a return address, a local by name, argc, argv, envp, auxv. Four bytes a moment on the list by instruction, and no slower. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* context: disassembly, telescopes and names in every stop; strings as one tableGabriel Schneider7 days
| | | | | | | | | | | | | | | For a viewer to show what pwndbg's context shows, the debugger records it while the memory is there: each register and the top of the stack followed as pointers three deep (--telescope), every code address met named, eight instructions from the pc disassembled by capstone (built from source for x86, into the command only; pinned as in 03-codenomicom). zt.telescope reads a chain back with the kind of memory each link points into, and ztrace show prints the context, coloured on a terminal as pwndbg colours. The thirty thousand strings of a small run showed that a string map in each keyframe costs 700 bytes of tree a string: strings are now one table for the recording, appended a batch and read whole at open. fib(12) by instruction with everything on: 9 MB, 71 000 moments/s.
* recorder: a keyframe every 4096 moments, measured on LuaGabriel Schneider7 days
| | | | | | | | Lua 5.4 through ztrace cc with everything instrumented, on a ten-line script: 3.2 million moments, and at a keyframe every 256 the keyframes were half of its 304 MB. At 4096 it is 156 MB and records in 1.7 s instead of 3.9; a seek to any moment is a millisecond on average, three at worst, and reading in order 6 µs a moment. The README has the table.
* recorder: a moment is its events, state is at keyframesGabriel Schneider7 days
| | | | | | | | | | | | | | | | | | Folding every event into persistent state at every moment cost 750 bytes a step and 2 KB a scattered 8-byte write: the tree's path copied each time. Now a moment stores its events alone, in a compact code (a flags byte, varints, time as a difference, registers as the ones that changed), and the state (threads, memory, heap, variables, mappings, strings) is written at a keyframe a batch, sharing with the one before. A reader replays at most a batch over a keyframe, and keeps four positions replayed, so playing forward reads one moment a step. Of a memory write the recorder keeps the spans that differ from what it holds, so a region read again costs what changed in it. It stops at max_bytes (1 GiB). A step with registers: 749 bytes to 57. fib(12) by instruction, 142 000 moments: 111 MB to 8 MB, 197 000 moments/s. bench-store measures the rest.
* recorder: moments in batches, and the heap, the stack, variables, lines and ↵Gabriel Schneider7 days
| | | | | | | | | | | | | | | mappings in each A transaction a moment cost 10 µs and 1 KB before the moment's own data: the list's path copied each time. Moments now gather 256 to a transaction, each frozen by its own cursor so the list grows in place, and a thread's fields sit in the moment's map instead of two maps down: a small moment is 284 bytes and 1 µs, an instruction step with registers 780 bytes. A moment also folds alloc/free into the live heap, call/ret into each thread's stack, variable into the live variables (a local leaves with its call), line, and map/unmap, so a viewer reads any of them at any moment without replaying.
* ztrace: the event, the ring, the recording, a ptrace loopGabriel Schneider7 days
One 64-byte Event for every backend; a shared-memory ring from target to tracer with stop/resume; a Recorder that folds events into xitdb moments (registers, memory in 64-byte chunks with known-byte masks, strings) and a Trace that reads any moment back; a minimal ptrace Process; ztrace record, run and dump. Per-area build files so the areas grow apart.