summaryrefslogtreecommitdiff
path: root/src/cli/dbg.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/dbg.zig')
-rw-r--r--src/cli/dbg.zig9
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;