summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 16:03:43 -0300
committerGabriel Schneider <[email protected]>2026-11-10 16:05:20 -0300
commit66a2a7cf733f6abc1f79561c52d901ce67019fb1 (patch)
treeb261d533887b37fb5287ad384d4f845348b35d81 /build.zig
parente0c4bfcc0395a561804e33942028c519f4e267f7 (diff)
downloadcomputeranim-66a2a7cf733f6abc1f79561c52d901ce67019fb1.tar.gz
computeranim-66a2a7cf733f6abc1f79561c52d901ce67019fb1.zip
trace: what the context draws is in the recording; SQLite on the ladder
An instruction's string carries its source line and, for a direct call, how many parameters the callee takes (DWARF); telescope.frames gives each frame's extent on the stack; with --alloc the debugger watches each live allocation and the allocator's header before it, changes only, 256 KiB a stop at most. C++ names are shown and found as the source has them (the command links the C++ runtime for its demangler). SQLite 3.50.4 through every backend, measured (README, bench/sqlite.sh). It found two faults: a file compiled by its full path was recorded under a path joined onto the compile directory, and ztrace run noticed a target's exit up to 10 ms late. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 46650d0..82d4c46 100644
--- a/build.zig
+++ b/build.zig
@@ -63,6 +63,8 @@ pub fn build(b: *std.Build) void {
const ctx: Ctx = .{ .b = b, .target = target, .optimize = optimize, .ztrace = ztrace, .exe = exe, .test_step = b.step("test", "Run every test") };
// The command has a disassembler; the library does not need one.
exe.root_module.linkLibrary(@import("build/capstone.zig").add(ctx));
+ // ... and C++ names as the source has them: the C++ runtime (zig's libc++abi) demangles.
+ exe.root_module.link_libcpp = true;
// The library's own tests, and a target with its own producer recorded
// through the ring.
@@ -113,6 +115,15 @@ pub fn build(b: *std.Build) void {
inline for (.{ "6 breakpoint", "5 alloc", "7 call", "7 ret", " variable", " line" }) |part| shown.expectStdOutMatch(part);
const both = ctx.areaTest("test-together", "The backends on one program, in one recording");
both.dependOn(&shown.step);
+ // ... and read back: what it holds of each allocation.
+ const together_path = b.addOptions();
+ together_path.addOptionPath("together", recording);
+ both.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = b.createModule(.{
+ .root_source_file = b.path("src/trace/together_test.zig"),
+ .target = target,
+ .optimize = optimize,
+ .imports = &.{ .{ .name = "ztrace", .module = ztrace }, .{ .name = "recording", .module = together_path.createModule() } },
+ }) })).step);
// ... and the kernel's view with the program's own: a list's
// allocations among the page faults of the heap they grow.