From a7504c6bb2ec9e906891e42bc3df28b276e67143 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:09:27 -0300 Subject: the backends together: a ring under the debugger, strings that do not collide ztrace record and dbg take --ring, --preload and --alloc: the target gets the ring ztrace run gives it, and the debugger drains it while the target runs (polling for the stop, so a full ring cannot hold both) and before it reports a stop. A program compiled by ztrace cc, with the agent preloaded, stopped at breakpoints, is one recording in order; test-together checks it. Recording such a program showed the debugger's file names and the pass's strings both counted from 1: event.stringId (a hash, top bit set) is now what every producer without a table of its own uses. --- src/agent/agent.zig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/agent/agent.zig') diff --git a/src/agent/agent.zig b/src/agent/agent.zig index bc53336..2a32a05 100644 --- a/src/agent/agent.zig +++ b/src/agent/agent.zig @@ -132,10 +132,7 @@ pub fn emit(kind: Kind, aux: u16, a: [6]u64, payload: []const u8) void { r.emit(.{ .ts = zt.event.now(), .tid = threadId(), .kind = kind, .aux = aux, .a = a }, payload); } -/// A string's id is its hash: no backend needs to ask another which are taken. -pub fn stringId(string: []const u8) u64 { - return std.hash.Wyhash.hash(0, string); -} +pub const stringId = zt.event.stringId; /// `bytes` as a payload: cut to `max`, and never the length of `Regs`, which /// the recorder would take for registers. -- cgit v1.3