summaryrefslogtreecommitdiff
path: root/build
Commit message (Collapse)AuthorAge
* debugger: add a native GUI with live V8 JIT debuggingGabriel Schneider4 days
|
* record: --until ends the recording at a placeGabriel Schneider5 days
| | | | | | | | The ASan scene cut its run by a count of steps, which moves with the compiler; --until __asan_report_store1 ends it where the report begins. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* trace: what push, call and ret touch; names for data; the stack's roles, sharperGabriel Schneider5 days
| | | | | | | | | | | | | | For a disassembly that points at the stack word it touched. The stack's own instructions have touches (push, call and enter write at rsp-8; pop and ret read at rsp; leave at rbp), and a rep string instruction its whole range. An address a global or static object holds is named (head+0, libc.so.6!main_arena+96). The saved rbp has its role at the push that makes it; every local in a shared word is given; the stack protector's copy is found by seeing its store; ztrace show labels each stack word. Six bytes a moment and 3% slower on the list by instruction. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* symbols: a library's separate debug info, when it is of the same buildGabriel Schneider5 days
| | | | | | | | | | | | | | | The system glibc stays dynamically linked and is symbolized from the debug file in the debuginfod client's cache or under /usr/lib/debug, used only when its own build id equals the mapped library's; nothing is downloaded. Static functions get names (the loader's resolver is _dl_runtime_resolve_xsavec; main_arena is found by symbol), libc's frames their file and line as the build saw them, and locals, blocks and parameter counts follow. A recording says of each module its build id and where its names came from; ztrace show prints it. Read only when an address in the module needs a name: 44 ms and 25 MB at the first one. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* trace: a function's basic blocks; ASan's shadow memoryGabriel Schneider5 days
| | | | | | | | | | | | | | | | | For a graph of a function's blocks: at the first stop inside it a function's blocks are recorded once (bounds, how each ends, where its edges go), with every instruction's text up to 2048 of them; telescope.blocks reads them, and a branch event ties a run to the edge it took. Stripped libraries get blocks from their unwind bounds. For a plain build seen against an ASan one: record --asan keeps the shadow of every region it records, the offset found from the process; telescope.shadow gives an address's shadow byte. The report functions are named and the chain holds from inside the report to main. Tested on an overflowing target built plain, with gcc's ASan and with clang's. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* trace: names for PLT stubs and GOT slots; a call followed down; the vDSO is ↵Gabriel Schneider6 days
| | | | | | | | | | | | | | | | | | | | run through For a disassembly that follows a call into libc. A stub is open@plt and a slot open@got, from the relocations (libc's own, IFUNC and nameless, by the function they resolve to); telescope.got says what a slot holds and whether it is still lazy. A library function's entry is named even when its mapping was not known yet, by the alias the program imports. The chain holds through the stub's jump, the callee's first instruction, the syscall and the loader's resolver: ld.so's unwind section lacks the entry that ends it, which lost every frame there. A syscall is tied to its instruction's moment, and each frame's call is recorded with the row before it. Stepped by instruction, a call into the vDSO is one moment and its return the next: its clock loop, single-stepped, made three million moments of three reads. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* record: --steps counts from the --from placeGabriel Schneider6 days
| | | | | | | | The loader's syscalls on the way to main used up the count: --steps 120 on a dynamic program left ninety instructions. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* trace: glibc's heap, read from a recording at any momentGabriel Schneider6 days
| | | | | | | | | | | | | | | | | record --heap keeps the arena, the tcache and, of every chunk, its size word and the links of those on a list: free chunks stay readable, which --alloc dropped at the free. zt.heap.glibc gives the chunks in address order, the tcache's and the bins' chains (safe-linking as the stored value and the pointer it protects), the top; each with the address of the word it was read from, each chain saying how it ended. ztrace show prints it. Layouts for glibc 2.44 (no fastbins; a tcache made at the first free, counting the slots left) and 2.40; the arena found by symbol or by the struct whose next points at itself. Against pwndbg on 2.40: the same at every stop. Three bytes a moment and a sixth slower on the list by instruction. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
* trace: the call chain by the unwind tables; what each word of the stack isGabriel Schneider6 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
* debugger: what a write gives the kernel is memory too; --from passes other stopsGabriel Schneider6 days
| | | | | | | | | | A write's buffer was recorded as the syscall's payload only: a reader of the moment's memory found there what an earlier stop had seen of it (zeros, in SQLite's page). And record --from with --by syscall took the loader's first syscall for the place and gave up its breakpoint. Both found by the first animation of a real program. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* record: --from runs through to a place before the first stopGabriel Schneider6 days
| | | | | | | | By instruction, a dynamic program's loader and C library start are a million moments nobody watches: the list of anim/tools from main to its exit is 3 743. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* trace: what the context draws is in the recording; SQLite on the ladderGabriel Schneider6 days
| | | | | | | | | | | | | | | | An instruction's string carries its source line and, for a direct call, how many parameters the callee takes (DWARF); telescope.frames gives each frame's extent on the stack; with --alloc the debugger watches each live allocation and the allocator's header before it, changes only, 256 KiB a stop at most. C++ names are shown and found as the source has them (the command links the C++ runtime for its demangler). SQLite 3.50.4 through every backend, measured (README, bench/sqlite.sh). It found two faults: a file compiled by its full path was recorded under a path joined onto the compile directory, and ztrace run noticed a target's exit up to 10 ms late. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* debugger: a variable the target declares is watched; the runtime has no ↵Gabriel Schneider6 days
| | | | | | | | | | | debug info Events from the target's ring pass a tap on their way to the sink: a variable declared there (the pass's --instr vars, the agent's ztrace_watch) joins the regions recorded at every stop. With nothing else instrumented that is names and types from the compiler, values and everything else from the debugger. The instrumentation runtime is built stripped, so stepping by line runs through its calls.
* build: the pass and the agent to preload are named lazy paths; canim uses themGabriel Schneider6 days
| | | | | A package that depends on ztrace no longer repeats the plugin's recipe or searches the install step for the shared agent.
* context: disassembly, telescopes and names in every stop; strings as one tableGabriel Schneider6 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.
* agent: its handlers act with the thread's protection keys and float modes, ↵Gabriel Schneider6 days
| | | | | | | | | | | | | | | | | | | | | | | | | | | not a handler's The kernel starts a signal handler with default PKRU (key 0 only) and default MXCSR and x87 control word, the thread's own saved in the frame. The SIGSYS handler makes the thread's syscalls and clones its threads from there, so under --syscalls: - a pkey_alloc's new rights were undone when the handler returned; - a thread was born with no right to keyed memory (V8's compiler threads fault reading the code space: d8 died of SEGV_PKUERR, and the 35 seconds were its core dump, not a spin); - a buffer in keyed memory was EFAULT to the kernel, and a fault to the agent reading it for the event; - a thread started without its maker's float modes (flush-to-zero). Both handlers now take the thread's PKRU and control words from the frame first (signal.adopt), and the SIGSYS one writes PKRU back to the frame after the syscall. Watched memory is read, and hooked code patched, with every key open, so a key the thread itself cannot use hides nothing. test-agent: agent_pkey (a keyed page read, given to syscalls, watched, read by a later thread; skips itself without keys), and agent_sys's thread checks its MXCSR. README: --alloc and programs with their own malloc; the core dump. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* static probes from the debugger: -b usdt:PROVIDER:NAME, no rootGabriel Schneider6 days
| | | | | | | | | Debugger.usdt arms the USDT probes of every mapped module as breakpoints whose hook records a probe event with its arguments and lets the program run on, raising a probe's semaphore first; record and dbg take usdt:PROVIDER:NAME (* for any), running the loader through when the probe is a library's. glibc's own 78 probes are there for the asking: memory_sbrk_more shows malloc growing the heap.
* kernel: on today's mainGabriel Schneider6 days
| | | | | | | | | | | Symbols come from Symbols (perf.lookup is gone), string ids from event.stringId, and ptrace.Process is used as it is now. A USDT semaphore of the program itself is raised by the tracer: the kernel's counter landed on the wrong word of a small lld-linked target, whose page of the file is mapped writable twice. test-kernel also runs the library tests of perf, usdt and bpf. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* kernel: smaller BPF records, syscall tracepoints sorted out in place, the READMEGabriel Schneider6 days
| | | | | | | | | | | Syscall entries and kprobes send the event alone (a kernel function's registers are not the thread's; a syscall's are its arguments), a probe's event is not inherited (it failed the target's clone). The per-syscall tracepoints are told entry from exit on the events themselves, not on a second set. The VM has two CPUs and a time limit. README: the kernel's view, with what each mode costs. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* ztrace probe: BPF on syscalls, scheduling, kprobes, uprobes and USDTGabriel Schneider6 days
| | | | | | | | | | | | | | | | Programs built as instruction arrays for one process (no compiler, no libbpf), writing Events into a BPF ring buffer; a drop counter in a map; task_struct offsets from the kernel's BTF; a USDT probe's arguments read in the kernel at the probe. Without CAP_BPF and CAP_PERFMON it says so; --dry-run builds and lists everything. Tested offline by running the programs in a small BPF machine, and for real by test-kernel-vm, which boots this kernel in QEMU where we are root. ztrace perf: moments are no longer cut per event unless --cut; --max-size, and a full recording stops the target and says so. perf.Sorted merges two backends' events by time. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* ztrace perf: the kernel's view of a program, unprivilegedGabriel Schneider6 days
| | | | | | | | | | | | | perf_event_open on a held child: counters, a sampling profile, every page fault with its registers, maps, threads, context switches, every syscall (the per-syscall tracepoints, the only ones open to a user), and the debug registers as watchpoints and breakpoints that do not stop the target. One time-ordered stream of Events into a Sink; --threads follows with a ring per CPU. usdt.zig: the notes of <sys/sdt.h> and their arguments from a Regs and a memory reader, independent of BPF. test-kernel runs all of it on targets/kernel_*. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* the backends together: a ring under the debugger, strings that do not collideGabriel Schneider6 days
| | | | | | | | | | | | ztrace record and dbg take --ring, --preload and --alloc: the target gets the ring ztrace run gives it, and the debugger drains it while the target runs (polling for the stop, so a full ring cannot hold both) and before it reports a stop. A program compiled by ztrace cc, with the agent preloaded, stopped at breakpoints, is one recording in order; test-together checks it. Recording such a program showed the debugger's file names and the pass's strings both counted from 1: event.stringId (a hash, top bit set) is now what every producer without a table of its own uses.
* agent: bench-agent and its numbers, hooks with names, an archive cc can linkGabriel Schneider6 days
| | | | | | | | | | | | | zig build bench-agent runs each capability against its native loop and prints what it costs and writes; README has the table. ztrace run looks at the ring a little longer before sleeping (a target that finds the tracer asleep pays a futex wake an event). A hooked function's name is defined as the string of its address, so the recorder's call stack reads fib. A static link without libc's malloc says which -u to add. The archive carries no stack probes, so cc links it in debug builds too. Tests for --wrap (musl, zig cc) and for a recording that fills. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* agent: the in-process backend, and ztrace run's options for itGabriel Schneider6 days
| | | | | | | | | | | | | | libztrace-agent.so (preloaded) and libztrace-agent.a (linked in), one source: map and thread_start at startup; alloc/free from the interposed allocator; syscall_enter/exit through Syscall User Dispatch; call/ret from int3 hooks; mem_write from watched regions diffed in-process; the target-side API (include/ztrace.h, and the ztrace-agent module for Zig). ztrace run turns each on (--alloc --syscalls --hook --watch), chooses the moments (--cut), and stops the target at event kinds without ptrace (--stop-at, --read, -i). test-agent records real targets and checks the recordings. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* llvm: a pass that instruments for animation, its runtime, ztrace ccGabriel Schneider6 days
| | | | | | | | | | | | | | | | llvm/pass.cpp is an LLVM pass plugin: lines, stores, loads, calls and variables, each call into the runtime carrying names and type descriptions, selected by globs (-ztrace-only, -ztrace-mem), before the optimizer by default. src/instr/rt.zig is the runtime (libztrace-rt.a), which also answers clang's own coverage and -finstrument-functions hooks; src/instr/types.zig the grammar of the type descriptions and its parser. ztrace cc adds all of it to a compiler command. test-llvm compiles fib, two sorts, a linked list and a BFS through ztrace cc and asserts on their recordings; bench-llvm measures what each selection costs. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* targets, test-debugger, bench-debuggerGabriel Schneider6 days
| | | | | | | | | | | A linked list, a graph search in Zig, the same C under glibc and musl, two threads. The tests drive the debugger over them: breakpoint counts, the lines a step walks (as gdb), a list snapshotted by a hook, a watch's words, the syscalls that tell glibc from musl, threads, attach, and scripted dbg and record sessions. The bench measures steps, stops and memory access from bare ptrace up to a recording. Co-Authored-By: Claude Fable 5.2 <[email protected]>
* canim is a package of its own, anim/: ztrace builds without sketchbook and ↵Gabriel Schneider6 days
| | | | pardes
* ztrace: the event, the ring, the recording, a ptrace loopGabriel Schneider6 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.