diff options
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 |
