summaryrefslogtreecommitdiff
path: root/anim/test/recordings.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 23:46:02 -0300
committerGabriel Schneider <[email protected]>2026-11-12 01:40:04 -0300
commit60e07feef401d9044db3a1c925cb9d1f6d20dac9 (patch)
tree98957ba8425193f686c8e8692cd10a10f27dbf4b /anim/test/recordings.zig
parent9c0696447dbc5cf37e56aee562c7ebba4f4d4e6b (diff)
downloadcomputeranim-60e07feef401d9044db3a1c925cb9d1f6d20dac9.tar.gz
computeranim-60e07feef401d9044db3a1c925cb9d1f6d20dac9.zip
canim: relations as one data-oriented subsystem; aim; the ASan pair; the introduction's chapters
From the user. Relations between panes are one subsystem: per-frame tables of places and values in struct-of-arrays, owned by the frame; the kinds one table of data; a resolver of pure passes (join, filter, priority, cut) unit-tested on hand-written tables. Ported kinds draw byte-identical frames; a synthetic map of 4000 places and 6000 values resolves in 0.56 ms against the old table's 5.7. aim, a word holding a code address tied to its row, is the first new kind, off unless a scene turns it on. The ASan pair: one overflow built plain and with ASan, recorded by instruction; the frame as bytes eight a row; the plain run goes on alone in the column, its return address aimed at main's row until the letters reach it; the fault at ret. The introduction's three chapters are built and tested, not yet exported. Annotations, rows and scrolls that changed in one frame now fade; captions stand twelve seconds at most. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/test/recordings.zig')
-rw-r--r--anim/test/recordings.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/anim/test/recordings.zig b/anim/test/recordings.zig
index 5f9ceb3..31cefdb 100644
--- a/anim/test/recordings.zig
+++ b/anim/test/recordings.zig
@@ -341,3 +341,28 @@ test "the source follows the pc into musl's own files and back to main's line" {
for (files) |seen| try expect(seen);
try expect(back);
}
+
+test "the pair's runs: plain faults at its ret on the letters; ASan stops at the first byte past buf, its shadow f3" {
+ const plain = canim.open(recordings.overflow);
+ const asan = canim.open(recordings.overflow_asan);
+ const report = canim.open(recordings.overflow_report);
+ var buf: [256]u8 = undefined;
+ // Plain: the run ends at a `ret` whose return address is all letters (the signal's stop, rip still on it).
+ var last = plain.end() - 1;
+ while (last > 0) : (last -= 1) {
+ const here = plain.instruction(last, plain.register(last, "rip"), &buf) orelse continue;
+ if (std.mem.eql(u8, here.text, "ret")) break;
+ }
+ try expectEqual(@as(?u64, 0x4141414141414141), try canim.Recording.word(plain.moment(last), plain.register(last, "rsp"), 8));
+ // ASan: its last moment is the report's first instruction, rdi the byte past buf: f3; buf's last byte addressable.
+ const at = asan.end() - 1;
+ const past = asan.register(at, "rdi");
+ try expectEqual(@as(?u8, 0xf3), (try canim.ztrace.telescope.shadow(asan.moment(at), past)).?.value);
+ try expectEqual(@as(?u8, 0), (try canim.ztrace.telescope.shadow(asan.moment(at), past - 1)).?.value);
+ // Its report, as written to fd 2, names it; the run exits 1.
+ var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
+ defer arena.deinit();
+ const said = canim.pair.Report.stderr(report, arena.allocator());
+ try expect(std.mem.indexOf(u8, said, "stack-buffer-overflow") != null);
+ try expectEqual(@as(?u64, 1), canim.pair.Report.status(report));
+}