summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig21
1 files changed, 19 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index 7569650..e7dd08a 100644
--- a/build.zig
+++ b/build.zig
@@ -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);
}