diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 12:09:27 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 12:15:20 -0300 |
| commit | a7504c6bb2ec9e906891e42bc3df28b276e67143 (patch) | |
| tree | c13e680499badf341b17960341386b8199637671 /build.zig | |
| parent | 937b6314c4cd6fa73daeac308fbfcf69b89add56 (diff) | |
| download | computeranim-a7504c6bb2ec9e906891e42bc3df28b276e67143.tar.gz computeranim-a7504c6bb2ec9e906891e42bc3df28b276e67143.zip | |
the backends together: a ring under the debugger, strings that do not collide
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.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -91,7 +91,24 @@ pub fn build(b: *std.Build) void { // Each area adds its own artifacts, targets and test step. @import("build/debugger.zig").add(ctx); - @import("build/agent.zig").add(ctx); - @import("build/llvm.zig").add(ctx); + const agent = @import("build/agent.zig").add(ctx); + const instrumented_list = @import("build/llvm.zig").add(ctx); + + // The backends at once: a program compiled by `ztrace cc`, the agent + // preloaded into it, the debugger stopping it at breakpoints. One + // recording holds the stops, the allocations and the program's own calls. + const together = b.addRunArtifact(exe); + together.addArgs(&.{ "record", "--by", "break", "-b", "push", "-b", "reverse", "--alloc", "--preload" }); + together.addArtifactArg(agent); + together.addArg("-o"); + const recording = together.addOutputFileArg("together.ztrace"); + together.addArg("--"); + together.addFileArg(instrumented_list); + together.expectStdErrMatch("exit 55"); + const shown = b.addRunArtifact(exe); + shown.addArg("show"); + shown.addFileArg(recording); + inline for (.{ "6 breakpoint", "5 alloc", "7 call", "7 ret", " variable", " line" }) |part| shown.expectStdOutMatch(part); + ctx.areaTest("test-together", "A debugger, the agent and instrumentation on one program").dependOn(&shown.step); @import("build/kernel.zig").add(ctx); } |
