summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 11:32:21 -0300
committerGabriel Schneider <[email protected]>2026-11-10 12:08:27 -0300
commitb63355dd567361642d3b68d106b8e4105bcb5d8c (patch)
treeb4d024fd5f034801ff2894c343ff79206a37ff16
parentaf2d2cfdcdf5976f06fbcc4b1f8507f0b7d4af89 (diff)
downloadcomputeranim-b63355dd567361642d3b68d106b8e4105bcb5d8c.tar.gz
computeranim-b63355dd567361642d3b68d106b8e4105bcb5d8c.zip
host: a stop mask set before the target starts
Session.spawn stores Options.stop_mask in the ring before it forks, so a tracer that steps a target by its events is not racing the target's first one. Co-Authored-By: Claude Fable 5.2 <[email protected]>
-rw-r--r--src/trace/host.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/trace/host.zig b/src/trace/host.zig
index f111d55..df2f845 100644
--- a/src/trace/host.zig
+++ b/src/trace/host.zig
@@ -11,6 +11,9 @@ pub const Options = struct {
ring_bytes: usize = 1 << 24,
/// A shared library to LD_PRELOAD into the target (the agent).
preload: ?[]const u8 = null,
+ /// The kinds the target is held at (`Ring.Header.stop_mask`), set before
+ /// it starts: no first event slips by.
+ stop_mask: u64 = 0,
};
pub const Session = struct {
@@ -23,6 +26,7 @@ pub const Session = struct {
pub fn spawn(arena: std.mem.Allocator, path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, env: [:null]const ?[*:0]const u8, options: Options) !Session {
var ring = try Ring.create(options.ring_bytes);
errdefer ring.close();
+ ring.hdr.stop_mask.store(options.stop_mask, .monotonic);
var envp: std.ArrayList(?[*:0]const u8) = .empty;
for (env) |v| {
const s = std.mem.span(v.?);