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

Method HotReplaceMethods

IDEHelper/DbgModule.cpp:5326–5612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5324}
5325
5326void DbgModule::HotReplaceMethods(DbgType* newType, DbgType* primaryType)
5327{
5328 auto linkedModule = GetLinkedModule();
5329
5330 primaryType->PopulateType();
5331 linkedModule->ParseGlobalsData();
5332 linkedModule->ParseSymbolData();
5333
5334 if (primaryType->mNeedsGlobalsPopulated)
5335 {
5336 // These aren't proper TPI types so we don't have any method declarations until we PopulateTypeGlobals
5337 linkedModule->PopulateTypeGlobals(primaryType);
5338 }
5339 for (auto methodNameEntry : primaryType->mMethodNameList)
5340 {
5341 if (methodNameEntry->mCompileUnitId != -1)
5342 {
5343 linkedModule->MapCompileUnitMethods(methodNameEntry->mCompileUnitId);
5344 methodNameEntry->mCompileUnitId = -1;
5345 }
5346 }
5347
5348 // Now actually remove the linedata from the defining module
5349 HashSet<DbgSrcFile*> checkedFiles;
5350 //for (auto method : primaryType->mMethodList)
5351
5352 auto _RemoveLineInfo = [&](DbgSubprogram* method)
5353 {
5354 //method->mWasModuleHotReplaced = true;
5355 method->mHotReplaceKind = DbgSubprogram::HotReplaceKind_Orphaned; // May be temporarily orphaned
5356
5357 if (method->mLineInfo == NULL)
5358 return;
5359
5360 //FIXME: Hot replacing lines
5361 DbgSrcFile* lastSrcFile = NULL;
5362 checkedFiles.Clear();
5363
5364 int prevCtx = -1;
5365 auto inlineRoot = method->GetRootInlineParent();
5366 for (int lineIdx = 0; lineIdx < method->mLineInfo->mLines.mSize; lineIdx++)
5367 {
5368 auto& lineData = method->mLineInfo->mLines[lineIdx];
5369 if (lineData.mCtxIdx != prevCtx)
5370 {
5371 auto ctxInfo = inlineRoot->mLineInfo->mContexts[lineData.mCtxIdx];
5372 auto srcFile = ctxInfo.mSrcFile;
5373 prevCtx = lineData.mCtxIdx;
5374 if (srcFile != lastSrcFile)
5375 {
5376 if (checkedFiles.Add(srcFile))
5377 {
5378 // Remove linedata for old type
5379 // These go into a hot-replaced list so we can still bind to them -- that is necessary because
5380 // we may still have old versions of this method running (and may forever, if its in a loop on some thread)
5381 // since we only patch entry points
5382 //srcFile->RemoveLines(primaryType->mCompileUnit->mDbgModule, primaryType->mCompileUnit, true);
5383

Callers

nothing calls this directly

Calls 15

StringViewClass · 0.85
GetRootInlineParentMethod · 0.80
RemoveLinesMethod · 0.80
GetValueMethod · 0.80
IsLambdaMethod · 0.80
frontMethod · 0.80
GetPrimaryTypeMethod · 0.80
PhysSetBreakpointMethod · 0.80
SetHotJumpMethod · 0.80
PopulateTypeMethod · 0.45
ParseGlobalsDataMethod · 0.45
ParseSymbolDataMethod · 0.45

Tested by

no test coverage detected