| 921 | } |
| 922 | |
| 923 | void WinDebugger::DebugThreadProc() |
| 924 | { |
| 925 | BpSetThreadName("DebugThread"); |
| 926 | BfpThread_SetName(NULL, "DebugThread", NULL); |
| 927 | |
| 928 | mDebuggerThreadId = GetCurrentThreadId(); |
| 929 | |
| 930 | if (!IsMiniDumpDebugger()) |
| 931 | { |
| 932 | if (!DoOpenFile(mLaunchPath, mArgs, mWorkingDir, mEnvBlock, mOpenFileFlags)) |
| 933 | { |
| 934 | if (mDbgProcessId != 0) |
| 935 | OutputRawMessage("error Unable to attach to process"); |
| 936 | else |
| 937 | OutputRawMessage(StrFormat("error Failed to launch: %s", mLaunchPath.c_str())); |
| 938 | mShuttingDown = true; |
| 939 | mRunState = RunState_Terminated; |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | while (!mShuttingDown) |
| 944 | { |
| 945 | DoUpdate(); |
| 946 | } |
| 947 | |
| 948 | mIsRunning = false; |
| 949 | |
| 950 | for (int i = 0; i < (int) mBreakpoints.size(); i++) |
| 951 | { |
| 952 | WdBreakpoint* wdBreakpoint = mBreakpoints[i]; |
| 953 | |
| 954 | if (wdBreakpoint->mAddr != 0) |
| 955 | mBreakpointAddrMap.Remove(wdBreakpoint->mAddr, wdBreakpoint); |
| 956 | |
| 957 | wdBreakpoint->mAddr = 0; |
| 958 | wdBreakpoint->mLineData = DbgLineDataEx(); |
| 959 | wdBreakpoint->mSrcFile = NULL; |
| 960 | if (wdBreakpoint->mLinkedSibling != NULL) |
| 961 | { |
| 962 | DeleteBreakpoint(wdBreakpoint->mLinkedSibling); |
| 963 | wdBreakpoint->mLinkedSibling = NULL; |
| 964 | } |
| 965 | } |
| 966 | |
| 967 | if (!IsMiniDumpDebugger()) |
| 968 | { |
| 969 | while (true) |
| 970 | { |
| 971 | if (!mIsDebuggerWaiting) |
| 972 | { |
| 973 | if (!WaitForDebugEvent(&mDebugEvent, 0)) |
| 974 | break; |
| 975 | } |
| 976 | if (mDebuggerWaitingThread != NULL) |
| 977 | { |
| 978 | BF_ASSERT_REL((mDebuggerWaitingThread->mIsAtBreakpointAddress == 0) || (mShuttingDown)); |
| 979 | ::ContinueDebugEvent(mDebuggerWaitingThread->mProcessId, mDebuggerWaitingThread->mThreadId, DBG_CONTINUE); |
| 980 | BfLogDbg("::ContinueDebugEvent startup ThreadId:%d\n", mDebuggerWaitingThread->mThreadId); |
no test coverage detected