diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 14:12:08 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 14:12:42 -0300 |
| commit | e2fa716dcda7de877908de006adc34f0c3593693 (patch) | |
| tree | 7baa2294bd73871ca3eefc9dec6eb93bc07433fc /src/cli/dbg.zig | |
| parent | 02aa51a6f54235cf18e627dbbfe21f21e502eb0b (diff) | |
| download | computeranim-e2fa716dcda7de877908de006adc34f0c3593693.tar.gz computeranim-e2fa716dcda7de877908de006adc34f0c3593693.zip | |
ztrace dbg: context, everything at the moment looked at, pwndbg's way
Diffstat (limited to 'src/cli/dbg.zig')
| -rw-r--r-- | src/cli/dbg.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cli/dbg.zig b/src/cli/dbg.zig index e59c40a..22923be 100644 --- a/src/cli/dbg.zig +++ b/src/cli/dbg.zig @@ -4,6 +4,7 @@ const std = @import("std"); const zt = @import("ztrace"); const util = @import("util.zig"); const disasm = @import("disasm.zig"); +const show_cmd = @import("show.zig"); const fail = util.fail; const Moment = zt.store.Moment; @@ -24,6 +25,8 @@ pub const usage = \\ regs the registers \\ x WHAT [LEN] memory at an address, a symbol or $register (64 bytes) \\ bt the call chain, by frame pointer + \\ context, ctx everything at once, pwndbg's way: registers followed + \\ as pointers, the instructions at the pc, the stack \\ back [N] look N moments back in the recording: regs, x \\ forward [N] and bt then show the program as it was. The \\ goto MOMENT program itself stays where it stopped last @@ -231,6 +234,12 @@ const Session = struct { try s.d.describe(s.w, pc); try s.w.writeAll("\n"); } + } else if (is(cmd, "context", "ctx")) { + // The whole of the moment looked at, as `ztrace show` prints it. + const t = try s.recording(); + var arena: std.heap.ArenaAllocator = .init(s.gpa); + defer arena.deinit(); + try show_cmd.state(arena.allocator(), t, s.view orelse t.len - 1, s.w, std.Io.File.stdout().isTty(s.io) catch false); } else if (is(cmd, "back", "forward") or is(cmd, "goto", "goto")) { const t = try s.recording(); const n = if (arg) |a| try std.fmt.parseInt(u64, a, 10) else if (is(cmd, "goto", "goto")) return error.MissingArgument else 1; |
