diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 14:43:13 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-11 16:17:33 -0300 |
| commit | 3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6 (patch) | |
| tree | f1bc91879a447f178dfaba39d0df107d01e557bd /anim/src/context.zig | |
| parent | a72831d5c322078260314c305ddd940e4967947d (diff) | |
| download | computeranim-3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6.tar.gz computeranim-3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6.zip | |
canim: a minimap in each pane; source wherever it can be had, libc's included
From the user. Each pane with more than it shows carries a strip of its
whole column at its right edge, the pane's window outlined and what
happens off it marked there; the corner minimap is gone and the dive
folds each column of the map into its pane's strip. The source panel
follows the pc into any file the build has: glibc's own, from the
distro's debuginfod by an optional step that caches them by build id
(zig build sources; nothing else touches the network), and musl's, from
Zig's lib directory. The syscalls scene shows open64.c on the way down,
and a new scene follows the same call through a Zig-built musl. A
graph's counts and inks are as of the moment shown.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/context.zig')
| -rw-r--r-- | anim/src/context.zig | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/anim/src/context.zig b/anim/src/context.zig index 55ff9d6..15ece55 100644 --- a/anim/src/context.zig +++ b/anim/src/context.zig @@ -298,17 +298,17 @@ pub fn callArguments(u: ui.Ui, rec: *const Recording, open: []const Recording.Ca /// not); an older one on its call's line, or where the recording only /// knows a line near its return address, that one. pub fn frameWhere(u: ui.Ui, rec: *const Recording, moment: u64, i: usize, pc: u64) []const u8 { - const line = if (i == 0) rec.ownLine(moment) else callLine(rec, moment, pc) orelse rec.lineOf(pc); - return if (line) |l| u.print("{s}:{d}", .{ rec.file, l }) else ""; + const place = if (i == 0) rec.where(moment, pc) else rec.where(moment, callOf(rec, moment, pc) orelse pc); + return if (place) |l| u.print("{s}:{d}", .{ l.file, l.line }) else ""; } -/// The line of the call that returns to `ret`, where the recording has it: -/// an outer frame is on its call's line, not on the one it returns to. -fn callLine(rec: *const Recording, moment: u64, ret: u64) ?u32 { +/// The call that returns to `ret`, where the recording has it: an outer +/// frame is on its call's line, not on the one it returns to. +fn callOf(rec: *const Recording, moment: u64, ret: u64) ?u64 { var buf: [256]u8 = undefined; const after = rec.instruction(moment, ret, &buf) orelse return null; if (after.back == 0) return null; - return (rec.instruction(moment, ret - after.back, &buf) orelse return null).line; + return ret - after.back; } /// A frame's name: its function's (no offset), or its module's and offset where there is no symbol. @@ -529,10 +529,10 @@ pub const Stack = struct { if (slot_shows <= 0) continue; const vs = v.faded(slot_shows); // A frame's name beside this row: the chain ends a character before it. - var room_w = box.w; + var room_w = map.content(box.w); for (spans[0..n_spans]) |sp| { const mid = (sp.y0 + sp.y1) / 2; - if (mid + m.row / 2 > y and mid - m.row / 2 < y + m.row) room_w = @min(room_w, rows.spanNameX(u, box.w, sp.name) - ui.advance(theme.size.mono.context) + theme.metric.slot.room); + if (mid + m.row / 2 > y and mid - m.row / 2 < y + m.row) room_w = @min(room_w, rows.spanNameX(u, map.content(box.w), sp.name) - ui.advance(theme.size.mono.context) + theme.metric.slot.room); } var gap: f32 = 0; if (lone) |name| { @@ -605,10 +605,11 @@ pub const Stack = struct { u.pinRow(x, top + place * m.row, if (both) &.{ "rsp", "rbp" } else &.{name}, theme.color.region.stack); } for (spans[0..n_spans]) |sp| if (sp.was) |was_name| { - rows.span(v.faded(1 - renamed), box.w, sp.y0, sp.y1, was_name, sp.newest, sp.open); - rows.span(v.faded(renamed), box.w, sp.y0, sp.y1, sp.name, sp.newest, sp.open); - } else rows.span(v, box.w, sp.y0, sp.y1, sp.name, sp.newest, sp.open); + rows.span(v.faded(1 - renamed), map.content(box.w), sp.y0, sp.y1, was_name, sp.newest, sp.open); + rows.span(v.faded(renamed), map.content(box.w), sp.y0, sp.y1, sp.name, sp.newest, sp.open); + } else rows.span(v, map.content(box.w), sp.y0, sp.y1, sp.name, sp.newest, sp.open); veiled(u, box, now.veil); + if (k.part == .stack) map.strip(.stack, u, box); } /// A slot's role as the catalogue writes it: `saved rbx` (dim); a |
