fix(debug): handle mapping edges, stray traps and dying debuggees

Assisted-by: GLM 5.3
This commit is contained in:
2026-10-02 00:40:54 +02:00
parent dd1782c538
commit f57377abb9
19 changed files with 726 additions and 97 deletions
+16
View File
@@ -5,6 +5,22 @@
package debug
import (
"os"
"path/filepath"
)
// markDead records the target's failure reason in the handshake directory,
// the death notice the debugger's readiness poll reads. The poll must not
// wait on the child while it polls: a wait there could consume the SIGSTOP
// park the debugger's own waitStopped must receive, hanging the launch, so
// the file is the only fast death notice that is safe to read. A debuggee
// killed without a notice (a crash, SIGKILL) surfaces through the ordinary
// wait after the poll instead.
func markDead(tmpDir, reason string) {
os.WriteFile(filepath.Join(tmpDir, "dead"), []byte(reason), 0o644)
}
// tracer abstracts the minimal ptrace operations needed by the breakpoint
// manager and the stop-information helpers. The live implementation is
// *Session (ptrace_linux_amd64.go); tests supply a mock.