summaryrefslogtreecommitdiff
path: root/anim/scenes
diff options
context:
space:
mode:
Diffstat (limited to 'anim/scenes')
-rw-r--r--anim/scenes/gallery.zig19
-rw-r--r--anim/scenes/sqlite.zig25
2 files changed, 24 insertions, 20 deletions
diff --git a/anim/scenes/gallery.zig b/anim/scenes/gallery.zig
index 2cc3d9f..fce9d43 100644
--- a/anim/scenes/gallery.zig
+++ b/anim/scenes/gallery.zig
@@ -98,16 +98,18 @@ fn atoms(u: ui.Ui, p: *const Pages) void {
_ = u.address(350, rows.baseline(y), 0x407030, .{ .ink = ui.rgb(region.heap) });
// byte
- y = 344;
+ y = 330;
title(u, 64, y, "byte");
- note(u, 200, y, "number, pointer, allocator, unread; pad");
+ note(u, 200, y, "number, pointer, text, loose, unread; pad");
y += 12;
{
var values: [16]u8 = .{ 9, 0, 0, 0, 0, 0, 0, 0, 0x30, 0x70, 0x40, 0, 0, 0, 0, 0 };
var known: [16]bool = @splat(true);
rows.bytes(u, y, 0x407050, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number }, .{ .first = 8, .len = 8, .kind = .pointer } }, region.heap, 4, true, m);
values = .{ 0, 0, 0, 0, 0, 0, 0, 0, 0x21, 0, 0, 0, 0, 0, 0, 0 };
- rows.bytes(u, y + row, 0x407060, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .unread }, .{ .first = 8, .len = 8, .kind = .allocator } }, region.heap, 4, false, m);
+ rows.bytes(u, y + row, 0x407060, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .unread }, .{ .first = 8, .len = 8, .kind = .loose } }, region.heap, 4, false, m);
+ values = .{ '.', '/', 'l', 'i', 's', 't', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ rows.bytes(u, y + 2 * row, 0x407070, &values, &known, &.{ .{ .first = 0, .len = 7, .kind = .text }, .{ .first = 7, .len = 9, .kind = .loose } }, region.heap, 4, true, m);
}
// mark, in the context and in a lens's cell
@@ -264,7 +266,7 @@ fn rowsPage(u: ui.Ui, p: *const Pages) void {
y = 750;
title(u, 64, y, "bytes");
- note(u, 160, y, "runs from the types; marks per run: struck, read, held");
+ note(u, 160, y, "runs from the types; marks per run: struck, read, held; read as their types: a char, a bool, an int, a pointer");
y += 12;
panel = u.moved(976, y);
var values: [16]u8 = .{ 12, 0, 0, 0, 0, 0, 0, 0, 0x10, 0x70, 0x40, 0, 0, 0, 0, 0 };
@@ -274,6 +276,15 @@ fn rowsPage(u: ui.Ui, p: *const Pages) void {
rows.bytes(panel, row, 0x407050, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .number }, .{ .first = 8, .len = 8, .kind = .pointer, .heat = .ember } }, region.heap, 4, true, m);
known = @splat(false);
rows.bytes(panel, 2 * row, 0x407060, &values, &known, &.{ .{ .first = 0, .len = 8, .kind = .unread }, .{ .first = 8, .len = 8, .kind = .unread } }, region.heap, 4, false, m);
+ // A struct of a char, a bool, padding, an int and a pointer: each read as its type says.
+ values = .{ 'A', 1, 0, 0, 0xfd, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0 };
+ known = @splat(true);
+ const types = canim.Recording.types;
+ const char: types.Type = .{ .scalar = .{ .kind = .char, .bits = 8 } };
+ const boolean: types.Type = .{ .scalar = .{ .kind = .bool, .bits = 8 } };
+ const int: types.Type = .{ .scalar = .{ .kind = .int, .bits = 32 } };
+ rows.bytes(panel, 3 * row, 0x407080, &values, &known, &.{ .{ .first = 0, .len = 1, .kind = .number }, .{ .first = 1, .len = 1, .kind = .number }, .{ .first = 2, .len = 2, .kind = .loose }, .{ .first = 4, .len = 4, .kind = .number }, .{ .first = 8, .len = 8, .kind = .pointer } }, region.heap, 4, true, m);
+ _ = canim.hexdump.reading(panel, 3 * row, 0, m, &values, &known, &.{ .{ .at = 0, .len = 1, .type = char }, .{ .at = 1, .len = 1, .type = boolean }, .{ .at = 4, .len = 4, .type = int }, .{ .at = 8, .len = 8, .reads = .pointer } });
}
fn frame(s: *anim.Frame) void {
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);