提交 e2c455dd 编写于 作者: L Luke Hoban 提交者: Derek Parker

[proc] ContinueDebugEvent after EXIT_PROCESS on Windows

Fixes #398.
上级 cf3a07b5
......@@ -342,6 +342,7 @@ func dwarfFromPE(f *pe.File) (*dwarf.Data, error) {
func (dbp *Process) waitForDebugEvent() (threadID, exitCode int, err error) {
var debugEvent C.DEBUG_EVENT
shouldExit := false
for {
// Wait for a debug event...
res := C.WaitForDebugEvent(&debugEvent, C.INFINITE)
......@@ -400,7 +401,8 @@ func (dbp *Process) waitForDebugEvent() (threadID, exitCode int, err error) {
return tid, 0, nil
case C.EXIT_PROCESS_DEBUG_EVENT:
debugInfo := (*C.EXIT_PROCESS_DEBUG_INFO)(unionPtr)
return 0, int(debugInfo.dwExitCode), nil
exitCode = int(debugInfo.dwExitCode)
shouldExit = true
default:
return 0, 0, fmt.Errorf("unknown debug event code: %d", debugEvent.dwDebugEventCode)
}
......@@ -410,6 +412,10 @@ func (dbp *Process) waitForDebugEvent() (threadID, exitCode int, err error) {
if res == C.WINBOOL(0) {
return 0, 0, fmt.Errorf("could not ContinueDebugEvent")
}
if shouldExit {
return 0, exitCode, nil
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册