summaryrefslogtreecommitdiff
path: root/anim/scenes/sqlite.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/scenes/sqlite.zig')
-rw-r--r--anim/scenes/sqlite.zig25
1 files changed, 9 insertions, 16 deletions
diff --git a/anim/scenes/sqlite.zig b/anim/scenes/sqlite.zig
index f145da6..e7d103e 100644
--- a/anim/scenes/sqlite.zig
+++ b/anim/scenes/sqlite.zig
@@ -103,18 +103,17 @@ fn frame(s: *anim.Frame) void {
var at = canim.cursor(s, rec, start);
at.levels = .{ .source_rows = 10 };
at.journey(.moment, back);
- // The lens is the subject: the call chain, eleven rows, over the
+ // The lens is the subject: the backtrace, eleven rows, over the
// program column (where the kernel's side comes later), and over the
// state column the bytes the newest call is handed.
- var split = canim.layout.split.subject;
- split.backtrace = split.band;
- const ctx = canim.context(s, at, .{ .split = split, .syscalls = true });
+ const ctx = canim.context(s, at, .{ .split = canim.layout.split.subject, .syscalls = true, .backtrace = true });
const kernel = canim.crossing(s, .{ .cursor = at, .stage = ctx.stage, .view = false });
// What the opening stop's rbx points at: the SQL sqlite3_exec is running.
const sql = canim.add(s, canim.hexdump.Dump{
.cursor = at,
.stage = ctx.stage,
.about = "the SQL being run, at rbx",
+ .since = start,
.of = .{ .base = rec.register(start, "rbx"), .len = 32, .fields = &.{.{ .at = 0, .len = 32, .reads = .text }}, .region = region.rodata },
});
// The row, as sqlite3BtreeInsert is handed it: rsi.
@@ -126,6 +125,7 @@ fn frame(s: *anim.Frame) void {
.about = "pX, the row: a BtreePayload, at rsi",
.of = .{ .base = rec.register(first, "rsi"), .len = 48, .fields = &payload, .region = region.stack },
.marks = row_marks,
+ .since = first,
});
// The page, as unixWrite is handed it: rsi. At that stop the debugger
// has read 32 bytes of it (where rsi leads); the kernel takes it whole.
@@ -140,6 +140,7 @@ fn frame(s: *anim.Frame) void {
.about = "pBuf: page 2 of t.db, at rsi",
.of = .{ .base = write.args[1], .len = 4096, .fields = leaf(s.arena, bytes), .region = region.heap, .seen = .{ .addr = write.args[1], .len = 32 } },
.marks = page_marks,
+ .since = handed,
});
const joins = ctx.ties(s);
var says: canim.Narrator = .{};
@@ -165,19 +166,11 @@ fn frame(s: *anim.Frame) void {
}
}
};
- // A continue: straight to the next stop, timed by what it changed.
- const walk = struct {
- fn to(c: canim.Cursor, f: *anim.Frame, moment: u64) void {
- const plan = c.reading(c.moment(f), moment);
- c.step(f, moment, plan, plan.total);
- }
- }.to;
-
canim.establish(s, .{ ctx.clock, ctx.registers, ctx.stack, ctx.source, ctx.disasm, sql, ctx.backtrace, joins });
says.line(s, "SQLite at a breakpoint in `sqlite3_step`, which runs\n`INSERT INTO t VALUES ('alpha')`. Continue:");
// What rbx showed was this stop's: it goes before the program moves on.
fade.out(s, sql);
- walk(at, s, first);
+ at.@"continue"(s, first);
s.wait(t.beat);
// The row it was handed: a struct on its caller's stack.
fade.in(s, row);
@@ -190,13 +183,13 @@ fn frame(s: *anim.Frame) void {
says.line(s, "Two more continues, the same call: rowid 2, then 3, records\nof 6 and 7 bytes. The rows are in memory, not yet on disk.");
mark.out(s, row_marks);
- walk(at, s, second);
+ at.@"continue"(s, second);
s.wait(t.beat);
- walk(at, s, third);
+ at.@"continue"(s, third);
says.line(s, "`COMMIT`: `unixWrite`, nine calls under `main`, is handed\npage 2 of the file: 4096 bytes, for offset 4096.");
fade.out(s, row);
- walk(at, s, handed);
+ at.@"continue"(s, handed);
s.wait(t.beat);
fade.in(s, page);