mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Hotswap extension module fix
This commit is contained in:
parent
0bdfea7231
commit
b23c1db0d9
1 changed files with 16 additions and 7 deletions
|
@ -5529,6 +5529,7 @@ void DbgModule::HotReplaceMethods(DbgType* newType, DbgType* primaryType)
|
||||||
|
|
||||||
auto _ReplaceMethod = [&](DbgSubprogram* newMethod)
|
auto _ReplaceMethod = [&](DbgSubprogram* newMethod)
|
||||||
{
|
{
|
||||||
|
bool didReplace = false;
|
||||||
if (!newMethod->mBlock.IsEmpty())
|
if (!newMethod->mBlock.IsEmpty())
|
||||||
{
|
{
|
||||||
BfLogDbg("Hot added new method %p %s Address:%p\n", newMethod, newMethod->mName, newMethod->mBlock.mLowPC);
|
BfLogDbg("Hot added new method %p %s Address:%p\n", newMethod, newMethod->mName, newMethod->mBlock.mLowPC);
|
||||||
|
@ -5543,9 +5544,11 @@ void DbgModule::HotReplaceMethods(DbgType* newType, DbgType* primaryType)
|
||||||
{
|
{
|
||||||
auto oldMethod = itr.GetValue();
|
auto oldMethod = itr.GetValue();
|
||||||
_HotJump(oldMethod, newMethod);
|
_HotJump(oldMethod, newMethod);
|
||||||
|
didReplace = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return didReplace;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newType == primaryType)
|
if (newType == primaryType)
|
||||||
|
@ -5558,12 +5561,16 @@ void DbgModule::HotReplaceMethods(DbgType* newType, DbgType* primaryType)
|
||||||
if ((newMethod->mBlock.mLowPC >= mImageBase) && (newMethod->mBlock.mHighPC <= mImageBase + mImageSize))
|
if ((newMethod->mBlock.mLowPC >= mImageBase) && (newMethod->mBlock.mHighPC <= mImageBase + mImageSize))
|
||||||
{
|
{
|
||||||
// Our object file contains this function
|
// Our object file contains this function
|
||||||
_ReplaceMethod(newMethod);
|
if (_ReplaceMethod(newMethod))
|
||||||
|
{
|
||||||
auto nextMethod = newMethod->mNext;
|
auto nextMethod = newMethod->mNext;
|
||||||
newType->mMethodList.Remove(newMethod);
|
newType->mMethodList.Remove(newMethod);
|
||||||
primaryType->mHotReplacedMethodList.PushFront(newMethod);
|
primaryType->mHotReplacedMethodList.PushFront(newMethod);
|
||||||
newMethod = nextMethod;
|
newMethod = nextMethod;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
newMethod = newMethod->mNext;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_AddToHotReplacedMethodList(newMethod);
|
_AddToHotReplacedMethodList(newMethod);
|
||||||
|
@ -6582,7 +6589,9 @@ bool DbgModule::ReadCOFF(DataStream* stream, DbgModuleKind moduleKind)
|
||||||
auto primaryType = dbgType->GetPrimaryType();
|
auto primaryType = dbgType->GetPrimaryType();
|
||||||
|
|
||||||
if ((primaryType->mHotNewType == NULL) && (HasHotReplacedMethods(primaryType)) && (dbgType == primaryType))
|
if ((primaryType->mHotNewType == NULL) && (HasHotReplacedMethods(primaryType)) && (dbgType == primaryType))
|
||||||
|
{
|
||||||
HotReplaceMethods(dbgType, primaryType);
|
HotReplaceMethods(dbgType, primaryType);
|
||||||
|
}
|
||||||
|
|
||||||
if (primaryType != dbgType)
|
if (primaryType != dbgType)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue