mirror of
https://github.com/go-delve/delve.git
synced 2025-10-30 02:07:58 +08:00
proc/tests: fix intermittent test stall on windows
While we are waiting for the process to exit in native.(*Process).Kill we could receive queued exception events, those must be continued or the wait will never finish.
This commit is contained in:
4
Makefile
4
Makefile
@ -65,7 +65,7 @@ endif
|
|||||||
else
|
else
|
||||||
go test -p 1 $(TEST_FLAGS) $(BUILD_FLAGS) $(ALL_PACKAGES)
|
go test -p 1 $(TEST_FLAGS) $(BUILD_FLAGS) $(ALL_PACKAGES)
|
||||||
endif
|
endif
|
||||||
ifneq "$(shell which lldb-server)" ""
|
ifneq "$(shell which lldb-server 2>/dev/null)" ""
|
||||||
@echo
|
@echo
|
||||||
@echo 'Testing LLDB backend (proc)'
|
@echo 'Testing LLDB backend (proc)'
|
||||||
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/proc -backend=lldb
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/proc -backend=lldb
|
||||||
@ -76,7 +76,7 @@ ifneq "$(shell which lldb-server)" ""
|
|||||||
@echo 'Testing LLDB backend (terminal)'
|
@echo 'Testing LLDB backend (terminal)'
|
||||||
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/terminal -backend=lldb
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/terminal -backend=lldb
|
||||||
endif
|
endif
|
||||||
ifneq "$(shell which rr)" ""
|
ifneq "$(shell which rr 2>/dev/null)" ""
|
||||||
@echo
|
@echo
|
||||||
@echo 'Testing Mozilla RR backend (proc)'
|
@echo 'Testing Mozilla RR backend (proc)'
|
||||||
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/proc -backend=rr
|
go test $(TEST_FLAGS) $(BUILD_FLAGS) $(PREFIX)/pkg/proc -backend=rr
|
||||||
|
|||||||
@ -191,7 +191,7 @@ func (dbp *Process) Kill() error {
|
|||||||
_ = syscall.TerminateProcess(dbp.os.hProcess, 1)
|
_ = syscall.TerminateProcess(dbp.os.hProcess, 1)
|
||||||
|
|
||||||
dbp.execPtraceFunc(func() {
|
dbp.execPtraceFunc(func() {
|
||||||
dbp.waitForDebugEvent(waitBlocking)
|
dbp.waitForDebugEvent(waitBlocking | waitDontHandleExceptions)
|
||||||
})
|
})
|
||||||
|
|
||||||
p.Wait()
|
p.Wait()
|
||||||
@ -242,6 +242,7 @@ type waitForDebugEventFlags int
|
|||||||
const (
|
const (
|
||||||
waitBlocking waitForDebugEventFlags = 1 << iota
|
waitBlocking waitForDebugEventFlags = 1 << iota
|
||||||
waitSuspendNewThreads
|
waitSuspendNewThreads
|
||||||
|
waitDontHandleExceptions
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dbp *Process) waitForDebugEvent(flags waitForDebugEventFlags) (threadID, exitCode int, err error) {
|
func (dbp *Process) waitForDebugEvent(flags waitForDebugEventFlags) (threadID, exitCode int, err error) {
|
||||||
@ -305,6 +306,10 @@ func (dbp *Process) waitForDebugEvent(flags waitForDebugEventFlags) (threadID, e
|
|||||||
case _RIP_EVENT:
|
case _RIP_EVENT:
|
||||||
break
|
break
|
||||||
case _EXCEPTION_DEBUG_EVENT:
|
case _EXCEPTION_DEBUG_EVENT:
|
||||||
|
if flags&waitDontHandleExceptions != 0 {
|
||||||
|
continueStatus = _DBG_EXCEPTION_NOT_HANDLED
|
||||||
|
break
|
||||||
|
}
|
||||||
exception := (*_EXCEPTION_DEBUG_INFO)(unionPtr)
|
exception := (*_EXCEPTION_DEBUG_INFO)(unionPtr)
|
||||||
tid := int(debugEvent.ThreadId)
|
tid := int(debugEvent.ThreadId)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user