mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 17:56:45 +08:00
proc: bugfix: Detach(true) does not kill tracee
Instead of using PTRACE_DETACH to inject SIGINT into the tracee use sys.Kill directly: PTRACE_DETACH is allowed to ignore its signal argument if the tracee isn't in signal-delivery-stop status.
This commit is contained in:
10
proc/proc.go
10
proc/proc.go
@ -101,11 +101,13 @@ func (dbp *Process) Detach(kill bool) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbp.execPtraceFunc(func() {
|
dbp.execPtraceFunc(func() {
|
||||||
var sig int
|
err = PtraceDetach(dbp.Pid, 0)
|
||||||
if kill {
|
if err != nil {
|
||||||
sig = int(sys.SIGINT)
|
return
|
||||||
|
}
|
||||||
|
if kill {
|
||||||
|
err = sys.Kill(dbp.Pid, sys.SIGINT)
|
||||||
}
|
}
|
||||||
err = PtraceDetach(dbp.Pid, sig)
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user