MCPcopy Create free account
hub / github.com/beefytech/Beef / HotLoad

Method HotLoad

IDEHelper/WinDebugger.cpp:1111–1221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1109}
1110
1111void 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++)

Callers 1

Debugger_HotLoadFunction · 0.45

Calls 12

FailFunction · 0.85
IsObjectFileMethod · 0.80
RevertWritingEnableMethod · 0.80
RehupSrcFilesMethod · 0.80
TryGetValueMethod · 0.80
emptyMethod · 0.45
ResizeMethod · 0.45
sizeMethod · 0.45
ClearMethod · 0.45
IndexOfMethod · 0.45
c_strMethod · 0.45
FinishHotSwapMethod · 0.45

Tested by

no test coverage detected