diff --git a/proctl/proctl_test.go b/proctl/proctl_test.go index 2fd89b039a9b1609e0d3c57c079a9e86a117e71f..d20c9ff1b9031b3345e3c3473fa852a90d863b84 100644 --- a/proctl/proctl_test.go +++ b/proctl/proctl_test.go @@ -214,29 +214,31 @@ func TestNext(t *testing.T) { // make sure here that after next'ing a couple time, we can // still continue to execute the program without hitting a // rogue breakpoint. - timer := time.NewTimer(5 * time.Second) exited := make(chan interface{}) _, err = p.Clear(bp.Addr) assertNoError(err, t, "Clear()") go func() { - _, err := syscall.Wait4(p.Pid, nil, 0, nil) - if err != nil && err != syscall.ECHILD { - fmt.Println(err) + fmt.Println("waiting") + select { + case <-time.After(2 * time.Second): + syscall.PtraceDetach(p.Pid) + p.Process.Kill() os.Exit(1) + case <-exited: + p.Process.Kill() + os.Exit(0) } - exited <- nil }() go func() { - select { - case <-timer.C: - p.Process.Kill() + _, err := syscall.Wait4(p.Pid, nil, 0, nil) + if err != nil && err != syscall.ECHILD { + fmt.Println(err) os.Exit(1) - case <-exited: - return } + exited <- nil }() // We must call Continue outside of the goroutine diff --git a/proctl/testnextprog b/proctl/testnextprog new file mode 100755 index 0000000000000000000000000000000000000000..b6f4f7c541140baea63e17b905d1087fdf2aef99 Binary files /dev/null and b/proctl/testnextprog differ