diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 13:22:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-11 13:26:44 -0300 |
| commit | 2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c (patch) | |
| tree | 140a291011e453888ed87b7a43d75f538abb9fae /anim/src/root.zig | |
| parent | 576a78b4de02c4c6566c327d85c465554d293975 (diff) | |
| download | computeranim-2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c.tar.gz computeranim-2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c.zip | |
canim: the graph of a function's blocks
From the user. A blocks lens draws a function's basic blocks as boxes
with their offsets and visit counts, loops in their lanes with the turn
count, the path's last edges gold, the pc's block gold, and the
disassembly as its view; leave and turn carry the mark along an edge,
with the compare's flags framed for the edge chosen. On the map the
graph takes the disassembly's place with its rows. The layout is a pure
function, tested on sort, reverse and libc's open (twelve blocks the run
never reached fold into six boxes). The sort scene walks one trip of its
inner loop block by block and sprints the middle on the map. Every
scene's linear rows carry a rule and a count at each block's head. The
stack's panel no longer reads registers from the file on every draw: a
frame is 20 ms where it was 57.
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.zig | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/anim/src/root.zig b/anim/src/root.zig index 60ae6dc..b7be9b4 100644 --- a/anim/src/root.zig +++ b/anim/src/root.zig @@ -42,6 +42,7 @@ pub const contextLegend = contexts.legend; pub const disasm = @import("disasm.zig"); pub const Disasm = disasm.Disasm; pub const Descent = @import("descent.zig").Descent; +pub const graph = @import("graph.zig"); pub const calls = @import("calls.zig"); pub const CallTree = calls.Tree; pub const Nodes = @import("nodes.zig").Nodes; @@ -246,6 +247,10 @@ pub const Context = struct { /// callee's window under the call row, and a system call the /// kernel's under the `syscall` (step with `descent.step`). descent: bool = false, + /// On the map the disassembly as the function's graph (`graph.Map`), + /// two columns wide beside the source, the registers and the stack + /// in the last column. + graph: bool = false, }; /// The ties between the panes, drawn over everything added before. @@ -284,11 +289,11 @@ pub fn context(s: *anim.Frame, cursor_: Cursor, options: Context.Options) Contex var at = cursor_; at.levels.crossings = options.syscalls; // 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, .{ at.first, at.last })), .frame = stage, .t = s.value(map.diving.land + map.diving.still), .cursor = at }); + const whole = s.new(map.Map{ .stage = Stage.init(s, map.split(at.rec, options.split.band.h > 0, .{ at.first, at.last }, options.graph)), .frame = stage, .t = s.value(map.diving.land + map.diving.still), .cursor = at, .graph = options.graph }); whole.obj = s.custom(whole, .{ .x = -640, .y = -360, .scale = ui.scale }); whole.add(s, Source{ .cursor = at, .stage = whole.stage, .descent = options.descent }); whole.add(s, Source{ .cursor = at, .stage = whole.stage, .descent = options.descent, .part = .source_more }); - if (options.descent) whole.add(s, Descent{ .cursor = at, .stage = whole.stage }) else whole.add(s, Disasm{ .cursor = at, .stage = whole.stage }); + if (options.graph) whole.add(s, graph.Map{ .cursor = at, .stage = whole.stage }) else 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 }); // The stack goes on in the rest of the memory's column, from where its own column ends. @@ -367,6 +372,7 @@ test { _ = contexts; _ = @import("disasm.zig"); _ = @import("descent.zig"); + _ = graph; _ = tying; _ = @import("hexdump.zig"); _ = calls; |
