From c3d9f7ba5effd615374b1359ad98ecf801559f83 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 00:06:30 -0300 Subject: 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 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- anim/src/calls.zig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'anim/src/calls.zig') diff --git a/anim/src/calls.zig b/anim/src/calls.zig index 5eef946..d78c26c 100644 --- a/anim/src/calls.zig +++ b/anim/src/calls.zig @@ -127,8 +127,8 @@ pub const Tree = struct { } } - /// Its view: the backtrace, the waiting path read as rows, newest on - /// top, with each call's arguments (`n=4`) and where it is. + /// Its view: the backtrace, the waiting path read as rows, newest at + /// the bottom, with each call's arguments (`n=4`) and where it is. fn backtrace(k: *const Tree, f: *sk.Frame, at: anim.Placed) void { const box = k.stage.box(at, .view); const cm = theme.metric.context; @@ -143,10 +143,12 @@ pub const Tree = struct { var buf: [24]context.Frame = undefined; const chain = context.frames(rec, moment, &buf); const room = theme.layout.rowsIn(box.h); - const body = u.panel(box.w, box.h, "backtrace", .{ .note = if (chain.len > room) u.print("the calls waiting \u{00b7} newest on top \u{00b7} {d} more", .{chain.len - room}) else "the calls waiting \u{00b7} newest on top" }); + const body = u.panel(box.w, box.h, "backtrace", .{ .note = u.print("the calls waiting \u{00b7} {s}", .{context.newestAtBottom(u, chain.len, room)}) }); const open = rec.stack(f.scratch, moment); - for (chain[0..@min(chain.len, room)], 0..) |frame, i| { - const y = body.y + cm.pad + @as(f32, @floatFromInt(i)) * cm.row; + // Newest at the bottom, as the tree grows down beside it; the oldest go from the top. + const shown = @min(chain.len, room); + for (chain[0..shown], 0..) |frame, i| { + const y = body.y + cm.pad + @as(f32, @floatFromInt(shown - 1 - i)) * cm.row; const name = ui.symbol(u, rec.strings.get(frame.pc) orelse u.print("{x}", .{frame.pc})); // The call this frame is, by its place on the chain: its arguments. rows.callRow(u, y, box.w, i, name, context.callArguments(u, rec, open, i, frame.pc), context.frameWhere(u, rec, now.marked(), i, frame.pc), i == 0); -- cgit v1.3