mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Large allocation fixes
This commit is contained in:
parent
becd673914
commit
601b08fb2d
7 changed files with 36 additions and 36 deletions
|
@ -7318,7 +7318,7 @@ DbgTypedValue DbgExprEvaluator::MatchMethod(BfAstNode* targetSrc, DbgTypedValue
|
||||||
if (argValues.size() >= 2)
|
if (argValues.size() >= 2)
|
||||||
{
|
{
|
||||||
if ((argValues[1].mType != NULL) && (argValues[1].mType->IsInteger()))
|
if ((argValues[1].mType != NULL) && (argValues[1].mType->IsInteger()))
|
||||||
mCountResultOverride = (int)argValues[1].GetInt64();
|
mCountResultOverride = (intptr)argValues[1].GetInt64();
|
||||||
return argValues[0];
|
return argValues[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,7 +265,7 @@ public:
|
||||||
DbgSubprogram* mCurMethod;
|
DbgSubprogram* mCurMethod;
|
||||||
DbgTypedValue mResult;
|
DbgTypedValue mResult;
|
||||||
DbgTypedValue* mReceivingValue;
|
DbgTypedValue* mReceivingValue;
|
||||||
int mCountResultOverride;
|
intptr mCountResultOverride;
|
||||||
DbgTypedValue mExplicitThis;
|
DbgTypedValue mExplicitThis;
|
||||||
BfExpression* mExplicitThisExpr;
|
BfExpression* mExplicitThisExpr;
|
||||||
Array<DbgCallResult>* mCallResults;
|
Array<DbgCallResult>* mCallResults;
|
||||||
|
|
|
@ -1710,13 +1710,13 @@ String DbgType::ToString(DbgLanguage language, bool allowDirectBfObject)
|
||||||
auto checkType = this;
|
auto checkType = this;
|
||||||
while (checkType->mTypeCode == DbgType_SizedArray)
|
while (checkType->mTypeCode == DbgType_SizedArray)
|
||||||
{
|
{
|
||||||
int innerSize = checkType->mTypeParam->GetStride();
|
intptr innerSize = checkType->mTypeParam->GetStride();
|
||||||
int arrSize = 0;
|
intptr arrSize = 0;
|
||||||
if (innerSize > 0)
|
if (innerSize > 0)
|
||||||
{
|
{
|
||||||
arrSize = checkType->GetStride() / innerSize;
|
arrSize = checkType->GetStride() / innerSize;
|
||||||
}
|
}
|
||||||
name += StrFormat("[%d]", arrSize);
|
name += StrFormat("[%lld]", arrSize);
|
||||||
checkType = checkType->mTypeParam;
|
checkType = checkType->mTypeParam;
|
||||||
}
|
}
|
||||||
name = checkType->ToString(language) + name;
|
name = checkType->ToString(language) + name;
|
||||||
|
@ -1775,7 +1775,7 @@ String DbgType::ToString(DbgLanguage language, bool allowDirectBfObject)
|
||||||
return "???";
|
return "???";
|
||||||
}
|
}
|
||||||
|
|
||||||
int DbgType::GetByteCount()
|
intptr DbgType::GetByteCount()
|
||||||
{
|
{
|
||||||
if (!mSizeCalculated)
|
if (!mSizeCalculated)
|
||||||
{
|
{
|
||||||
|
@ -1820,7 +1820,7 @@ int DbgType::GetByteCount()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int elemCount = BF_ALIGN(mSize, primaryType->mAlign) / primaryType->GetStride();
|
intptr elemCount = BF_ALIGN(mSize, primaryType->mAlign) / primaryType->GetStride();
|
||||||
if (elemCount > 0)
|
if (elemCount > 0)
|
||||||
{
|
{
|
||||||
mSize = ((elemCount - 1) * primaryType->GetStride()) + primaryType->GetByteCount();
|
mSize = ((elemCount - 1) * primaryType->GetStride()) + primaryType->GetByteCount();
|
||||||
|
@ -1836,7 +1836,7 @@ int DbgType::GetByteCount()
|
||||||
return mSize;
|
return mSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DbgType::GetStride()
|
intptr DbgType::GetStride()
|
||||||
{
|
{
|
||||||
return BF_ALIGN(GetByteCount(), GetAlign());
|
return BF_ALIGN(GetByteCount(), GetAlign());
|
||||||
}
|
}
|
||||||
|
@ -6086,7 +6086,7 @@ bool DbgModule::ReadCOFF(DataStream* stream, DbgModuleKind moduleKind)
|
||||||
{
|
{
|
||||||
auto staticVar = itr->second;
|
auto staticVar = itr->second;
|
||||||
mainModule->mTLSExtraAddr = extraSym->mValue->mAddress;
|
mainModule->mTLSExtraAddr = extraSym->mValue->mAddress;
|
||||||
mainModule->mTLSExtraSize = staticVar->mType->GetByteCount();
|
mainModule->mTLSExtraSize = (int)staticVar->mType->GetByteCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6780,8 +6780,8 @@ void DbgModule::ProcessHotSwapVariables()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint8* newData = GetHotTargetData(newAddress);
|
uint8* newData = GetHotTargetData(newAddress);
|
||||||
int newArraySize = staticVariable->mType->GetByteCount();
|
int newArraySize = (int)staticVariable->mType->GetByteCount();
|
||||||
int oldArraySize = oldVariable->mType->GetByteCount();
|
int oldArraySize = (int)oldVariable->mType->GetByteCount();
|
||||||
|
|
||||||
int copySize = std::min(newArraySize, oldArraySize);
|
int copySize = std::min(newArraySize, oldArraySize);
|
||||||
|
|
||||||
|
@ -6863,7 +6863,7 @@ void DbgModule::ProcessHotSwapVariables()
|
||||||
{
|
{
|
||||||
if ((strncmp(oldVariable->mName, "?sBfTypeData@", 13) == 0) || (strncmp(oldVariable->mName, "sBfTypeData.", 12) == 0))
|
if ((strncmp(oldVariable->mName, "?sBfTypeData@", 13) == 0) || (strncmp(oldVariable->mName, "sBfTypeData.", 12) == 0))
|
||||||
{
|
{
|
||||||
int size = staticVariable->mType->GetByteCount();
|
int size = (int)staticVariable->mType->GetByteCount();
|
||||||
addr_target oldAddress = mDebugTarget->GetStaticAddress(oldVariable);
|
addr_target oldAddress = mDebugTarget->GetStaticAddress(oldVariable);
|
||||||
addr_target newAddress = _GetNewAddress();
|
addr_target newAddress = _GetNewAddress();
|
||||||
if (newAddress == 0)
|
if (newAddress == 0)
|
||||||
|
|
|
@ -557,8 +557,8 @@ public:
|
||||||
|
|
||||||
const char* mName;
|
const char* mName;
|
||||||
const char* mTypeName;
|
const char* mTypeName;
|
||||||
|
intptr mSize; // In bytes
|
||||||
int mTemplateNameIdx;
|
int mTemplateNameIdx;
|
||||||
int mSize; // In bytes
|
|
||||||
int mAlign;
|
int mAlign;
|
||||||
int mDeclFileIdx;
|
int mDeclFileIdx;
|
||||||
int mDeclLine;
|
int mDeclLine;
|
||||||
|
@ -637,8 +637,8 @@ public:
|
||||||
DbgType* RemoveModifiers(bool* hadRef = NULL);
|
DbgType* RemoveModifiers(bool* hadRef = NULL);
|
||||||
String ToStringRaw(DbgLanguage language = DbgLanguage_Unknown);
|
String ToStringRaw(DbgLanguage language = DbgLanguage_Unknown);
|
||||||
String ToString(DbgLanguage language = DbgLanguage_Unknown, bool allowDirectBfObject = false);
|
String ToString(DbgLanguage language = DbgLanguage_Unknown, bool allowDirectBfObject = false);
|
||||||
int GetByteCount();
|
intptr GetByteCount();
|
||||||
int GetStride();
|
intptr GetStride();
|
||||||
int GetAlign();
|
int GetAlign();
|
||||||
void EnsureMethodsMapped();
|
void EnsureMethodsMapped();
|
||||||
};
|
};
|
||||||
|
|
|
@ -5366,7 +5366,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
|
||||||
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
||||||
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
||||||
if ((countValue) && (countValue.mType->IsInteger()))
|
if ((countValue) && (countValue.mType->IsInteger()))
|
||||||
formatInfo->mOverrideCount = (int)countValue.GetInt64();
|
formatInfo->mOverrideCount = (intptr)countValue.GetInt64();
|
||||||
if (dbgEvaluationContext.HadError())
|
if (dbgEvaluationContext.HadError())
|
||||||
{
|
{
|
||||||
if (errorString != NULL)
|
if (errorString != NULL)
|
||||||
|
@ -5386,7 +5386,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
|
||||||
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
||||||
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
||||||
if ((countValue) && (countValue.mType->IsInteger()))
|
if ((countValue) && (countValue.mType->IsInteger()))
|
||||||
formatInfo->mOverrideCount = (int)countValue.GetInt64();
|
formatInfo->mOverrideCount = (intptr)countValue.GetInt64();
|
||||||
if (dbgEvaluationContext.HadError())
|
if (dbgEvaluationContext.HadError())
|
||||||
{
|
{
|
||||||
if (errorString != NULL)
|
if (errorString != NULL)
|
||||||
|
@ -5406,7 +5406,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
|
||||||
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
||||||
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
||||||
if ((countValue) && (countValue.mType->IsInteger()))
|
if ((countValue) && (countValue.mType->IsInteger()))
|
||||||
formatInfo->mArrayLength = (int)countValue.GetInt64();
|
formatInfo->mArrayLength = (intptr)countValue.GetInt64();
|
||||||
if (dbgEvaluationContext.HadError())
|
if (dbgEvaluationContext.HadError())
|
||||||
{
|
{
|
||||||
if (errorString != NULL)
|
if (errorString != NULL)
|
||||||
|
@ -5529,7 +5529,7 @@ bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& format
|
||||||
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo);
|
||||||
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
DbgTypedValue countValue = dbgEvaluationContext.EvaluateInContext(contextTypedValue);
|
||||||
if ((countValue) && (countValue.mType->IsInteger()))
|
if ((countValue) && (countValue.mType->IsInteger()))
|
||||||
formatInfo->mArrayLength = (int)countValue.GetInt64();
|
formatInfo->mArrayLength = (intptr)countValue.GetInt64();
|
||||||
if (dbgEvaluationContext.HadError())
|
if (dbgEvaluationContext.HadError())
|
||||||
{
|
{
|
||||||
if (errorString != NULL)
|
if (errorString != NULL)
|
||||||
|
@ -6143,7 +6143,7 @@ DebugVisualizerEntry* WinDebugger::FindVisualizerForType(DbgType* dbgType, Array
|
||||||
|
|
||||||
#define GET_FROM(ptr, T) *((T*)(ptr += sizeof(T)) - 1)
|
#define GET_FROM(ptr, T) *((T*)(ptr += sizeof(T)) - 1)
|
||||||
|
|
||||||
String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, int maxLength, DwFormatInfo& formatInfo)
|
String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo)
|
||||||
{
|
{
|
||||||
int origMaxLength = maxLength;
|
int origMaxLength = maxLength;
|
||||||
if (addr == 0)
|
if (addr == 0)
|
||||||
|
@ -6154,7 +6154,7 @@ String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAd
|
||||||
String retVal = "\"";
|
String retVal = "\"";
|
||||||
bool wasTerminated = false;
|
bool wasTerminated = false;
|
||||||
String valString;
|
String valString;
|
||||||
int maxShowSize = 255;
|
intptr maxShowSize = 255;
|
||||||
|
|
||||||
if (maxLength == -1)
|
if (maxLength == -1)
|
||||||
maxLength = formatInfo.mOverrideCount;
|
maxLength = formatInfo.mOverrideCount;
|
||||||
|
@ -6457,7 +6457,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto _ShowArraySummary = [&](String& retVal, addr_target ptrVal, int arraySize, DbgType* innerType)
|
auto _ShowArraySummary = [&](String& retVal, addr_target ptrVal, int64 arraySize, DbgType* innerType)
|
||||||
{
|
{
|
||||||
String displayString;
|
String displayString;
|
||||||
displayString += "{";
|
displayString += "{";
|
||||||
|
@ -6480,7 +6480,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
|
|
||||||
// Why did we have this "na" on here? It made "void*[3]" type things show up as "{,,}"
|
// Why did we have this "na" on here? It made "void*[3]" type things show up as "{,,}"
|
||||||
//String evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + StrFormat(")[%d], na", idx);
|
//String evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + StrFormat(")[%d], na", idx);
|
||||||
String evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + StrFormat(")[%d]", idx);
|
String evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + StrFormat(")[%lld]", idx);
|
||||||
DbgTypedValue evalResult = EvaluateInContext(dbgCompileUnit, typedValue, evalStr, &displayStrFormatInfo);
|
DbgTypedValue evalResult = EvaluateInContext(dbgCompileUnit, typedValue, evalStr, &displayStrFormatInfo);
|
||||||
String result;
|
String result;
|
||||||
if (evalResult)
|
if (evalResult)
|
||||||
|
@ -6512,7 +6512,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
{
|
{
|
||||||
retVal = EncodeDataPtr(ptrVal, true) + " ";
|
retVal = EncodeDataPtr(ptrVal, true) + " ";
|
||||||
retVal += dwValueType->mTypeParam->ToString(language);
|
retVal += dwValueType->mTypeParam->ToString(language);
|
||||||
retVal += StrFormat("[%d] ", formatInfo.mArrayLength);
|
retVal += StrFormat("[%lld] ", (int64)formatInfo.mArrayLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ShowArraySummary(retVal, ptrVal, formatInfo.mArrayLength, dwValueType->mTypeParam);
|
_ShowArraySummary(retVal, ptrVal, formatInfo.mArrayLength, dwValueType->mTypeParam);
|
||||||
|
@ -6525,7 +6525,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
|
|
||||||
String evalStr = "*((" + typedValue.mType->ToStringRaw(language) + ")" + EncodeDataPtr(ptrVal, true) + " + {0})";
|
String evalStr = "*((" + typedValue.mType->ToStringRaw(language) + ")" + EncodeDataPtr(ptrVal, true) + " + {0})";
|
||||||
|
|
||||||
retVal += "\n:repeat" + StrFormat("\t%d\t%d\t%d", 0, (int)BF_MAX(formatInfo.mArrayLength, 0), 10000) +
|
retVal += "\n:repeat" + StrFormat("\t%d\t%lld\t%d", 0, (int)BF_MAX(formatInfo.mArrayLength, 0), 10000) +
|
||||||
"\t" + idxStr + "\t" + evalStr;
|
"\t" + idxStr + "\t" + evalStr;
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -7125,8 +7125,8 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
if (ptrVal == 0)
|
if (ptrVal == 0)
|
||||||
ptrVal = typedValue.mPtr;
|
ptrVal = typedValue.mPtr;
|
||||||
|
|
||||||
int arraySize = 0;
|
intptr arraySize = 0;
|
||||||
int innerSize = innerType->GetStride();
|
intptr innerSize = innerType->GetStride();
|
||||||
if (innerSize > 0)
|
if (innerSize > 0)
|
||||||
arraySize = arrayType->GetStride() / innerSize;
|
arraySize = arrayType->GetStride() / innerSize;
|
||||||
else
|
else
|
||||||
|
@ -7160,7 +7160,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + ")[{0}], refid=" + MaybeQuoteFormatInfoParam(referenceId + ".[]");
|
evalStr = "((" + innerType->ToStringRaw(language) + "*)" + EncodeDataPtr(ptrVal, true) + ")[{0}], refid=" + MaybeQuoteFormatInfoParam(referenceId + ".[]");
|
||||||
if (typedValue.mIsReadOnly)
|
if (typedValue.mIsReadOnly)
|
||||||
evalStr += ", ne";
|
evalStr += ", ne";
|
||||||
retVal += "\n:repeat" + StrFormat("\t%d\t%d\t%d", 0, (int)BF_MAX(arraySize, 0), 10000) +
|
retVal += "\n:repeat" + StrFormat("\t%d\t%lld\t%d", 0, (int)BF_MAX(arraySize, 0), 10000) +
|
||||||
"\t" + idxStr + "\t" + evalStr;
|
"\t" + idxStr + "\t" + evalStr;
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,9 +278,9 @@ struct DwFormatInfo
|
||||||
bool mNoMembers;
|
bool mNoMembers;
|
||||||
bool mRawString;
|
bool mRawString;
|
||||||
bool mNoEdit;
|
bool mNoEdit;
|
||||||
int mArrayLength;
|
intptr mArrayLength;
|
||||||
int mOverrideCount;
|
intptr mOverrideCount;
|
||||||
int mMaxCount;
|
intptr mMaxCount;
|
||||||
DwDisplayType mDisplayType;
|
DwDisplayType mDisplayType;
|
||||||
DbgTypedValue mExplicitThis;
|
DbgTypedValue mExplicitThis;
|
||||||
int mTotalSummaryLength;
|
int mTotalSummaryLength;
|
||||||
|
@ -501,7 +501,7 @@ public:
|
||||||
bool EvalCondition(DebugVisualizerEntry* debugVis, DbgCompileUnit* dbgCompileUnit, DbgTypedValue typedVal, DwFormatInfo& formatInfo, const StringImpl& condition, const Array<String>& dbgVisWildcardCaptures, String& errorStr);
|
bool EvalCondition(DebugVisualizerEntry* debugVis, DbgCompileUnit* dbgCompileUnit, DbgTypedValue typedVal, DwFormatInfo& formatInfo, const StringImpl& condition, const Array<String>& dbgVisWildcardCaptures, String& errorStr);
|
||||||
DwDisplayInfo* GetDisplayInfo(const StringImpl& referenceId);
|
DwDisplayInfo* GetDisplayInfo(const StringImpl& referenceId);
|
||||||
void ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValue useTypedValue, String& evalStr, String& displayString, DwFormatInfo& formatInfo, DebugVisualizerEntry* debugVis, bool limitLength);
|
void ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValue useTypedValue, String& evalStr, String& displayString, DwFormatInfo& formatInfo, DebugVisualizerEntry* debugVis, bool limitLength);
|
||||||
String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, int maxLength, DwFormatInfo& formatInfo);
|
String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo);
|
||||||
String DbgTypedValueToString(const DbgTypedValue& typedValue, const StringImpl& expr, DwFormatInfo& formatFlags, DbgExprEvaluator* optEvaluator, bool fullPrecision = false);
|
String DbgTypedValueToString(const DbgTypedValue& typedValue, const StringImpl& expr, DwFormatInfo& formatFlags, DbgExprEvaluator* optEvaluator, bool fullPrecision = false);
|
||||||
bool ShouldShowStaticMember(DbgType* dbgType, DbgVariable* member);
|
bool ShouldShowStaticMember(DbgType* dbgType, DbgVariable* member);
|
||||||
String GetMemberList(DbgType* dbgType, const StringImpl& expr, bool isPtr, bool isStatic, bool forceCast = false, bool isSplat = false, bool isReadOnly = false);
|
String GetMemberList(DbgType* dbgType, const StringImpl& expr, bool isPtr, bool isStatic, bool forceCast = false, bool isSplat = false, bool isReadOnly = false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue