diff options
Diffstat (limited to 'src/cli/show.zig')
| -rw-r--r-- | src/cli/show.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cli/show.zig b/src/cli/show.zig index 057b210..35cc928 100644 --- a/src/cli/show.zig +++ b/src/cli/show.zig @@ -114,6 +114,17 @@ pub fn state(arena: std.mem.Allocator, trace: *zt.Trace, index: u64, w: *std.Io. try w.writeAll("\n"); } } + if (try m.regs(tid)) |regs| { + // The call chain, by frame pointer; the calls the program itself + // reported (instrumentation, hooks) follow it when there are any. + var frames: [32]u64 = undefined; + const chain = try zt.telescope.backtrace(m, ®s, &frames); + 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 "" }); + }; + } for (try m.stack(arena, tid), 0..) |frame, depth| { try w.print(" #{d} {s} from {x} sp {x}\n", .{ depth, try name(m, arena, frame.function), frame.site, frame.sp }); } |
