From a10e1691dbe5b944812dc8761a450636bc247e3d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:07:53 -0300 Subject: agent: bench-agent and its numbers, hooks with names, an archive cc can link 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 --- src/agent/hook.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/agent/hook.zig') diff --git a/src/agent/hook.zig b/src/agent/hook.zig index 57a374c..fa44cc4 100644 --- a/src/agent/hook.zig +++ b/src/agent/hook.zig @@ -11,6 +11,10 @@ //! handler swaps the return address on the stack for `returned`, which emits //! the event and jumps to the real one. //! +//! shortcut: SIGTRAP is forced; a target that calls a hooked function with +//! SIGTRAP blocked is killed by the kernel. Under --syscalls the agent keeps +//! the target's masks clear of it; without, nothing does. +//! //! shortcut: a signal per call, about a microsecond. For hooks on hot //! functions, copy the prologue to a trampoline and patch a jump in (this //! needs an x86-64 instruction-length decoder, to move whole instructions and -- cgit v1.3