mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 23:36:00 +02:00
Fixes for large strings, multiple 'opposite' operators
This commit is contained in:
parent
1346e241db
commit
f266fe69d1
8 changed files with 110 additions and 34 deletions
|
@ -16492,8 +16492,8 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
|||
if (checkType == NULL)
|
||||
break;
|
||||
|
||||
bool foundExactMatch = false;
|
||||
BfOperatorDef* oppositeOperatorDef = NULL;
|
||||
bool foundExactMatch = false;
|
||||
Array<BfMethodDef*> oppositeOperatorDefs;
|
||||
|
||||
for (auto operatorDef : checkType->mTypeDef->mOperators)
|
||||
{
|
||||
|
@ -16502,7 +16502,7 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
|||
allowOp = true;
|
||||
|
||||
if (allowOp)
|
||||
{
|
||||
{
|
||||
foundOp = true;
|
||||
if (methodMatcher.CheckMethod(checkType, operatorDef, false))
|
||||
{
|
||||
|
@ -16512,14 +16512,17 @@ void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNod
|
|||
}
|
||||
}
|
||||
else if (operatorDef->mOperatorDeclaration->mBinOp == oppositeBinaryOp)
|
||||
oppositeOperatorDef = operatorDef;
|
||||
oppositeOperatorDefs.Add(operatorDef);
|
||||
}
|
||||
|
||||
if (((methodMatcher.mBestMethodDef == NULL) || (!foundExactMatch)) && (oppositeOperatorDef != NULL))
|
||||
if (((methodMatcher.mBestMethodDef == NULL) || (!foundExactMatch)) && (!oppositeOperatorDefs.IsEmpty()))
|
||||
{
|
||||
foundOp = true;
|
||||
if (methodMatcher.CheckMethod(checkType, oppositeOperatorDef, false))
|
||||
methodMatcher.mSelfType = entry.mSrcType;
|
||||
for (auto oppositeOperatorDef : oppositeOperatorDefs)
|
||||
{
|
||||
if (methodMatcher.CheckMethod(checkType, oppositeOperatorDef, false))
|
||||
methodMatcher.mSelfType = entry.mSrcType;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (methodMatcher.mBestMethodDef != NULL)
|
||||
|
|
|
@ -1153,10 +1153,29 @@ DbgTypedValue DbgExprEvaluator::GetBeefTypeById(int typeId)
|
|||
|
||||
void DbgExprEvaluator::BeefStringToString(addr_target addr, String& outStr)
|
||||
{
|
||||
mDebugTarget->GetCompilerSettings();
|
||||
int objectSize = mDebugTarget->mBfObjectSize;
|
||||
|
||||
int32 strLen = mDebugger->ReadMemory<int16>(addr + objectSize);
|
||||
addr_target charPtr = mDebugger->ReadMemory<addr_target>(addr + objectSize + 4 + 4);
|
||||
int32 strLen = 0;
|
||||
addr_target charPtr = 0;
|
||||
if (!mDebugTarget->mBfHasLargeStrings)
|
||||
{
|
||||
strLen = mDebugger->ReadMemory<int32>(addr + objectSize);
|
||||
int32 allocSizeAndFlags = mDebugger->ReadMemory<int32>(addr + objectSize + 4);
|
||||
if ((allocSizeAndFlags & 0x40000000) != 0)
|
||||
charPtr = mDebugger->ReadMemory<addr_target>(addr + objectSize + 4 + 4);
|
||||
else
|
||||
charPtr = addr + objectSize + 4 + 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
strLen = mDebugger->ReadMemory<int32>(addr + objectSize);
|
||||
int64 allocSizeAndFlags = mDebugger->ReadMemory<int64>(addr + objectSize + 8);
|
||||
if ((allocSizeAndFlags & 0x40000000'00000000LL) != 0)
|
||||
charPtr = mDebugger->ReadMemory<addr_target>(addr + objectSize + 8 + 8);
|
||||
else
|
||||
charPtr = addr + objectSize + 4 + 4;
|
||||
}
|
||||
|
||||
if ((strLen > 0) && (strLen < 4096))
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@ DebugTarget::DebugTarget(WinDebugger* debugger)
|
|||
mCheckedCompilerSettings = false;
|
||||
mBfObjectHasFlags = false;
|
||||
mBfObjectHasVDataExtender = false;
|
||||
mBfHasLargeStrings = false;
|
||||
mBfHasLargeCollections = false;
|
||||
mBfObjectVDataIntefaceSlotCount = -1;
|
||||
mBfObjectSize = -1;
|
||||
mDebugger = debugger;
|
||||
|
@ -887,6 +889,10 @@ void DebugTarget::GetCompilerSettings()
|
|||
mBfObjectHasFlags = member->mConstValue != 0;
|
||||
if (strcmp(member->mName, "cHasVDataExtender") == 0)
|
||||
mBfObjectHasVDataExtender = member->mConstValue != 0;
|
||||
if (strcmp(member->mName, "cHasLargeStrings") == 0)
|
||||
mBfHasLargeStrings = member->mConstValue != 0;
|
||||
if (strcmp(member->mName, "cHasLargeCollections") == 0)
|
||||
mBfHasLargeCollections = member->mConstValue != 0;
|
||||
if (strcmp(member->mName, "cVDataIntefaceSlotCount") == 0)
|
||||
mBfObjectVDataIntefaceSlotCount = (int)member->mConstValue;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
bool mCheckedCompilerSettings;
|
||||
bool mBfObjectHasFlags;
|
||||
bool mBfObjectHasVDataExtender;
|
||||
bool mBfHasLargeStrings;
|
||||
bool mBfHasLargeCollections;
|
||||
int mBfObjectVDataIntefaceSlotCount;
|
||||
int mBfObjectSize;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue