mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Improved debugger string comparison
This commit is contained in:
parent
1b6d9808f3
commit
0bdfea7231
3 changed files with 33 additions and 14 deletions
|
@ -5934,8 +5934,13 @@ void DbgExprEvaluator::PerformBinaryOperation(ASTREF(BfExpression*)& leftExpress
|
||||||
auto& displayStringList = debugVis->mStringViews;
|
auto& displayStringList = debugVis->mStringViews;
|
||||||
|
|
||||||
DwFormatInfo formatInfo;
|
DwFormatInfo formatInfo;
|
||||||
|
formatInfo.mCallStackIdx = mCallStackIdx;
|
||||||
formatInfo.mRawString = true;
|
formatInfo.mRawString = true;
|
||||||
formatInfo.mLanguage = language;
|
formatInfo.mLanguage = language;
|
||||||
|
formatInfo.mNamespaceSearch = mNamespaceSearchStr;
|
||||||
|
formatInfo.mExplicitThis = mExplicitThis;
|
||||||
|
if (mReferenceId != NULL)
|
||||||
|
formatInfo.mReferenceId = *mReferenceId;
|
||||||
if (!displayEntry->mCondition.empty())
|
if (!displayEntry->mCondition.empty())
|
||||||
{
|
{
|
||||||
if (!mDebugger->EvalCondition(debugVis, dbgCompileUnit, useTypedValue, formatInfo, displayEntry->mCondition, dbgVisWildcardCaptures, displayString))
|
if (!mDebugger->EvalCondition(debugVis, dbgCompileUnit, useTypedValue, formatInfo, displayEntry->mCondition, dbgVisWildcardCaptures, displayString))
|
||||||
|
@ -5943,14 +5948,15 @@ void DbgExprEvaluator::PerformBinaryOperation(ASTREF(BfExpression*)& leftExpress
|
||||||
}
|
}
|
||||||
|
|
||||||
String displayStr = mDebugger->mDebugManager->mDebugVisualizers->DoStringReplace(displayEntry->mString, dbgVisWildcardCaptures);
|
String displayStr = mDebugger->mDebugManager->mDebugVisualizers->DoStringReplace(displayEntry->mString, dbgVisWildcardCaptures);
|
||||||
mDebugger->ProcessEvalString(dbgCompileUnit, useTypedValue, displayStr, displayString, formatInfo, debugVis, false);
|
if (mDebugger->ProcessEvalString(dbgCompileUnit, useTypedValue, displayStr, displayString, formatInfo, debugVis, false))
|
||||||
|
{
|
||||||
|
bool isEq = displayString == resultTypedValue->mCharPtr;
|
||||||
|
|
||||||
bool isEq = displayString == resultTypedValue->mCharPtr;
|
auto boolType = mDbgModule->GetPrimitiveType(DbgType_Bool, GetLanguage());
|
||||||
|
mResult.mType = boolType;
|
||||||
auto boolType = mDbgModule->GetPrimitiveType(DbgType_Bool, GetLanguage());
|
mResult.mBool = isEq == ((binaryOp == BfBinaryOp_Equality) || (binaryOp == BfBinaryOp_StrictEquality));
|
||||||
mResult.mType = boolType;
|
return;
|
||||||
mResult.mBool = isEq == ((binaryOp == BfBinaryOp_Equality) || (binaryOp == BfBinaryOp_StrictEquality));
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6751,8 +6751,10 @@ String WinDebugger::ReadString(DbgTypeCode charType, intptr addr, bool isLocalAd
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinDebugger::ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValue useTypedValue, String& evalStr, String& displayString, DwFormatInfo& formatInfo, DebugVisualizerEntry* debugVis, bool limitLength)
|
bool WinDebugger::ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValue useTypedValue, String& evalStr, String& displayString, DwFormatInfo& formatInfo, DebugVisualizerEntry* debugVis, bool limitLength)
|
||||||
{
|
{
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
for (int i = 0; i < (int)evalStr.length(); i++)
|
for (int i = 0; i < (int)evalStr.length(); i++)
|
||||||
{
|
{
|
||||||
char c = evalStr[i];
|
char c = evalStr[i];
|
||||||
|
@ -6794,22 +6796,31 @@ void WinDebugger::ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValu
|
||||||
if ((formatInfo.mRawString) && (limitLength))
|
if ((formatInfo.mRawString) && (limitLength))
|
||||||
{
|
{
|
||||||
displayString = result;
|
displayString = result;
|
||||||
return;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
int crPos = result.IndexOf('\n');
|
if (displayStrFormatInfo.mRawString)
|
||||||
if (crPos != -1)
|
{
|
||||||
displayString += result.Substring(0, crPos);
|
|
||||||
else
|
|
||||||
displayString += result;
|
displayString += result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int crPos = result.IndexOf('\n');
|
||||||
|
if (crPos != -1)
|
||||||
|
displayString += result.Substring(0, crPos);
|
||||||
|
else
|
||||||
|
displayString += result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (debugVis != NULL)
|
else if (debugVis != NULL)
|
||||||
{
|
{
|
||||||
|
success = false;
|
||||||
displayString += "<DbgVis Failed>";
|
displayString += "<DbgVis Failed>";
|
||||||
DbgVisFailed(debugVis, evalString, errors);
|
DbgVisFailed(debugVis, evalString, errors);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
success = false;
|
||||||
displayString += "<Eval Failed>";
|
displayString += "<Eval Failed>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6830,6 +6841,8 @@ void WinDebugger::ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValu
|
||||||
|
|
||||||
displayString += c;
|
displayString += c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsNormalChar(uint32 c)
|
static bool IsNormalChar(uint32 c)
|
||||||
|
|
|
@ -516,7 +516,7 @@ public:
|
||||||
DbgTypedValue EvaluateInContext(DbgCompileUnit* dbgCompileUnit, const DbgTypedValue& contextTypedValue, const StringImpl& subExpr, DwFormatInfo* formatInfo = NULL, String* outReferenceId = NULL, String* outErrors = NULL);
|
DbgTypedValue EvaluateInContext(DbgCompileUnit* dbgCompileUnit, const DbgTypedValue& contextTypedValue, const StringImpl& subExpr, DwFormatInfo* formatInfo = NULL, String* outReferenceId = NULL, String* outErrors = NULL);
|
||||||
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);
|
bool ProcessEvalString(DbgCompileUnit* dbgCompileUnit, DbgTypedValue useTypedValue, String& evalStr, String& displayString, DwFormatInfo& formatInfo, DebugVisualizerEntry* debugVis, bool limitLength);
|
||||||
String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo, bool wantStringView);
|
String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo, bool wantStringView);
|
||||||
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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue