Skip to content

Commit

Permalink
proc: implement follow exec mode on Windows (#3507)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarzilli authored Oct 13, 2023
1 parent 70f21c9 commit 2035061
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 86 deletions.
6 changes: 4 additions & 2 deletions Documentation/backend_test_health.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ Tests skipped by each supported backend:
* 3 not implemented
* arm64 skipped = 1
* 1 broken - global variable symbolication
* darwin skipped = 1
* darwin skipped = 3
* 2 follow exec not implemented on macOS
* 1 waitfor implementation is delegated to debugserver
* darwin/arm64 skipped = 2
* 2 broken - cgo stacktraces
* darwin/lldb skipped = 1
* 1 upstream issue
* freebsd skipped = 7
* freebsd skipped = 9
* 2 flaky
* 2 follow exec not implemented on freebsd
* 4 not implemented
* 1 not working on freebsd
* linux/386/pie skipped = 2
Expand Down
6 changes: 5 additions & 1 deletion pkg/proc/native/followexec_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !linux
//go:build !linux && !windows

package native

Expand All @@ -8,3 +8,7 @@ import "errors"
func (*nativeProcess) FollowExec(bool) error {
return errors.New("follow exec not implemented")
}

func (*processGroup) detachChild(*nativeProcess) error {
panic("not implemented")
}
4 changes: 2 additions & 2 deletions pkg/proc/native/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (procgrp *processGroup) add(p *nativeProcess, pid int, currentThread proc.T
if tgt == nil {
i := len(procgrp.procs)
procgrp.procs = append(procgrp.procs, p)
procgrp.Detach(p.pid, false)
procgrp.detachChild(p)
if i == len(procgrp.procs)-1 {
procgrp.procs = procgrp.procs[:i]
}
Expand All @@ -262,7 +262,7 @@ func (procgrp *processGroup) add(p *nativeProcess, pid int, currentThread proc.T
}

func (procgrp *processGroup) ContinueOnce(cctx *proc.ContinueOnceContext) (proc.Thread, proc.StopReason, error) {
if len(procgrp.procs) != 1 && runtime.GOOS != "linux" {
if len(procgrp.procs) != 1 && runtime.GOOS != "linux" && runtime.GOOS != "windows" {
panic("not implemented")
}
if procgrp.numValid() == 0 {
Expand Down
4 changes: 4 additions & 0 deletions pkg/proc/native/proc_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,10 @@ func stop1(cctx *proc.ContinueOnceContext, dbp *nativeProcess, trapthread *nativ
return err1
}

func (procgrp *processGroup) detachChild(dbp *nativeProcess) error {
return procgrp.Detach(dbp.pid, false)
}

func (dbp *nativeProcess) detach(kill bool) error {
for threadID := range dbp.threads {
err := ptraceDetach(threadID, 0)
Expand Down
Loading

0 comments on commit 2035061

Please sign in to comment.