summaryrefslogtreecommitdiff
path: root/src/trace/event.zig
diff options
context:
space:
mode:
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);