| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
--preload and --alloc on ztrace perf: what the agent says and what the
kernel sees are merged by time into one recording (perf.Sorted, as probe
merges BPF and perf). test-together runs a list under both.
|
| |
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
what a recording may hold
Syscall User Dispatch now runs its handler on an alternate stack a thread
(a thread's own stack may not hold a signal frame; node makes such
threads), and makes clone, clone3 and vfork itself: the child leaves
through the gate with the target's registers instead of being stepped
into with the trap flag. Paths and written buffers are cut at 256 bytes
(--capture), a watch or snapshot above 1 MiB is refused, and ztrace run
ends a recording that is full (--max-size) with the target killed and the
file closed.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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/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]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
threads; ztrace dbg
ptrace.zig follows the threads a target makes, attaches, tells a step from
a breakpoint, and writes memory in one call (through /proc/pid/mem where
the page is read-only). Debugger.zig is the layer above: cont, stepi, step
(a source line, through std.debug's DWARF), breakpoints with hooks, syscall
stops and hooks with the path or buffer captured, watched regions sent as
the words that changed, and every stop an event. Symbols.zig is modules,
ELF symbols and line tables; syscalls.zig their names and shapes.
ztrace dbg is a small REPL on it that records as it goes and looks back
into the recording; ztrace record stops by instruction, line, syscall or
breakpoint, prints syscalls as strace does, and ends cleanly when the
recording is full.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
| | |
|
|
|
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.
|