mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 01:27:16 +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() {
|
||||
var sig int
|
||||
if kill {
|
||||
sig = int(sys.SIGINT)
|
||||
err = PtraceDetach(dbp.Pid, 0)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if kill {
|
||||
err = sys.Kill(dbp.Pid, sys.SIGINT)
|
||||
}
|
||||
err = PtraceDetach(dbp.Pid, sig)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user