summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 12:28:33 -0300
committerGabriel Schneider <[email protected]>2026-11-10 12:30:52 -0300
commit8ac0639bfc0186acedb11759432a2cfa277193f2 (patch)
tree5a20795dae8c3f33d0c61ff6401887165da8ba2f /build
parent952af9711cc6a4de987a9d9d45e1e36721c5b470 (diff)
downloadcomputeranim-8ac0639bfc0186acedb11759432a2cfa277193f2.tar.gz
computeranim-8ac0639bfc0186acedb11759432a2cfa277193f2.zip
static probes from the debugger: -b usdt:PROVIDER:NAME, no root
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.
Diffstat (limited to 'build')
-rw-r--r--build/kernel.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/build/kernel.zig b/build/kernel.zig
index aae593a..3a0c65c 100644
--- a/build/kernel.zig
+++ b/build/kernel.zig
@@ -30,6 +30,21 @@ pub fn add(ctx: Ctx) void {
// ... and the library's own tests of this area: what needs no target.
step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = ctx.ztrace, .filters = &.{ "perf.test", "usdt.test", "bpf.test" } })).step);
+ // The static probes without root: the debugger stops at each for as
+ // long as it takes to record it. start, four ticks, done.
+ const probed = b.addRunArtifact(ctx.exe);
+ probed.addArgs(&.{ "record", "--by", "break", "-b", "usdt:ztrace:*", "-o" });
+ const probes = probed.addOutputFileArg("usdt.ztrace");
+ probed.addArg("--");
+ probed.addArtifactArg(targets[2]);
+ probed.addArg("4");
+ probed.expectStdErrMatch("exit 0");
+ const shown = b.addRunArtifact(ctx.exe);
+ shown.addArg("show");
+ shown.addFileArg(probes);
+ shown.expectStdOutMatch("6 probe");
+ step.dependOn(&shown.step);
+
// The BPF side for real: this machine's kernel booted in QEMU, where we
// are root. Not part of `test`: it wants qemu, /dev/kvm, cpio and a
// kernel image a user can read.