diff --git a/pkg/proc/interface.go b/pkg/proc/interface.go index f785480f20d5935024d1a035ee8f4a59cc911287..90632790edc024ffc84356bd0a2c6daf3dda46d1 100644 --- a/pkg/proc/interface.go +++ b/pkg/proc/interface.go @@ -98,6 +98,7 @@ type ThreadInfo interface { // ProcessManipulation is an interface for changing the execution state of a process. type ProcessManipulation interface { + // RequestManualStop attempts to stop all the process' threads. RequestManualStop() error // CheckAndClearManualStopRequest returns true the first time it's called // after a call to RequestManualStop. diff --git a/pkg/proc/native/proc.go b/pkg/proc/native/proc.go index 6509bf547e2eb56b89941f9e7f99eb1c4213194b..4dbaf11d385f987580816b7de3800fe7dd5e98ab 100644 --- a/pkg/proc/native/proc.go +++ b/pkg/proc/native/proc.go @@ -27,11 +27,14 @@ type nativeProcess struct { os *osProcessDetails firstStart bool - stopMu sync.Mutex resumeChan chan<- struct{} ptraceChan chan func() ptraceDoneChan chan interface{} childProcess bool // this process was launched, not attached to + stopMu sync.Mutex // protects manualStopRequested + // manualStopRequested is set if all the threads in the process were + // signalled to stop as a result of a Halt API call. Used to disambiguate + // why a thread is found to have stopped. manualStopRequested bool // Controlling terminal file descriptor for @@ -176,7 +179,7 @@ func (dbp *nativeProcess) Breakpoints() *proc.BreakpointMap { return &dbp.breakpoints } -// RequestManualStop sets the `halt` flag and +// RequestManualStop sets the `manualStopRequested` flag and // sends SIGSTOP to all threads. func (dbp *nativeProcess) RequestManualStop() error { if dbp.exited {