diff --git a/proc/proc.go b/proc/proc.go index ce379e878a..977e58fed8 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -394,20 +394,8 @@ func (dbp *Process) runBreakpointConditions() error { // Resume process, does not evaluate breakpoint conditionals func (dbp *Process) continueOnce() error { - // all threads stopped over a breakpoint are made to step over it - for _, thread := range dbp.Threads { - if thread.CurrentBreakpoint != nil { - if err := thread.Step(); err != nil { - return err - } - thread.CurrentBreakpoint = nil - } - } - // everything is resumed - for _, thread := range dbp.Threads { - if err := thread.resume(); err != nil { - return dbp.exitGuard(err) - } + if err := dbp.resume(); err != nil { + return err } return dbp.run(func() error { thread, err := dbp.trapWait(-1) diff --git a/proc/proc_darwin.go b/proc/proc_darwin.go index 6f2ded2115..01c8c6f560 100644 --- a/proc/proc_darwin.go +++ b/proc/proc_darwin.go @@ -356,3 +356,22 @@ func (dbp *Process) exitGuard(err error) error { } return err } + +func (dbp *Process) resume() error { + // all threads stopped over a breakpoint are made to step over it + for _, thread := range dbp.Threads { + if thread.CurrentBreakpoint != nil { + if err := thread.Step(); err != nil { + return err + } + thread.CurrentBreakpoint = nil + } + } + // everything is resumed + for _, thread := range dbp.Threads { + if err := thread.resume(); err != nil { + return dbp.exitGuard(err) + return err + } + } +} diff --git a/proc/proc_linux.go b/proc/proc_linux.go index c90947b112..81454e2f03 100644 --- a/proc/proc_linux.go +++ b/proc/proc_linux.go @@ -286,7 +286,9 @@ func (dbp *Process) trapWait(pid int) (*Thread, error) { return nil, fmt.Errorf("could not continue new thread %d %s", cloned, err) } if err = dbp.Threads[int(wpid)].Continue(); err != nil { - return nil, fmt.Errorf("could not continue existing thread %d %s", cloned, err) + if err != sys.ESRCH { + return nil, fmt.Errorf("could not continue existing thread %d %s", wpid, err) + } } continue } @@ -401,3 +403,22 @@ func (dbp *Process) exitGuard(err error) error { return err } + +func (dbp *Process) resume() error { + // all threads stopped over a breakpoint are made to step over it + for _, thread := range dbp.Threads { + if thread.CurrentBreakpoint != nil { + if err := thread.Step(); err != nil { + return err + } + thread.CurrentBreakpoint = nil + } + } + // everything is resumed + for _, thread := range dbp.Threads { + if err := thread.resume(); err != nil && err != sys.ESRCH { + return err + } + } + return nil +}