summaryrefslogtreecommitdiff
path: root/src/trace/event.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/trace/event.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/trace/event.zig')
-rw-r--r--src/trace/event.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/trace/event.zig b/src/trace/event.zig
index dcd4aa9..02deb51 100644
--- a/src/trace/event.zig
+++ b/src/trace/event.zig
@@ -187,6 +187,17 @@ pub fn codeId(addr: u64) u64 {
return addr | 1 << 62;
}
+/// The id of the string that describes the frame of the function that
+/// begins at `addr`: how to walk through it to its caller (its call frame
+/// information) and where its locals are (`Debugger.emitFunction`). A
+/// reader finds the one that holds a pc as the greatest id at or below the
+/// pc's (`Trace.stringBelow`). `frameId(0)`, where no function begins, is
+/// the process's first stack (`Debugger.Start`). Bit 61 keeps these apart
+/// from names, instructions and hashed ids.
+pub fn frameId(addr: u64) u64 {
+ return addr | 1 << 61;
+}
+
pub fn now() u64 {
var ts: std.os.linux.timespec = undefined;
_ = std.os.linux.clock_gettime(.MONOTONIC, &ts);