summaryrefslogtreecommitdiff
path: root/anim/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 06:49:10 -0300
committerGabriel Schneider <[email protected]>2026-11-11 06:50:11 -0300
commit378379807fb4cd751e90808c8363caddb365bcd8 (patch)
treef84c7d0e7cbd42a9b9c93e791ab2b5376499d23d /anim/build.zig
parent5922ee911b9a6604f60dc83be36ba9e6c9abac98 (diff)
downloadcomputeranim-378379807fb4cd751e90808c8363caddb365bcd8.tar.gz
computeranim-378379807fb4cd751e90808c8363caddb365bcd8.zip
canim: nothing changes in one frame; the map's space is used; the heap scene at its storyboard's length
The motion check counts a third of the one-frame changes it did: the minimap's changes fade, and a register's value, a flag, a role, a pin's names, a tag's note, a backtrace row, a call tree's node and a dump row crossfade where they changed at once. What still fires is named in the README; an encoder's keyframe and the gallery's cuts are exempt by name. No caption stands over twelve seconds or under its reading time. The heap scene is 78 s: what the storyboard does not narrate runs, and each free's line cascades onto its call row (line stepping stops at a breakpoint for that). On the map, leftover space holds the stack continued, dumps round what the registers and the stack point at, open loupes and the key: between 1% and 13% of a map is page, where it was 14% to 42%. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/build.zig')
-rw-r--r--anim/build.zig21
1 files changed, 18 insertions, 3 deletions
diff --git a/anim/build.zig b/anim/build.zig
index d12912d..5601e39 100644
--- a/anim/build.zig
+++ b/anim/build.zig
@@ -87,6 +87,10 @@ pub fn build(b: *std.Build) void {
/// Also glibc's heap at every stop (`--heap`), and memory watched (`-w`).
heap: bool = false,
watch: []const []const u8 = &.{},
+ /// Also a stop at the call, in function [0], of function [1] through
+ /// its PLT stub (found by objdump: there is no name for it): the row
+ /// a line's cascade lands on before the call is stepped over.
+ break_call: ?[2][]const u8 = null,
};
for ([_]Recording{
.{ .name = "steps", .source = "fib.c", .by = "insn" },
@@ -94,7 +98,7 @@ pub fn build(b: *std.Build) void {
// the kernel and back: the descent; to main's return.
.{ .name = "hello", .source = "hello.c", .by = "insn", .from = "main", .steps = "132", .glibc = true, .reads = "note" },
// A line a stop, malloc and free run through; glibc's heap at each.
- .{ .name = "heap", .source = "heap.c", .by = "line", .from = "main", .glibc = true, .heap = true, .watch = &.{ "0x405000,1024", "head" } },
+ .{ .name = "heap", .source = "heap.c", .by = "line", .from = "main", .glibc = true, .heap = true, .watch = &.{ "0x405000,1024", "head" }, .break_call = .{ "pop", "free" } },
// By instruction, as `steps` is: the registers are the program's
// own, so they strike and link. Only the variables the scenes name
// are told by the instrumentation (each a call into its runtime,
@@ -135,13 +139,24 @@ pub fn build(b: *std.Build) void {
const where = b.addWriteFiles();
_ = where.addCopyFile(program, r.name);
if (r.reads) |name| _ = where.addCopyFile(b.path(b.fmt("tools/{s}", .{name})), name);
- const run = b.addSystemCommand(&.{ "env", "-i", "setarch", "-R" });
+ const run = if (r.break_call) |call| blk: {
+ // The call's address, from the program as built, then the recorder with a breakpoint there.
+ const sh = b.addSystemCommand(&.{ "sh", "-c", b.fmt(
+ \\p=$0 z=$1; shift
+ \\at=$(objdump -d --no-show-raw-insn "$p" | awk '/<{s}>:/ {{ f = 1 }} f && /call.*<{s}@plt>/ {{ sub(":", "", $1); print "0x" $1; exit }}')
+ \\[ -n "$at" ] || {{ echo "no call of {s} in {s}" >&2; exit 1; }}
+ \\exec env -i setarch -R "$z" record -b "*$at" "$@"
+ , .{ call[0], call[1], call[1], call[0] }) });
+ sh.addFileArg(program);
+ break :blk sh;
+ } else b.addSystemCommand(&.{ "env", "-i", "setarch", "-R" });
run.addArtifactArg(ztrace);
// More round each stop than the working frame shows: the map of
// the whole context wants the words of the stack, 256 bytes round
// what a pointer leads to and what a step touches, and 69
// instructions round the pc.
- run.addArgs(&.{ "record", "--by", r.by, "--stack", r.stack, "--around", "256", "--disasm", "69", "-s", "64" });
+ if (r.break_call == null) run.addArg("record");
+ run.addArgs(&.{ "--by", r.by, "--stack", r.stack, "--around", "256", "--disasm", "69", "-s", "64" });
if (r.from) |place| run.addArgs(&.{ "--from", place });
if (r.steps) |n| run.addArgs(&.{ "--steps", n });
if (r.heap) run.addArg("--heap");