| 1109 | } |
| 1110 | |
| 1111 | void WinDebugger::HotLoad(const Array<String>& objectFiles, int hotIdx) |
| 1112 | { |
| 1113 | AutoCrit autoCrit(mDebugManager->mCritSect); |
| 1114 | |
| 1115 | if (mDebugTarget->mTargetBinary == NULL) |
| 1116 | { |
| 1117 | Fail("Hot swapping failed because the hot target binary has not yet been loaded."); |
| 1118 | return; |
| 1119 | } |
| 1120 | |
| 1121 | if (mDebugTarget->mHotHeap == NULL) |
| 1122 | { |
| 1123 | Fail("There is no hot heap space available for hot swapping."); |
| 1124 | return; |
| 1125 | } |
| 1126 | |
| 1127 | BfLogDbg("WinDebugger::HotLoad Start %d\n", hotIdx); |
| 1128 | |
| 1129 | SetAndRestoreValue<int> prevHotIdx(mActiveHotIdx, hotIdx); |
| 1130 | |
| 1131 | BF_ASSERT(mHotThreadStates.empty()); |
| 1132 | mHotThreadStates.Resize(mThreadList.size()); |
| 1133 | for (int threadIdx = 0; threadIdx < (int)mThreadList.size(); threadIdx++) |
| 1134 | { |
| 1135 | WdThreadInfo* threadInfo = mThreadList[threadIdx]; |
| 1136 | SetAndRestoreValue<WdThreadInfo*> prevActiveThread(mActiveThread, threadInfo); |
| 1137 | BfLogDbg("SuspendThread %d\n", threadInfo->mThreadId); |
| 1138 | ::SuspendThread(threadInfo->mHThread); |
| 1139 | mHotThreadStates[threadIdx].mThreadId = threadInfo->mThreadId; |
| 1140 | PopulateRegisters(&mHotThreadStates[threadIdx].mRegisters); |
| 1141 | } |
| 1142 | |
| 1143 | for (auto address : mTempBreakpoint) |
| 1144 | RemoveBreakpoint(address); |
| 1145 | mTempBreakpoint.Clear(); |
| 1146 | mStepBreakpointAddrs.Clear(); |
| 1147 | for (auto breakpoint : mBreakpoints) |
| 1148 | { |
| 1149 | DetachBreakpoint(breakpoint); |
| 1150 | } |
| 1151 | |
| 1152 | int startingModuleIdx = (int)mDebugTarget->mDbgModules.size(); |
| 1153 | |
| 1154 | bool hasHotVData = false; |
| 1155 | |
| 1156 | bool failed = false; |
| 1157 | for (auto fileName : objectFiles) |
| 1158 | { |
| 1159 | if ((fileName.IndexOf("/vdata.") != -1) || (fileName.IndexOf("\\vdata.") != -1)) |
| 1160 | hasHotVData = true; |
| 1161 | |
| 1162 | BfLogDbg("WinDebugger::HotLoad: %s\n", fileName.c_str()); |
| 1163 | DbgModule* newBinary = mDebugTarget->HotLoad(fileName, hotIdx); |
| 1164 | if ((newBinary != NULL) && (newBinary->mFailed)) |
| 1165 | failed = true; |
| 1166 | } |
| 1167 | |
| 1168 | for (int moduleIdx = startingModuleIdx; moduleIdx < (int)mDebugTarget->mDbgModules.size(); moduleIdx++) |
no test coverage detected