summaryrefslogtreecommitdiff
path: root/anim/src/root.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/root.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/root.zig')
-rw-r--r--anim/src/root.zig20
1 files changed, 15 insertions, 5 deletions
diff --git a/anim/src/root.zig b/anim/src/root.zig
index d8c2c76..84758f8 100644
--- a/anim/src/root.zig
+++ b/anim/src/root.zig
@@ -20,6 +20,8 @@ pub const layout = theme.layout;
pub const ui = @import("ui.zig");
pub const Rect = theme.Rect;
pub const Recording = @import("Recording.zig");
+/// The tracer's reader, for what a scene reads itself (`ztrace.heap.glibc`).
+pub const ztrace = @import("ztrace");
const cursors = @import("cursor.zig");
pub const Cursor = cursors.Cursor;
pub const Now = cursors.Now;
@@ -35,7 +37,9 @@ pub const Stack = contexts.Stack;
pub const Backtrace = contexts.Backtrace;
/// The registers' tag: what an address's ink says.
pub const contextLegend = contexts.legend;
-pub const Disasm = @import("disasm.zig").Disasm;
+pub const disasm = @import("disasm.zig");
+pub const Disasm = disasm.Disasm;
+pub const Descent = @import("descent.zig").Descent;
pub const calls = @import("calls.zig");
pub const CallTree = calls.Tree;
pub const Nodes = @import("nodes.zig").Nodes;
@@ -46,6 +50,7 @@ pub const Place = tying.Place;
pub const Array = @import("array.zig").Array;
pub const Loupe = @import("loupe.zig").Loupe;
pub const syscalls = @import("syscalls.zig");
+pub const descent = @import("descent.zig");
pub const Crossing = syscalls.Crossing;
pub const Timeline = syscalls.Timeline;
pub const objects = @import("objects.zig");
@@ -235,6 +240,10 @@ pub const Context = struct {
/// (eleven rows as subject, five beside), when how the program came
/// to be here is the story; the scene adds the drawing's view.
backtrace: bool = false,
+ /// The disassembly as a `descent`: a call followed down opens its
+ /// callee's window under the call row, and a system call the
+ /// kernel's under the `syscall` (step with `descent.step`).
+ descent: bool = false,
};
/// The ties between the panes, drawn over everything added before.
@@ -268,8 +277,8 @@ pub fn context(s: *anim.Frame, cursor_: Cursor, options: Context.Options) Contex
// The map first: while it fills the frame or falls to the minimap it is under the panels diving out of it.
const whole = s.new(map.Map{ .stage = Stage.init(s, map.split(at.rec, options.split.band.h > 0)), .frame = stage, .t = s.value(map.diving.land + map.diving.still) });
whole.obj = s.custom(whole, .{ .x = -640, .y = -360, .scale = ui.scale });
- whole.add(s, Source{ .cursor = at, .stage = whole.stage });
- whole.add(s, Disasm{ .cursor = at, .stage = whole.stage });
+ whole.add(s, Source{ .cursor = at, .stage = whole.stage, .descent = options.descent });
+ if (options.descent) whole.add(s, Descent{ .cursor = at, .stage = whole.stage }) else whole.add(s, Disasm{ .cursor = at, .stage = whole.stage });
whole.add(s, Registers{ .cursor = at, .stage = whole.stage, .syscalls = options.syscalls, .quiet = options.quiet });
whole.add(s, Stack{ .cursor = at, .stage = whole.stage, .above = theme.map.stack_above });
whole.add(s, Backtrace{ .cursor = at, .stage = whole.stage });
@@ -278,8 +287,8 @@ pub fn context(s: *anim.Frame, cursor_: Cursor, options: Context.Options) Contex
.map = whole,
.cursor = at,
.quiet = options.quiet,
- .source = add(s, Source{ .cursor = at, .stage = stage }),
- .disasm = add(s, Disasm{ .cursor = at, .stage = stage }),
+ .source = add(s, Source{ .cursor = at, .stage = stage, .descent = options.descent }),
+ .disasm = if (options.descent) add(s, Descent{ .cursor = at, .stage = stage }) else add(s, Disasm{ .cursor = at, .stage = stage }),
.registers = add(s, Registers{ .cursor = at, .stage = stage, .syscalls = options.syscalls, .quiet = options.quiet }),
.stack = add(s, Stack{ .cursor = at, .stage = stage }),
.backtrace = add(s, Backtrace{ .cursor = at, .stage = stage, .lens = options.backtrace }),
@@ -344,6 +353,7 @@ test {
_ = rows;
_ = contexts;
_ = @import("disasm.zig");
+ _ = @import("descent.zig");
_ = tying;
_ = @import("hexdump.zig");
_ = calls;