diff options
Diffstat (limited to 'src/cli/show.zig')
| -rw-r--r-- | src/cli/show.zig | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/cli/show.zig b/src/cli/show.zig index 7019113..ef05e7a 100644 --- a/src/cli/show.zig +++ b/src/cli/show.zig @@ -135,7 +135,16 @@ pub fn state(arena: std.mem.Allocator, trace: *zt.Trace, index: u64, w: *std.Io. if (chain.len > 1) try w.writeAll("\n"); if (chain.len > 1) for (chain, 0..) |pc, depth| { var text: [256]u8 = undefined; - try w.print(" #{d} {x} {s}\n", .{ depth, pc, (try m.string(pc, &text)) orelse "" }); + try w.print(" #{d} {x} {s}", .{ depth, pc, (try m.string(pc, &text)) orelse "" }); + // Its line, as `bt` gives it: the pc's, a caller's call's (recorded `back` from where it returns). + var at = pc; + if (depth > 0) if (try zt.telescope.instruction(m, pc, &text)) |after| { + at -= after.back; + }; + if (try zt.telescope.instruction(m, at, &text)) |insn| if (insn.line) |l| { + try w.print(" ({s}:{d})", .{ std.fs.path.basename(try name(m, arena, l.file)), l.line }); + }; + try w.writeAll("\n"); }; } for (try m.stack(arena, tid), 0..) |frame, depth| { @@ -169,10 +178,22 @@ pub fn state(arena: std.mem.Allocator, trace: *zt.Trace, index: u64, w: *std.Io. const mappings = try m.mappings(arena); if (mappings.len > 0) try w.writeAll("\nmappings\n"); + var last: []const u8 = ""; for (mappings) |region| { var path: []const u8 = ""; var path_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; _ = try m.mapping(region.addr, &path, &path_buf); - try w.print(" {x:0>12}-{x:0>12} {s}\n", .{ region.addr, region.addr + region.len, path }); + try w.print(" {x:0>12}-{x:0>12} {s}", .{ region.addr, region.addr + region.len, path }); + // A module, once: which build it is, and whether its names come from its own debug info. + if (!std.mem.eql(u8, path, last)) if (zt.telescope.module(m, path)) |module| { + if (module.build_id.len > 0) try w.print(" build-id {x},", .{module.build_id}) else try w.writeAll(" no build id,"); + try w.print(" debug info {s}", .{switch (module.debug) { + .none => "none", + .own => "in the file", + .separate => "separate, of the same build", + } }); + }; + last = try arena.dupe(u8, path); + try w.writeAll("\n"); } } |
