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

Method CommitHotTargetSections

IDEHelper/DbgModule.cpp:5268–5314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5266}
5267
5268void DbgModule::CommitHotTargetSections()
5269{
5270 BfLogDbg("DbgModule::CommitHotTargetSections %p\n", this);
5271
5272 for (int sectNum = 0; sectNum < (int)mHotTargetSections.size(); sectNum++)
5273 {
5274 if (mHotTargetSections[sectNum] != NULL)
5275 {
5276 DbgHotTargetSection* hotTargetSection = mHotTargetSections[sectNum];
5277
5278 addr_target hotAddr = GetHotTargetAddress(hotTargetSection);
5279 if (hotAddr != 0)
5280 {
5281// void* imageDestPtr = mOrigImageData->mBlocks[0] + hotTargetSection->mImageOffset;
5282// if (hotTargetSection->mData != NULL)
5283// memcpy(imageDestPtr, hotTargetSection->mData, hotTargetSection->mDataSize);
5284// else
5285// memset(imageDestPtr, 0, hotTargetSection->mDataSize);
5286
5287 BF_ASSERT(mOrigImageData->mAddr != 0);
5288
5289 void* imageDestPtr = hotTargetSection->mData;
5290 bool isTemp = false;
5291 if (imageDestPtr == NULL)
5292 {
5293 imageDestPtr = new uint8[hotTargetSection->mDataSize];
5294 memset(imageDestPtr, 0, hotTargetSection->mDataSize);
5295 isTemp = true;
5296 }
5297
5298 if (hotTargetSection->mCanExecute)
5299 {
5300 bool success = mDebugger->WriteInstructions(hotAddr, imageDestPtr, hotTargetSection->mDataSize);
5301 BF_ASSERT(success);
5302 }
5303 else
5304 {
5305 bool success = mDebugger->WriteMemory(hotAddr, imageDestPtr, hotTargetSection->mDataSize);
5306 BF_ASSERT(success);
5307 }
5308
5309 if (isTemp)
5310 delete imageDestPtr;
5311 }
5312 }
5313 }
5314}
5315
5316bool DbgModule::HasHotReplacedMethods(DbgType* type)
5317{

Callers

nothing calls this directly

Calls 3

WriteInstructionsMethod · 0.80
sizeMethod · 0.45
WriteMemoryMethod · 0.45

Tested by

no test coverage detected