diff options
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); } |
