Skip to content

Commit b5f4fc6

Browse files
committed
proc: implement follow exec mode on Windows
1 parent 4d30cd4 commit b5f4fc6

File tree

8 files changed

+162
-87
lines changed

8 files changed

+162
-87
lines changed

Documentation/backend_test_health.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ Tests skipped by each supported backend:
55
* 3 not implemented
66
* arm64 skipped = 1
77
* 1 broken - global variable symbolication
8-
* darwin skipped = 1
8+
* darwin skipped = 3
9+
* 2 follow exec not implemented on macOS
910
* 1 waitfor implementation is delegated to debugserver
1011
* darwin/arm64 skipped = 2
1112
* 2 broken - cgo stacktraces
1213
* darwin/lldb skipped = 1
1314
* 1 upstream issue
14-
* freebsd skipped = 6
15+
* freebsd skipped = 8
1516
* 2 flaky
17+
* 2 follow exec not implemented on freebsd
1618
* 4 not implemented
1719
* linux/386/pie skipped = 1
1820
* 1 broken
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//go:build !linux
2-
// +build !linux
1+
//go:build !linux && !windows
2+
// +build !linux,!windows
33

44
package native
55

@@ -9,3 +9,7 @@ import "errors"
99
func (*nativeProcess) FollowExec(bool) error {
1010
return errors.New("follow exec not implemented")
1111
}
12+
13+
func (*processGroup) detachChild(*nativeProcess) error {
14+
panic("not implemented")
15+
}

pkg/proc/native/proc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (procgrp *processGroup) add(p *nativeProcess, pid int, currentThread proc.T
247247
if tgt == nil {
248248
i := len(procgrp.procs)
249249
procgrp.procs = append(procgrp.procs, p)
250-
procgrp.Detach(p.pid, false)
250+
procgrp.detachChild(p)
251251
if i == len(procgrp.procs)-1 {
252252
procgrp.procs = procgrp.procs[:i]
253253
}
@@ -262,7 +262,7 @@ func (procgrp *processGroup) add(p *nativeProcess, pid int, currentThread proc.T
262262
}
263263

264264
func (procgrp *processGroup) ContinueOnce(cctx *proc.ContinueOnceContext) (proc.Thread, proc.StopReason, error) {
265-
if len(procgrp.procs) != 1 && runtime.GOOS != "linux" {
265+
if len(procgrp.procs) != 1 && runtime.GOOS != "linux" && runtime.GOOS != "windows" {
266266
panic("not implemented")
267267
}
268268
if procgrp.numValid() == 0 {

pkg/proc/native/proc_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,10 @@ func stop1(cctx *proc.ContinueOnceContext, dbp *nativeProcess, trapthread *nativ
845845
return err1
846846
}
847847

848+
func (procgrp *processGroup) detachChild(dbp *nativeProcess) error {
849+
return procgrp.Detach(dbp.pid, false)
850+
}
851+
848852
func (dbp *nativeProcess) detach(kill bool) error {
849853
for threadID := range dbp.threads {
850854
err := ptraceDetach(threadID, 0)

0 commit comments

Comments
 (0)