summaryrefslogtreecommitdiff
path: root/src/trace/Debugger.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 20:28:33 -0300
committerGabriel Schneider <[email protected]>2026-11-10 20:28:33 -0300
commitdbfab7b5cdd76787b6cca72f792acfa3cebcbab5 (patch)
tree336f9e84c913991f037328a4132d93af5c62a544 /src/trace/Debugger.zig
parentdc3b58781420be6070fca896e55776bc27db905d (diff)
downloadcomputeranim-dbfab7b5cdd76787b6cca72f792acfa3cebcbab5.tar.gz
computeranim-dbfab7b5cdd76787b6cca72f792acfa3cebcbab5.zip
debugger: what a write gives the kernel is memory too; --from passes other stops
A write's buffer was recorded as the syscall's payload only: a reader of the moment's memory found there what an earlier stop had seen of it (zeros, in SQLite's page). And record --from with --by syscall took the loader's first syscall for the place and gave up its breakpoint. Both found by the first animation of a real program. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'src/trace/Debugger.zig')
-rw-r--r--src/trace/Debugger.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/trace/Debugger.zig b/src/trace/Debugger.zig
index bbdaee6..b0ebcba 100644
--- a/src/trace/Debugger.zig
+++ b/src/trace/Debugger.zig
@@ -450,6 +450,11 @@ fn atSyscall(d: *Debugger, stop: Stop) !bool {
.read, .pread64 => if (@as(i64, @bitCast(d.regs.rax)) > 0) try d.snapshot(d.regs.rsi, @min(d.regs.rax, d.capture)),
else => {},
};
+ if (stop == .syscall_enter) switch (std.enums.fromInt(linux.SYS, stop.syscall_enter) orelse .close) {
+ // What the kernel is given is the target's memory as it is now: whatever was sent of it before may be stale.
+ .write, .pwrite64 => try d.snapshot(d.regs.rsi, @min(d.regs.rdx, d.capture)),
+ else => {},
+ };
if (d.on_syscall) |hook| return try hook.func(hook.ctx, d, stop) == .stop;
return d.syscalls == .stop;
}