summaryrefslogtreecommitdiff
path: root/anim/src/rows.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 00:06:30 -0300
committerGabriel Schneider <[email protected]>2026-11-11 01:16:48 -0300
commitc3d9f7ba5effd615374b1359ad98ecf801559f83 (patch)
tree07f85932abc1df23c722bcd1bd1b3b65bca28f2e /anim/src/rows.zig
parentc94ade9e77a811d3ff75ffc2889a65375262ab1f (diff)
downloadcomputeranim-c3d9f7ba5effd615374b1359ad98ecf801559f83.tar.gz
computeranim-c3d9f7ba5effd615374b1359ad98ecf801559f83.zip
canim: a call followed down to the kernel; rows that say what they do; the heap from the inside
From the user. The disassembly can descend: the syscalls scene is glibc's hello by instruction, and open is followed from main through its PLT stub, whose jmp reads the GOT, into libc's wrapper to the syscall row, which crosses to the kernel's window under it, and back up. The band keeps the calls so far as strace writes them. Operands lose their size words and show a width as byte cells only where nothing else says it. A compare shows its values and the flags it leaves, a jump the flags it reads, lea its result, an indirect jump its target and the slot it read, a call that has run its C form. The backtrace has its newest frame at the bottom. A new scene shows glibc 2.44's heap from blocks that exist: chunks read by fields (a size with its bits, a protected pointer), the free list as arcs, the tcache in a loupe, the program's list over malloc's own. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/rows.zig')
-rw-r--r--anim/src/rows.zig12
1 files changed, 7 insertions, 5 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig
index 83064a6..1d097a1 100644
--- a/anim/src/rows.zig
+++ b/anim/src/rows.zig
@@ -125,8 +125,8 @@ pub fn chain(u: ui.Ui, x: f32, y: f32, moment: Recording.Moment, value: u64, roo
if (link.string) {
// What a pointer leads to, when it is text: quoted, cut to the room
// there is (never under six characters), with `…` and no closing quote.
- const fits: usize = @intFromFloat(@max((room - at - m.arrow_w) / adv, 0));
- if (fits < m.string_min + 2) break;
+ const fits: usize = @intFromFloat(std.math.clamp((room - at - m.arrow_w) / adv, 0, 4096));
+ if (fits < @as(usize, @min(m.string_min, link.text.len)) + 2) break;
at = v.arrow(at, mid, .holds);
const whole = link.text.len + 2 <= fits;
const text = if (whole) u.print("\"{s}\"", .{link.text}) else u.print("\"{s}\u{2026}", .{link.text[0 .. fits - 2]});
@@ -167,9 +167,10 @@ pub const flags = [_]Flag{ .{ .name = "CF", .bit = 0 }, .{ .name = "PF", .bit =
/// code's ink and its name; never struck. At its right end the `flags`,
/// eight names on a pitch of 42: set, upper case on a chip, bold, bright;
/// clear, lower case, dim; changed, a turned corner (`changed`: a bit per
-/// flag, and how much of the corner shows). The value of eflags is not
-/// drawn: the names are the value.
-pub fn rip(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, pc: u64, eflags: u64, changed: u64, held: f32, fire: f32) void {
+/// flag, and how much of the corner shows); read, framed (`read`: a bit per
+/// flag, while a conditional reads them: an echo of the row that set them,
+/// `read_shows` how much). The value of eflags is not drawn: the names are the value.
+pub fn rip(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, pc: u64, eflags: u64, changed: u64, held: f32, fire: f32, read: u64, read_shows: f32) void {
const gold = theme.mark(.current);
u.current(.{ .x = theme.stroke.rule, .y = y, .w = w - 2 * theme.stroke.rule, .h = row_h }, theme.metric.plaque.rip, fire);
u.text(.mono_bold, size, m.side, baseline(y), "rip", gold.on_solid);
@@ -183,6 +184,7 @@ pub fn rip(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, pc: u64, eflags:
u.text(.mono_bold, size, x + 4, baseline(y), flag.name, t.bright);
} else u.text(.mono, size, x + 4, baseline(y), u.print("{c}{c}", .{ std.ascii.toLower(flag.name[0]), std.ascii.toLower(flag.name[1]) }), ui.mix(t.dim, gold.ember, 0.2));
if (changed >> flag.bit & 1 != 0) u.corner(x, y + 2, m.corner, held);
+ if (read >> flag.bit & 1 != 0 and read_shows > 0) u.read(.{ .x = x, .y = y + 2, .w = fl.chip[0], .h = fl.chip[1] }, read_shows);
x += fl.pitch;
}
}