mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Made $alias$ work for splat parameters to mixins
This commit is contained in:
parent
004d5d8d1c
commit
70e751e718
11 changed files with 228 additions and 92 deletions
|
@ -1229,6 +1229,7 @@ void BeCOFFObject::DbgOutputLocalVar(BeDbgFunction* dbgFunc, BeDbgVariable* dbgV
|
||||||
|
|
||||||
bool isConst = false;
|
bool isConst = false;
|
||||||
String varName = dbgVar->mName;
|
String varName = dbgVar->mName;
|
||||||
|
|
||||||
bool isGlobal = false;
|
bool isGlobal = false;
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
|
@ -1246,18 +1247,21 @@ void BeCOFFObject::DbgOutputLocalVar(BeDbgFunction* dbgFunc, BeDbgVariable* dbgV
|
||||||
{
|
{
|
||||||
if (auto beConst = BeValueDynCast<BeConstant>(dbgVar->mValue))
|
if (auto beConst = BeValueDynCast<BeConstant>(dbgVar->mValue))
|
||||||
{
|
{
|
||||||
int64 writeVal = beConst->mInt64;
|
if (!beConst->mType->IsPointer())
|
||||||
if (beConst->mType->mTypeCode == BfTypeCode_Single)
|
|
||||||
{
|
{
|
||||||
// We need to do this because Singles are stored in mDouble, so we need to reduce here
|
int64 writeVal = beConst->mInt64;
|
||||||
float floatVal = (float)beConst->mDouble;
|
if (beConst->mType->mTypeCode == BfTypeCode_Single)
|
||||||
writeVal = *(uint32*)&floatVal;
|
{
|
||||||
|
// We need to do this because Singles are stored in mDouble, so we need to reduce here
|
||||||
|
float floatVal = (float)beConst->mDouble;
|
||||||
|
writeVal = *(uint32*)&floatVal;
|
||||||
|
}
|
||||||
|
if (writeVal < 0)
|
||||||
|
varName += StrFormat("$_%llu", -writeVal);
|
||||||
|
else
|
||||||
|
varName += StrFormat("$%llu", writeVal);
|
||||||
|
isConst = true;
|
||||||
}
|
}
|
||||||
if (writeVal < 0)
|
|
||||||
varName += StrFormat("$_%llu", -writeVal);
|
|
||||||
else
|
|
||||||
varName += StrFormat("$%llu", writeVal);
|
|
||||||
isConst = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2202,7 +2202,12 @@ void COFF::ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionD
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (unrangedIdx >= deferredVariableLocations.size())
|
if (localVar->mLocationData != NULL)
|
||||||
|
{
|
||||||
|
// Already handled
|
||||||
|
NOP;
|
||||||
|
}
|
||||||
|
else if (unrangedIdx >= deferredVariableLocations.size())
|
||||||
{
|
{
|
||||||
// There was no ranged data, commit just the unranged entry
|
// There was no ranged data, commit just the unranged entry
|
||||||
BF_ASSERT(locationDataCount == localVar->mLocationLen);
|
BF_ASSERT(locationDataCount == localVar->mLocationLen);
|
||||||
|
@ -2240,8 +2245,13 @@ void COFF::ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionD
|
||||||
for (auto& deferredVariableLocation : deferredVariableLocations)
|
for (auto& deferredVariableLocation : deferredVariableLocations)
|
||||||
{
|
{
|
||||||
if (deferredVariableLocation.mRangedLength == -1)
|
if (deferredVariableLocation.mRangedLength == -1)
|
||||||
continue;
|
continue;
|
||||||
auto deferredVar = deferredVariableLocation.mVariable;
|
auto deferredVar = deferredVariableLocation.mVariable;
|
||||||
|
if (deferredVar->mLocationData != NULL)
|
||||||
|
{
|
||||||
|
// Already handled
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BP_ALLOC("DeferredVarLoc2", deferredVariableLocation.mRangedLength);
|
BP_ALLOC("DeferredVarLoc2", deferredVariableLocation.mRangedLength);
|
||||||
deferredVar->mLocationData = mAlloc.AllocBytes(deferredVariableLocation.mRangedLength, "DeferredVarLoc2");
|
deferredVar->mLocationData = mAlloc.AllocBytes(deferredVariableLocation.mRangedLength, "DeferredVarLoc2");
|
||||||
memcpy((uint8*)deferredVar->mLocationData, deferredVariableLocation.mRangedStart, deferredVariableLocation.mRangedLength);
|
memcpy((uint8*)deferredVar->mLocationData, deferredVariableLocation.mRangedStart, deferredVariableLocation.mRangedLength);
|
||||||
|
@ -3205,7 +3215,8 @@ void COFF::ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionD
|
||||||
locationDataStart = dataStart;
|
locationDataStart = dataStart;
|
||||||
locationDataEnd = dataEnd;
|
locationDataEnd = dataEnd;
|
||||||
locationDataCount++;
|
locationDataCount++;
|
||||||
localVar->mLocationLen++;
|
if (localVar->mLocationData == NULL)
|
||||||
|
localVar->mLocationLen++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -3214,42 +3225,81 @@ void COFF::ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionD
|
||||||
|
|
||||||
if (hasNewLocalVar)
|
if (hasNewLocalVar)
|
||||||
{
|
{
|
||||||
if (localVar->mName != NULL)
|
if ((localVar->mName != NULL) && (localVar->mName[0] == '$'))
|
||||||
{
|
{
|
||||||
|
char* aliasPos = (char*)strstr(localVar->mName, "$alias$");
|
||||||
|
|
||||||
// This $alias$ hack is unfortunate, but LLVM gets confused when we attempt to tie multiple debug variables
|
// This $alias$ hack is unfortunate, but LLVM gets confused when we attempt to tie multiple debug variables
|
||||||
// to the same memory location, which can happen during mixin injection. The result is that the mixin gets
|
// to the same memory location, which can happen during mixin injection. The result is that the mixin gets
|
||||||
// some premature instructions attributed to it from the variable declaration. This fixes that.
|
// some premature instructions attributed to it from the variable declaration. This fixes that.
|
||||||
if (strncmp(localVar->mName, "$alias$", 7) == 0)
|
if (aliasPos != NULL)
|
||||||
{
|
{
|
||||||
localVar->mName += 7;
|
String findName = String(aliasPos + 7);
|
||||||
char* dollarPos = (char*)strchr(localVar->mName, '$');
|
localVar->mName = CvDupString(localVar->mName + 1, aliasPos - localVar->mName - 1);
|
||||||
if (dollarPos != 0)
|
|
||||||
{
|
|
||||||
*dollarPos = 0;
|
|
||||||
const char* findName = dollarPos + 1;
|
|
||||||
|
|
||||||
bool found = false;
|
auto curBlock = blockStack.back();
|
||||||
for (int blockIdx = (int)blockStack.size() - 1; blockIdx >= 0; blockIdx--)
|
localVar->mLocationData = (uint8*)CvDupString(aliasPos + 7, strlen(aliasPos + 7));
|
||||||
|
localVar->mRangeStart = curBlock->mLowPC;
|
||||||
|
localVar->mRangeLen = curBlock->mHighPC - curBlock->mLowPC;
|
||||||
|
|
||||||
|
/*bool found = false;
|
||||||
|
|
||||||
|
auto _CheckBlock = [&](DbgBlock* block)
|
||||||
|
{
|
||||||
|
for (auto checkVar : block->mVariables)
|
||||||
{
|
{
|
||||||
DbgBlock* block = blockStack[blockIdx];
|
if (checkVar->mName == NULL)
|
||||||
for (auto checkVar : block->mVariables)
|
continue;
|
||||||
|
|
||||||
|
if (findName == checkVar->mName)
|
||||||
{
|
{
|
||||||
if (strcmp(checkVar->mName, findName) == 0)
|
localVar->mConstValue = checkVar->mConstValue;
|
||||||
{
|
localVar->mType = checkVar->mType;
|
||||||
localVar->mConstValue = checkVar->mConstValue;
|
localVar->mLocationData = checkVar->mLocationData;
|
||||||
localVar->mType = checkVar->mType;
|
localVar->mLocationLen = checkVar->mLocationLen;
|
||||||
localVar->mLocationData = checkVar->mLocationData;
|
found = true;
|
||||||
localVar->mLocationLen = checkVar->mLocationLen;
|
return true;
|
||||||
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int blockIdx = (int)blockStack.size() - 1; blockIdx >= 0; blockIdx--)
|
||||||
|
{
|
||||||
|
DbgBlock* block = blockStack[blockIdx];
|
||||||
|
if (_CheckBlock(block))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
addr_target checkAddr = 0;
|
||||||
|
DbgSubprogram* checkSubprogram = curSubprogram;
|
||||||
|
|
||||||
|
while (checkSubprogram != NULL)
|
||||||
|
{
|
||||||
|
auto checkAddr = checkSubprogram->mBlock.mLowPC;
|
||||||
|
if (checkSubprogram->mInlineeInfo == NULL)
|
||||||
|
break;
|
||||||
|
checkSubprogram = checkSubprogram->mInlineeInfo->mInlineParent;
|
||||||
|
|
||||||
|
std::function<void(DbgBlock*)> _RecurseBlock = [&](DbgBlock* block)
|
||||||
|
{
|
||||||
|
if ((checkAddr < block->mLowPC) || (checkAddr >= block->mHighPC))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_CheckBlock(block))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (auto block : block->mSubBlocks)
|
||||||
|
_RecurseBlock(block);
|
||||||
|
};
|
||||||
|
|
||||||
|
_RecurseBlock(&checkSubprogram->mBlock);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compileUnit->mLanguage != DbgLanguage_Beef)
|
if (compileUnit->mLanguage != DbgLanguage_Beef)
|
||||||
|
@ -6039,15 +6089,22 @@ void COFF::FinishHotSwap()
|
||||||
mTypeMap.Clear();
|
mTypeMap.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
addr_target COFF::EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags)
|
intptr COFF::EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags)
|
||||||
{
|
{
|
||||||
if (mDbgFlavor == DbgFlavor_GNU)
|
if (mDbgFlavor == DbgFlavor_GNU)
|
||||||
return DbgModule::EvaluateLocation(dwSubprogram, locData, locDataLen, stackFrame, outAddrType, flags);
|
return DbgModule::EvaluateLocation(dwSubprogram, locData, locDataLen, stackFrame, outAddrType, flags);
|
||||||
|
|
||||||
|
if ((locDataLen == 0) && (locData != NULL))
|
||||||
|
{
|
||||||
|
// locData is actually a string, the aliased name
|
||||||
|
*outAddrType = DbgAddrType_Alias;
|
||||||
|
return (intptr)locData;
|
||||||
|
}
|
||||||
|
|
||||||
addr_target pc = 0;
|
addr_target pc = 0;
|
||||||
if (stackFrame != NULL)
|
if (stackFrame != NULL)
|
||||||
{
|
{
|
||||||
// Use 'GetSourcePC', which will offset the RSP when we're not at the top positon of the call stack, since RSP will be the
|
// Use 'GetSourcePC', which will offset the RSP when we're not at the top position of the call stack, since RSP will be the
|
||||||
// return address in those cases
|
// return address in those cases
|
||||||
pc = stackFrame->GetSourcePC();
|
pc = stackFrame->GetSourcePC();
|
||||||
}
|
}
|
||||||
|
|
|
@ -312,7 +312,7 @@ public:
|
||||||
virtual void PopulateStaticVariableMap() override;
|
virtual void PopulateStaticVariableMap() override;
|
||||||
virtual void ProcessDebugInfo() override;
|
virtual void ProcessDebugInfo() override;
|
||||||
virtual void FinishHotSwap() override;
|
virtual void FinishHotSwap() override;
|
||||||
virtual addr_target EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None) override;
|
virtual intptr EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None) override;
|
||||||
virtual bool CanGetOldSource() override;
|
virtual bool CanGetOldSource() override;
|
||||||
virtual String GetOldSourceCommand(const StringImpl& path) override;
|
virtual String GetOldSourceCommand(const StringImpl& path) override;
|
||||||
virtual bool HasPendingDebugInfo() override;
|
virtual bool HasPendingDebugInfo() override;
|
||||||
|
|
|
@ -12653,18 +12653,26 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
|
||||||
{
|
{
|
||||||
if (localVar == newLocalVar)
|
if (localVar == newLocalVar)
|
||||||
continue;
|
continue;
|
||||||
if (newLocalVar->mValue != localVar->mValue)
|
if (!localVar->mIsSplat)
|
||||||
|
continue;
|
||||||
|
if (newLocalVar->mValue != localVar->mAddr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String name = newLocalVar->mName;
|
String name = "$";
|
||||||
|
name += newLocalVar->mName;
|
||||||
name += "$alias$";
|
name += "$alias$";
|
||||||
name += localVar->mName;
|
name += localVar->mName;
|
||||||
|
|
||||||
auto fakeValue = mModule->mBfIRBuilder->CreateConst(BfTypeCode_Int32, 0);
|
// auto fakeValue = mModule->mBfIRBuilder->CreateConst(BfTypeCode_Int32, 0);
|
||||||
auto diType = mModule->mBfIRBuilder->DbgGetType(mModule->GetPrimitiveType(BfTypeCode_Int32));
|
// auto diType = mModule->mBfIRBuilder->DbgGetType(mModule->GetPrimitiveType(BfTypeCode_Int32));
|
||||||
auto diVariable = mModule->mBfIRBuilder->DbgCreateAutoVariable(mModule->mCurMethodState->mCurScope->mDIScope,
|
// auto diVariable = mModule->mBfIRBuilder->DbgCreateAutoVariable(mModule->mCurMethodState->mCurScope->mDIScope,
|
||||||
newLocalVar->mName, mModule->mCurFilePosition.mFileInstance->mDIFile, mModule->mCurFilePosition.mCurLine, diType);
|
// name, mModule->mCurFilePosition.mFileInstance->mDIFile, mModule->mCurFilePosition.mCurLine, diType);
|
||||||
mModule->mBfIRBuilder->DbgInsertValueIntrinsic(fakeValue, diVariable);
|
// mModule->mBfIRBuilder->DbgInsertValueIntrinsic(fakeValue, diVariable);
|
||||||
|
|
||||||
|
auto diType = mModule->mBfIRBuilder->DbgGetType(mModule->GetPrimitiveType(BfTypeCode_NullPtr));
|
||||||
|
auto diVariable = mModule->mBfIRBuilder->DbgCreateAutoVariable(mModule->mCurMethodState->mCurScope->mDIScope,
|
||||||
|
name, mModule->mCurFilePosition.mFileInstance->mDIFile, mModule->mCurFilePosition.mCurLine, diType);
|
||||||
|
mModule->mBfIRBuilder->DbgInsertValueIntrinsic(mModule->mBfIRBuilder->CreateConstNull(), diVariable);
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1136,7 +1136,7 @@ DbgTypedValue DbgExprEvaluator::GetBeefTypeById(int typeId)
|
||||||
{
|
{
|
||||||
auto stackFrame = GetStackFrame();
|
auto stackFrame = GetStackFrame();
|
||||||
DbgAddrType addrType;
|
DbgAddrType addrType;
|
||||||
int64 valAddr = member->mCompileUnit->mDbgModule->EvaluateLocation(NULL, member->mLocationData, member->mLocationLen, stackFrame, &addrType);
|
intptr valAddr = member->mCompileUnit->mDbgModule->EvaluateLocation(NULL, member->mLocationData, member->mLocationLen, stackFrame, &addrType);
|
||||||
if (valAddr != 0)
|
if (valAddr != 0)
|
||||||
{
|
{
|
||||||
DbgTypedValue typedVal;
|
DbgTypedValue typedVal;
|
||||||
|
@ -1470,12 +1470,12 @@ DbgTypedValue DbgExprEvaluator::GetThis()
|
||||||
if (mDebugTarget->GetValueByName(GetCurrentMethod(), findName, stackFrame, &valAddr, &valType, &addrType))
|
if (mDebugTarget->GetValueByName(GetCurrentMethod(), findName, stackFrame, &valAddr, &valType, &addrType))
|
||||||
{
|
{
|
||||||
//valType = valType->RemoveModifiers();
|
//valType = valType->RemoveModifiers();
|
||||||
return FixThis(ReadTypedValue(valType, valAddr, addrType));
|
return FixThis(ReadTypedValue(NULL, valType, valAddr, addrType));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDebugTarget->GetValueByName(GetCurrentMethod(), "__closure", stackFrame, &valAddr, &valType, &addrType))
|
if (mDebugTarget->GetValueByName(GetCurrentMethod(), "__closure", stackFrame, &valAddr, &valType, &addrType))
|
||||||
{
|
{
|
||||||
DbgTypedValue result = ReadTypedValue(valType, valAddr, addrType);
|
DbgTypedValue result = ReadTypedValue(NULL, valType, valAddr, addrType);
|
||||||
if (!result)
|
if (!result)
|
||||||
return result;
|
return result;
|
||||||
SetAndRestoreValue<bool> prevIgnoreError(mIgnoreErrors, true);
|
SetAndRestoreValue<bool> prevIgnoreError(mIgnoreErrors, true);
|
||||||
|
@ -1849,7 +1849,7 @@ DbgTypedValue DbgExprEvaluator::Cast(BfAstNode* srcNode, const DbgTypedValue& ty
|
||||||
findName += "$d";
|
findName += "$d";
|
||||||
if (mDebugTarget->GetValueByName(GetCurrentMethod(), findName, GetStackFrame(), &valAddr, &valType, &addrType))
|
if (mDebugTarget->GetValueByName(GetCurrentMethod(), findName, GetStackFrame(), &valAddr, &valType, &addrType))
|
||||||
{
|
{
|
||||||
return ReadTypedValue(valType, valAddr, addrType);
|
return ReadTypedValue(srcNode, valType, valAddr, addrType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2535,7 +2535,7 @@ DbgTypedValue DbgExprEvaluator::DoLookupField(BfAstNode* targetSrc, DbgTypedValu
|
||||||
if (checkMember->mLocationLen != 0)
|
if (checkMember->mLocationLen != 0)
|
||||||
{
|
{
|
||||||
DbgAddrType addrType;
|
DbgAddrType addrType;
|
||||||
int64 valAddr = checkMember->mCompileUnit->mDbgModule->EvaluateLocation(NULL, checkMember->mLocationData, checkMember->mLocationLen, stackFrame, &addrType);
|
intptr valAddr = checkMember->mCompileUnit->mDbgModule->EvaluateLocation(NULL, checkMember->mLocationData, checkMember->mLocationLen, stackFrame, &addrType);
|
||||||
if ((language == DbgLanguage_Beef) && (checkMember->mType->IsConst()) && (checkMember->mType->mTypeParam->IsSizedArray()))
|
if ((language == DbgLanguage_Beef) && (checkMember->mType->IsConst()) && (checkMember->mType->mTypeParam->IsSizedArray()))
|
||||||
{
|
{
|
||||||
// We need an extra deref
|
// We need an extra deref
|
||||||
|
@ -2544,11 +2544,11 @@ DbgTypedValue DbgExprEvaluator::DoLookupField(BfAstNode* targetSrc, DbgTypedValu
|
||||||
|
|
||||||
if (checkMember->mIsConst)
|
if (checkMember->mIsConst)
|
||||||
addrType = DbgAddrType_Value;
|
addrType = DbgAddrType_Value;
|
||||||
return ReadTypedValue(checkMember->mType, valAddr, addrType);
|
return ReadTypedValue(targetSrc, checkMember->mType, valAddr, addrType);
|
||||||
}
|
}
|
||||||
else if (checkMember->mIsConst)
|
else if (checkMember->mIsConst)
|
||||||
{
|
{
|
||||||
return ReadTypedValue(checkMember->mType, (uint64)&checkMember->mConstValue, DbgAddrType_Local);
|
return ReadTypedValue(targetSrc, checkMember->mType, (uint64)&checkMember->mConstValue, DbgAddrType_Local);
|
||||||
}
|
}
|
||||||
else if (checkMember->mIsStatic)
|
else if (checkMember->mIsStatic)
|
||||||
{
|
{
|
||||||
|
@ -2583,14 +2583,14 @@ DbgTypedValue DbgExprEvaluator::DoLookupField(BfAstNode* targetSrc, DbgTypedValu
|
||||||
}
|
}
|
||||||
else if ((targetPtr == 0) && (target.mPtr != 0) && (!target.mType->HasPointer()))
|
else if ((targetPtr == 0) && (target.mPtr != 0) && (!target.mType->HasPointer()))
|
||||||
{
|
{
|
||||||
typedValue = ReadTypedValue(checkMember->mType, (uint64)&target.mPtr + checkMember->mMemberOffset, DbgAddrType_Local);
|
typedValue = ReadTypedValue(targetSrc, checkMember->mType, (uint64)&target.mPtr + checkMember->mMemberOffset, DbgAddrType_Local);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (target.mType->HasPointer())
|
if (target.mType->HasPointer())
|
||||||
targetPtr = target.mPtr;
|
targetPtr = target.mPtr;
|
||||||
|
|
||||||
typedValue = ReadTypedValue(checkMember->mType, targetPtr + checkMember->mMemberOffset, DbgAddrType_Target);
|
typedValue = ReadTypedValue(targetSrc, checkMember->mType, targetPtr + checkMember->mMemberOffset, DbgAddrType_Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkMember->mBitSize != 0)
|
if (checkMember->mBitSize != 0)
|
||||||
|
@ -2850,10 +2850,44 @@ void DbgExprEvaluator::Visit(BfAstNode* node)
|
||||||
Fail("Invalid debug expression", node);
|
Fail("Invalid debug expression", node);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbgTypedValue DbgExprEvaluator::ReadTypedValue(DbgType* dbgType, uint64 valAddr, DbgAddrType addrType)
|
DbgTypedValue DbgExprEvaluator::ReadTypedValue(BfAstNode* targetSrc, DbgType* dbgType, uint64 valAddr, DbgAddrType addrType)
|
||||||
{
|
{
|
||||||
bool failedReadMemory = false;
|
bool failedReadMemory = false;
|
||||||
|
|
||||||
|
if (addrType == DbgAddrType_Alias)
|
||||||
|
{
|
||||||
|
String findName = (const char*)valAddr;
|
||||||
|
|
||||||
|
if (targetSrc == NULL)
|
||||||
|
return DbgTypedValue();
|
||||||
|
|
||||||
|
auto source = targetSrc->GetSourceData();
|
||||||
|
auto bfParser = source->ToParser();
|
||||||
|
if (bfParser == NULL)
|
||||||
|
return DbgTypedValue();
|
||||||
|
|
||||||
|
auto identifierNode = source->mAlloc.Alloc<BfIdentifierNode>();
|
||||||
|
int srcStart = bfParser->AllocChars(findName.length());
|
||||||
|
memcpy((char*)source->mSrc + srcStart, findName.c_str(), findName.length());
|
||||||
|
identifierNode->Init(srcStart, srcStart, srcStart + findName.length());
|
||||||
|
|
||||||
|
SetAndRestoreValue<bool> prevIgnoreErrors(mIgnoreErrors, true);
|
||||||
|
auto result = LookupIdentifier(identifierNode);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
// Allow lookup in calling method if we are inlined (for mixin references)
|
||||||
|
auto currentMethod = GetCurrentMethod();
|
||||||
|
if ((currentMethod != NULL) && (currentMethod->mInlineeInfo != NULL))
|
||||||
|
{
|
||||||
|
SetAndRestoreValue<int> preCallstackIdx(mCallStackIdx);
|
||||||
|
mCallStackIdx++;
|
||||||
|
result = LookupIdentifier(identifierNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
if (addrType == DbgAddrType_LocalSplat)
|
if (addrType == DbgAddrType_LocalSplat)
|
||||||
{
|
{
|
||||||
DbgTypedValue val;
|
DbgTypedValue val;
|
||||||
|
@ -2866,7 +2900,7 @@ DbgTypedValue DbgExprEvaluator::ReadTypedValue(DbgType* dbgType, uint64 valAddr,
|
||||||
|
|
||||||
if (addrType == DbgAddrType_TargetDeref)
|
if (addrType == DbgAddrType_TargetDeref)
|
||||||
{
|
{
|
||||||
DbgTypedValue result = ReadTypedValue(dbgType, valAddr, DbgAddrType_Target);
|
DbgTypedValue result = ReadTypedValue(targetSrc, dbgType, valAddr, DbgAddrType_Target);
|
||||||
if ((result.mType != NULL) && (result.mType->IsPointer()))
|
if ((result.mType != NULL) && (result.mType->IsPointer()))
|
||||||
{
|
{
|
||||||
result.mType = result.mType->mTypeParam;
|
result.mType = result.mType->mTypeParam;
|
||||||
|
@ -2945,7 +2979,7 @@ DbgTypedValue DbgExprEvaluator::ReadTypedValue(DbgType* dbgType, uint64 valAddr,
|
||||||
if (dbgType->mTypeCode == DbgType_Bitfield)
|
if (dbgType->mTypeCode == DbgType_Bitfield)
|
||||||
{
|
{
|
||||||
DbgType* underlyingType = dbgType->mTypeParam;
|
DbgType* underlyingType = dbgType->mTypeParam;
|
||||||
DbgTypedValue result = ReadTypedValue(dbgType->mTypeParam, valAddr, addrType);
|
DbgTypedValue result = ReadTypedValue(targetSrc, dbgType->mTypeParam, valAddr, addrType);
|
||||||
result.mType = dbgType;
|
result.mType = dbgType;
|
||||||
|
|
||||||
auto dbgBitfieldType = (DbgBitfieldType*)dbgType;
|
auto dbgBitfieldType = (DbgBitfieldType*)dbgType;
|
||||||
|
@ -3084,7 +3118,7 @@ DbgTypedValue DbgExprEvaluator::ReadTypedValue(DbgType* dbgType, uint64 valAddr,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DbgType_Enum:
|
case DbgType_Enum:
|
||||||
result = ReadTypedValue(dbgType->mTypeParam, valAddr, addrType);
|
result = ReadTypedValue(targetSrc, dbgType->mTypeParam, valAddr, addrType);
|
||||||
if (result)
|
if (result)
|
||||||
result.mType = dbgType;
|
result.mType = dbgType;
|
||||||
break;
|
break;
|
||||||
|
@ -3632,7 +3666,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool
|
||||||
{
|
{
|
||||||
if (mSubjectValue.mSrcAddress != 0)
|
if (mSubjectValue.mSrcAddress != 0)
|
||||||
{
|
{
|
||||||
auto refreshVal = ReadTypedValue(mSubjectValue.mType, mSubjectValue.mSrcAddress, DbgAddrType_Target);
|
auto refreshVal = ReadTypedValue(identifierNode, mSubjectValue.mType, mSubjectValue.mSrcAddress, DbgAddrType_Target);
|
||||||
if (refreshVal)
|
if (refreshVal)
|
||||||
mSubjectValue = refreshVal;
|
mSubjectValue = refreshVal;
|
||||||
}
|
}
|
||||||
|
@ -3678,7 +3712,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool
|
||||||
//bool isLocal = !valIsAddr;
|
//bool isLocal = !valIsAddr;
|
||||||
//if (valType->IsCompositeType())
|
//if (valType->IsCompositeType())
|
||||||
//isLocal = false;
|
//isLocal = false;
|
||||||
return ReadTypedValue(valType, valAddr, addrType);
|
return ReadTypedValue(identifierNode, valType, valAddr, addrType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3693,7 +3727,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool
|
||||||
//bool valIsAddr = false;
|
//bool valIsAddr = false;
|
||||||
if (mDebugTarget->GetValueByName(GetCurrentMethod(), "__closure", stackFrame, &valAddr, &valType, &addrType))
|
if (mDebugTarget->GetValueByName(GetCurrentMethod(), "__closure", stackFrame, &valAddr, &valType, &addrType))
|
||||||
{
|
{
|
||||||
DbgTypedValue closureValue = ReadTypedValue(valType, valAddr, addrType);
|
DbgTypedValue closureValue = ReadTypedValue(identifierNode, valType, valAddr, addrType);
|
||||||
if (closureValue)
|
if (closureValue)
|
||||||
{
|
{
|
||||||
SetAndRestoreValue<bool> prevIgnoreError(mIgnoreErrors, true);
|
SetAndRestoreValue<bool> prevIgnoreError(mIgnoreErrors, true);
|
||||||
|
@ -4634,7 +4668,7 @@ void DbgExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = ReadTypedValue(typeVariable->mType, collection.mPtr + typeVariable->mMemberOffset + (idx * typeVariable->mType->GetStride()), DbgAddrType_Target);
|
auto result = ReadTypedValue(indexerExpr, typeVariable->mType, collection.mPtr + typeVariable->mMemberOffset + (idx * typeVariable->mType->GetStride()), DbgAddrType_Target);
|
||||||
if (mResult.mIsReadOnly)
|
if (mResult.mIsReadOnly)
|
||||||
result.mIsReadOnly = true;
|
result.mIsReadOnly = true;
|
||||||
mResult = result;
|
mResult = result;
|
||||||
|
@ -4713,7 +4747,7 @@ void DbgExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto memberType = collection.mType->mTypeParam;
|
auto memberType = collection.mType->mTypeParam;
|
||||||
auto result = ReadTypedValue(memberType, target + indexArgument.GetInt64() * memberType->GetStride(), DbgAddrType_Target);
|
auto result = ReadTypedValue(indexerExpr, memberType, target + indexArgument.GetInt64() * memberType->GetStride(), DbgAddrType_Target);
|
||||||
if (mResult.mIsReadOnly)
|
if (mResult.mIsReadOnly)
|
||||||
result.mIsReadOnly = true;
|
result.mIsReadOnly = true;
|
||||||
mResult = result;
|
mResult = result;
|
||||||
|
@ -4859,19 +4893,21 @@ void DbgExprEvaluator::LookupSplatMember(const DbgTypedValue& target, const Stri
|
||||||
{
|
{
|
||||||
if (mReferenceId != NULL)
|
if (mReferenceId != NULL)
|
||||||
*mReferenceId = findName;
|
*mReferenceId = findName;
|
||||||
mResult = ReadTypedValue(valType, valAddr, addrType);
|
mResult = ReadTypedValue(NULL, valType, valAddr, addrType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* lookupNode, const DbgTypedValue& target, const StringImpl& fieldName, String* outFindName, bool* outIsConst)
|
void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* lookupNode, const DbgTypedValue& target, const StringImpl& fieldName, String* outFindName, bool* outIsConst, StringImpl* forceName)
|
||||||
{
|
{
|
||||||
/*DbgVariable* dbgVariable = (DbgVariable*)target.mVariable;
|
/*DbgVariable* dbgVariable = (DbgVariable*)target.mVariable;
|
||||||
if (dbgVariable != NULL)
|
if (dbgVariable != NULL)
|
||||||
return LookupSplatMember(target, fieldName);*/
|
return LookupSplatMember(target, fieldName);*/
|
||||||
|
|
||||||
|
auto curMethod = GetCurrentMethod();
|
||||||
|
|
||||||
while (auto parenNode = BfNodeDynCast<BfParenthesizedExpression>(lookupNode))
|
while (auto parenNode = BfNodeDynCast<BfParenthesizedExpression>(lookupNode))
|
||||||
lookupNode = parenNode->mExpression;
|
lookupNode = parenNode->mExpression;
|
||||||
|
|
||||||
|
@ -4882,8 +4918,8 @@ void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* looku
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
else
|
else if (forceName == NULL)
|
||||||
{
|
{
|
||||||
if (outFindName != NULL)
|
if (outFindName != NULL)
|
||||||
*outFindName = splatLookupEntry->mFindName;
|
*outFindName = splatLookupEntry->mFindName;
|
||||||
if (outIsConst != NULL)
|
if (outIsConst != NULL)
|
||||||
|
@ -4938,6 +4974,9 @@ void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* looku
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (forceName != NULL)
|
||||||
|
findName = *forceName;
|
||||||
|
|
||||||
CPUStackFrame* stackFrame = GetStackFrame();
|
CPUStackFrame* stackFrame = GetStackFrame();
|
||||||
intptr valAddr;
|
intptr valAddr;
|
||||||
|
@ -4974,15 +5013,34 @@ void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* looku
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foundParent)
|
if (!foundParent)
|
||||||
{
|
{
|
||||||
if (!mDebugTarget->GetValueByName(GetCurrentMethod(), findName, stackFrame, &valAddr, &valType, &addrType))
|
if (!mDebugTarget->GetValueByName(curMethod, findName, stackFrame, &valAddr, &valType, &addrType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (addrType == DbgAddrType_Alias)
|
||||||
|
{
|
||||||
|
findName = (const char*)valAddr;
|
||||||
|
|
||||||
|
if (!mDebugTarget->GetValueByName(curMethod, findName, stackFrame, &valAddr, &valType, &addrType))
|
||||||
|
{
|
||||||
|
if (curMethod->mInlineeInfo != NULL)
|
||||||
|
{
|
||||||
|
// Look outside to inline
|
||||||
|
SetAndRestoreValue<int> prevStackIdx(mCallStackIdx, mCallStackIdx + 1);
|
||||||
|
LookupSplatMember(targetNode, lookupNode, target, fieldName, outFindName, outIsConst, &findName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (addrType == DbgAddrType_LocalSplat)
|
if (addrType == DbgAddrType_LocalSplat)
|
||||||
{
|
{
|
||||||
DbgVariable* dbgVariable = (DbgVariable*)valAddr;
|
DbgVariable* dbgVariable = (DbgVariable*)valAddr;
|
||||||
// Use real name, in case of aliases
|
// Use real name, in case of aliases
|
||||||
findName = dbgVariable->mName;
|
findName = dbgVariable->mName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((wasCast) && (valType != NULL))
|
if ((wasCast) && (valType != NULL))
|
||||||
|
@ -5048,7 +5106,7 @@ void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* looku
|
||||||
if (outIsConst != NULL)
|
if (outIsConst != NULL)
|
||||||
*outIsConst = wantConst;
|
*outIsConst = wantConst;
|
||||||
|
|
||||||
if (mDebugTarget->GetValueByName(GetCurrentMethod(), findName, stackFrame, &valAddr, &valType, &addrType))
|
if (mDebugTarget->GetValueByName(curMethod, findName, stackFrame, &valAddr, &valType, &addrType))
|
||||||
{
|
{
|
||||||
BF_ASSERT(valType != NULL);
|
BF_ASSERT(valType != NULL);
|
||||||
|
|
||||||
|
@ -5061,7 +5119,7 @@ void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* looku
|
||||||
// Set readonly if the original value was const
|
// Set readonly if the original value was const
|
||||||
memberType = mDbgModule->GetConstType(valType);
|
memberType = mDbgModule->GetConstType(valType);
|
||||||
}*/
|
}*/
|
||||||
mResult = ReadTypedValue(memberType, valAddr, addrType);
|
mResult = ReadTypedValue(targetNode, memberType, valAddr, addrType);
|
||||||
if (wantConst)
|
if (wantConst)
|
||||||
{
|
{
|
||||||
// Set readonly if the original value was const
|
// Set readonly if the original value was const
|
||||||
|
@ -5073,6 +5131,14 @@ void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* looku
|
||||||
{
|
{
|
||||||
if (target.mSrcAddress == -1)
|
if (target.mSrcAddress == -1)
|
||||||
{
|
{
|
||||||
|
// if (curMethod->mInlineeInfo != NULL)
|
||||||
|
// {
|
||||||
|
// // Look outside to inline
|
||||||
|
// SetAndRestoreValue<int> prevStackIdx(mCallStackIdx, mCallStackIdx + 1);
|
||||||
|
// LookupSplatMember(targetNode, lookupNode, target, fieldName, outFindName, outIsConst, true);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
if (!memberType->IsStruct())
|
if (!memberType->IsStruct())
|
||||||
Fail("Failed to lookup splat member", (lookupNode != NULL) ? lookupNode : targetNode);
|
Fail("Failed to lookup splat member", (lookupNode != NULL) ? lookupNode : targetNode);
|
||||||
|
|
||||||
|
@ -6348,7 +6414,7 @@ void DbgExprEvaluator::PerformUnaryExpression(BfAstNode* opToken, BfUnaryOp unar
|
||||||
Fail("Operator can only be used on pointer values", opToken);
|
Fail("Operator can only be used on pointer values", opToken);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mResult = ReadTypedValue(type->mTypeParam, mResult.mPtr, DbgAddrType_Target);
|
mResult = ReadTypedValue(opToken, type->mTypeParam, mResult.mPtr, DbgAddrType_Target);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BfUnaryOp_AddressOf:
|
case BfUnaryOp_AddressOf:
|
||||||
|
@ -6529,7 +6595,7 @@ DbgTypedValue DbgExprEvaluator::CreateCall(DbgSubprogram* method, DbgTypedValue
|
||||||
auto returnType = method->mReturnType->RemoveModifiers(&hadRef);
|
auto returnType = method->mReturnType->RemoveModifiers(&hadRef);
|
||||||
if (hadRef)
|
if (hadRef)
|
||||||
{
|
{
|
||||||
returnVal = ReadTypedValue(returnType, returnVal.mPtr, DbgAddrType_Target);
|
returnVal = ReadTypedValue(NULL, returnType, returnVal.mPtr, DbgAddrType_Target);
|
||||||
returnVal.mType = returnType;
|
returnVal.mType = returnType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6689,7 +6755,7 @@ DbgTypedValue DbgExprEvaluator::CreateCall(BfAstNode* targetSrc, DbgTypedValue t
|
||||||
|
|
||||||
if (!type->IsCompositeType())
|
if (!type->IsCompositeType())
|
||||||
{
|
{
|
||||||
auto elemTypedValue = ReadTypedValue(type, typedVal.mSrcAddress, DbgAddrType_Target);
|
auto elemTypedValue = ReadTypedValue(targetSrc, type, typedVal.mSrcAddress, DbgAddrType_Target);
|
||||||
DbgMethodArgument methodArg;
|
DbgMethodArgument methodArg;
|
||||||
methodArg.mTypedValue = elemTypedValue;
|
methodArg.mTypedValue = elemTypedValue;
|
||||||
argPushQueue.push_back(methodArg);
|
argPushQueue.push_back(methodArg);
|
||||||
|
|
|
@ -253,7 +253,7 @@ public:
|
||||||
DebugTarget* mDebugTarget;
|
DebugTarget* mDebugTarget;
|
||||||
DbgModule* mOrigDbgModule;
|
DbgModule* mOrigDbgModule;
|
||||||
DbgModule* mDbgModule;
|
DbgModule* mDbgModule;
|
||||||
DbgCompileUnit* mDbgCompileUnit;
|
DbgCompileUnit* mDbgCompileUnit;
|
||||||
|
|
||||||
DbgLanguage mLanguage;
|
DbgLanguage mLanguage;
|
||||||
BfPassInstance* mPassInstance;
|
BfPassInstance* mPassInstance;
|
||||||
|
@ -301,7 +301,7 @@ public:
|
||||||
bool mIsComplexExpression;
|
bool mIsComplexExpression;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DbgTypedValue ReadTypedValue(DbgType* type, uint64 valAddr, DbgAddrType addrType);
|
DbgTypedValue ReadTypedValue(BfAstNode* targetSrc, DbgType* type, uint64 valAddr, DbgAddrType addrType);
|
||||||
bool CheckTupleCreation(addr_target receiveAddr, BfAstNode* targetSrc, DbgType* tupleType, const BfSizedArray<BfExpression*>& argValues, BfSizedArray<BfTupleNameNode*>* names);
|
bool CheckTupleCreation(addr_target receiveAddr, BfAstNode* targetSrc, DbgType* tupleType, const BfSizedArray<BfExpression*>& argValues, BfSizedArray<BfTupleNameNode*>* names);
|
||||||
DbgTypedValue CheckEnumCreation(BfAstNode* targetSrc, DbgType* enumType, const StringImpl& caseName, const BfSizedArray<BfExpression*>& argValues);
|
DbgTypedValue CheckEnumCreation(BfAstNode* targetSrc, DbgType* enumType, const StringImpl& caseName, const BfSizedArray<BfExpression*>& argValues);
|
||||||
void DoInvocation(BfAstNode* target, BfSizedArray<ASTREF(BfExpression*)>& args, BfSizedArray<ASTREF(BfTypeReference*)>* methodGenericArguments);
|
void DoInvocation(BfAstNode* target, BfSizedArray<ASTREF(BfExpression*)>& args, BfSizedArray<ASTREF(BfTypeReference*)>* methodGenericArguments);
|
||||||
|
@ -369,7 +369,7 @@ public:
|
||||||
DbgTypedValue LookupField(BfAstNode* targetSrc, DbgTypedValue target, const StringImpl& fieldName);
|
DbgTypedValue LookupField(BfAstNode* targetSrc, DbgTypedValue target, const StringImpl& fieldName);
|
||||||
DbgTypedValue LookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError = false, bool* hadError = NULL);
|
DbgTypedValue LookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError = false, bool* hadError = NULL);
|
||||||
void LookupSplatMember(const DbgTypedValue& target, const StringImpl& fieldName);
|
void LookupSplatMember(const DbgTypedValue& target, const StringImpl& fieldName);
|
||||||
void LookupSplatMember(BfAstNode* srcNode, BfAstNode* lookupNode, const DbgTypedValue& target, const StringImpl& fieldName, String* outFindName = NULL, bool* outIsConst = NULL);
|
void LookupSplatMember(BfAstNode* srcNode, BfAstNode* lookupNode, const DbgTypedValue& target, const StringImpl& fieldName, String* outFindName = NULL, bool* outIsConst = NULL, StringImpl* forceName = NULL);
|
||||||
void LookupQualifiedName(BfQualifiedNameNode* nameNode, bool ignoreInitialError = false, bool* hadError = NULL);
|
void LookupQualifiedName(BfQualifiedNameNode* nameNode, bool ignoreInitialError = false, bool* hadError = NULL);
|
||||||
DbgType* FindSubtype(DbgType* type, const StringImpl& name);
|
DbgType* FindSubtype(DbgType* type, const StringImpl& name);
|
||||||
void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError = false);
|
void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError = false);
|
||||||
|
|
|
@ -6705,7 +6705,7 @@ addr_target DbgModule::ExecuteOps(DbgSubprogram* dwSubprogram, const uint8* locD
|
||||||
}
|
}
|
||||||
|
|
||||||
BF_ASSERT(nonInlinedSubProgram->mFrameBaseData != NULL);
|
BF_ASSERT(nonInlinedSubProgram->mFrameBaseData != NULL);
|
||||||
uint64 loc = EvaluateLocation(nonInlinedSubProgram, nonInlinedSubProgram->mFrameBaseData, nonInlinedSubProgram->mFrameBaseLen, stackFrame, outAddrType, DbgEvalLocFlag_DisallowReg);
|
intptr loc = EvaluateLocation(nonInlinedSubProgram, nonInlinedSubProgram->mFrameBaseData, nonInlinedSubProgram->mFrameBaseLen, stackFrame, outAddrType, DbgEvalLocFlag_DisallowReg);
|
||||||
int64 offset = DecodeSLEB128(locData);
|
int64 offset = DecodeSLEB128(locData);
|
||||||
loc += offset;
|
loc += offset;
|
||||||
//loc = BfDebuggerReadMemory(loc);
|
//loc = BfDebuggerReadMemory(loc);
|
||||||
|
@ -6829,7 +6829,7 @@ addr_target DbgModule::ExecuteOps(DbgSubprogram* dwSubprogram, const uint8* locD
|
||||||
return stackFrameData[--stackIdx];
|
return stackFrameData[--stackIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
addr_target DbgModule::EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags)
|
intptr DbgModule::EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags)
|
||||||
{
|
{
|
||||||
BP_ZONE("DebugTarget::EvaluateLocation");
|
BP_ZONE("DebugTarget::EvaluateLocation");
|
||||||
|
|
||||||
|
|
|
@ -1297,7 +1297,7 @@ public:
|
||||||
int64 GetImageSize();
|
int64 GetImageSize();
|
||||||
virtual void FinishHotSwap();
|
virtual void FinishHotSwap();
|
||||||
addr_target ExecuteOps(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, CPURegisters* registers, DbgAddrType* outAddrType, DbgEvalLocFlags flags, addr_target* pushValue = NULL);
|
addr_target ExecuteOps(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, CPURegisters* registers, DbgAddrType* outAddrType, DbgEvalLocFlags flags, addr_target* pushValue = NULL);
|
||||||
virtual addr_target EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None);
|
virtual intptr EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None);
|
||||||
|
|
||||||
//const uint8* CopyOrigImageData(addr_target address, int length);
|
//const uint8* CopyOrigImageData(addr_target address, int length);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,8 @@ enum DbgAddrType : uint8
|
||||||
DbgAddrType_TargetDeref,
|
DbgAddrType_TargetDeref,
|
||||||
DbgAddrType_Register,
|
DbgAddrType_Register,
|
||||||
DbgAddrType_OptimizedOut,
|
DbgAddrType_OptimizedOut,
|
||||||
DbgAddrType_NoValue
|
DbgAddrType_NoValue,
|
||||||
|
DbgAddrType_Alias
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_BF_END
|
NS_BF_END
|
|
@ -543,7 +543,7 @@ void DebugTarget::EvaluateAutoStaticVariable(DbgVariable* variable, const String
|
||||||
if ((variable->mLocationData != NULL) && (variable->mLocationLen > 0))
|
if ((variable->mLocationData != NULL) && (variable->mLocationLen > 0))
|
||||||
{
|
{
|
||||||
DbgAddrType addrType = DbgAddrType_Local;
|
DbgAddrType addrType = DbgAddrType_Local;
|
||||||
addr_target variableAddr = variable->mStaticCachedAddr;
|
intptr variableAddr = variable->mStaticCachedAddr;
|
||||||
if (variableAddr == 0)
|
if (variableAddr == 0)
|
||||||
{
|
{
|
||||||
addrType = DbgAddrType_Target;
|
addrType = DbgAddrType_Target;
|
||||||
|
@ -2198,7 +2198,7 @@ bool DebugTarget::GetVariableIndexRegisterAndOffset(DbgVariable* dwVariable, int
|
||||||
addr_target DebugTarget::GetStaticAddress(DbgVariable* dwVariable)
|
addr_target DebugTarget::GetStaticAddress(DbgVariable* dwVariable)
|
||||||
{
|
{
|
||||||
DbgAddrType addrType;
|
DbgAddrType addrType;
|
||||||
return dwVariable->mCompileUnit->mDbgModule->EvaluateLocation(NULL, dwVariable->mLocationData, dwVariable->mLocationLen, NULL, &addrType);
|
return (addr_target)dwVariable->mCompileUnit->mDbgModule->EvaluateLocation(NULL, dwVariable->mLocationData, dwVariable->mLocationLen, NULL, &addrType);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, String& name, WdStackFrame* stackFrame, intptr* outAddr, DbgType** outType, DbgAddrType* outAddrType)
|
bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, String& name, WdStackFrame* stackFrame, intptr* outAddr, DbgType** outType, DbgAddrType* outAddrType)
|
||||||
|
|
|
@ -7033,7 +7033,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
|
||||||
if (ptrVal != 0)
|
if (ptrVal != 0)
|
||||||
{
|
{
|
||||||
DbgExprEvaluator dbgExprEvaluator(this, dbgModule, NULL, -1, -1);
|
DbgExprEvaluator dbgExprEvaluator(this, dbgModule, NULL, -1, -1);
|
||||||
DbgTypedValue innerTypedVal = dbgExprEvaluator.ReadTypedValue(innerType, typedValue.mPtr, DbgAddrType_Target);
|
DbgTypedValue innerTypedVal = dbgExprEvaluator.ReadTypedValue(NULL, innerType, typedValue.mPtr, DbgAddrType_Target);
|
||||||
if (innerTypedVal)
|
if (innerTypedVal)
|
||||||
{
|
{
|
||||||
DwFormatInfo defaultFormatInfo;
|
DwFormatInfo defaultFormatInfo;
|
||||||
|
@ -9115,7 +9115,7 @@ String WinDebugger::EvaluateContinue(DbgPendingExpr* pendingExpr, BfPassInstance
|
||||||
else if ((underlyingType->IsStruct()) && (exprResult.mSrcAddress != 0) && (underlyingType->IsTypedPrimitive()))
|
else if ((underlyingType->IsStruct()) && (exprResult.mSrcAddress != 0) && (underlyingType->IsTypedPrimitive()))
|
||||||
{
|
{
|
||||||
auto primType = underlyingType->GetRootBaseType();
|
auto primType = underlyingType->GetRootBaseType();
|
||||||
DbgTypedValue primVal = dbgExprEvaluator.ReadTypedValue(primType, exprResult.mSrcAddress, DbgAddrType_Target);
|
DbgTypedValue primVal = dbgExprEvaluator.ReadTypedValue(NULL, primType, exprResult.mSrcAddress, DbgAddrType_Target);
|
||||||
|
|
||||||
String primResult = DbgTypedValueToString(primVal, "", pendingExpr->mFormatInfo, NULL);
|
String primResult = DbgTypedValueToString(primVal, "", pendingExpr->mFormatInfo, NULL);
|
||||||
int crPos = (int)primResult.IndexOf('\n');
|
int crPos = (int)primResult.IndexOf('\n');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue