summaryrefslogtreecommitdiff
path: root/src/cli/dbg.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 22:51:17 -0300
committerGabriel Schneider <[email protected]>2026-11-10 23:04:17 -0300
commitb4ab1d770edb06d3eeebfd290bbf97725e55b7fa (patch)
tree75c0b876f4dde764e50e21c4faf9963887f63b44 /src/cli/dbg.zig
parentfa5d150ac6977264f0704e9af664f8150bd25127 (diff)
downloadcomputeranim-b4ab1d770edb06d3eeebfd290bbf97725e55b7fa.tar.gz
computeranim-b4ab1d770edb06d3eeebfd290bbf97725e55b7fa.zip
trace: the call chain by the unwind tables; what each word of the stack is
backtrace and frames follow .debug_frame or .eh_frame where there is one (PLT entries expanded into exact rows) and the frame pointer where there is none: the caller is no longer lost in a prologue, in a function that keeps no frame, in a PLT entry or inside libc's syscall wrappers. Against gdb: the same chains on fib and on SQLite, where the old walk lost __sbrk and unixSync. A recording holds, once a function, its unwind rows and its locals on the stack (DW_OP_fbreg, with the block each lives in), and the process's first stack pointer. telescope.slots says of each word what it is: a saved register and which, a return address, a local by name, argc, argv, envp, auxv. Four bytes a moment on the list by instruction, and no slower. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'src/cli/dbg.zig')
-rw-r--r--src/cli/dbg.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cli/dbg.zig b/src/cli/dbg.zig
index 5fcf88e..c60bff2 100644
--- a/src/cli/dbg.zig
+++ b/src/cli/dbg.zig
@@ -24,7 +24,7 @@ pub const usage =
\\ watch WHAT [LEN] record a region at every stop: an address or a symbol
\\ regs the registers
\\ x WHAT [LEN] memory at an address, a symbol or $register (64 bytes)
- \\ bt the call chain, by frame pointer
+ \\ bt the call chain, by the unwind tables or the 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
@@ -301,6 +301,11 @@ const Session = struct {
mem.s.fetch(mem.m, addr, buf, known[0..buf.len]) catch return 0;
return std.mem.indexOfScalar(bool, known[0..buf.len], false) orelse buf.len;
}
+
+ /// The program's call frame information, the same now as at any moment.
+ pub fn cfi(mem: Memory, pc: u64) ?zt.Symbols.Cfi {
+ return mem.s.d.cfi(pc);
+ }
};
/// The stop the program is at now.