1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Disallow function calls in conditional breakpoints

This commit is contained in:
Brian Fiete 2020-05-15 14:54:43 -07:00
parent e5f97bc618
commit cfc25003a0
2 changed files with 11 additions and 1 deletions

View file

@ -7937,6 +7937,11 @@ DbgTypedValue DbgExprEvaluator::Resolve(BfExpression* expr, DbgType* wantType)
SetAndRestoreValue<DbgType*> prevType(mExpectingType, wantType);
SetAndRestoreValue<DbgTypedValue> prevResult(mResult, DbgTypedValue());
if ((mExpressionFlags & DwEvalExpressionFlag_AllowCalls) != 0)
{
BF_ASSERT(mCallResults != NULL);
}
if (mExplicitThis)
mExplicitThis = FixThis(mExplicitThis);

View file

@ -3704,7 +3704,7 @@ bool WinDebugger::CheckConditionalBreakpoint(WdBreakpoint* breakpoint, DbgSubpro
conditional->mDbgEvaluationContext->mDbgExprEvaluator->mSubjectExpr = subjectExpr;
conditional->mDbgEvaluationContext->mDbgExprEvaluator->mDbgCompileUnit = subprogram->mCompileUnit;
conditional->mDbgEvaluationContext->mDbgExprEvaluator->mCallStackIdx = 0;
conditional->mDbgEvaluationContext->mDbgExprEvaluator->mExpressionFlags = (DwEvalExpressionFlags)(DwEvalExpressionFlag_AllowSideEffects | DwEvalExpressionFlag_AllowCalls);
conditional->mDbgEvaluationContext->mDbgExprEvaluator->mExpressionFlags = (DwEvalExpressionFlags)(DwEvalExpressionFlag_AllowSideEffects);
}
WdStackFrame* wdStackFrame = new WdStackFrame();
@ -3726,6 +3726,11 @@ bool WinDebugger::CheckConditionalBreakpoint(WdBreakpoint* breakpoint, DbgSubpro
mDebugManager->mOutMessages.push_back(condError);
return true;
}
else if (conditional->mDbgEvaluationContext->mDbgExprEvaluator->mBlockedSideEffects)
{
mDebugManager->mOutMessages.push_back(StrFormat("error Conditional breakpoint expression '%s' contained function calls, which is not allowed", conditional->mExpr.c_str()));
return true;
}
else if ((!result) || (!result.mType->IsBoolean()))
{
mDebugManager->mOutMessages.push_back(StrFormat("error Conditional breakpoint expression '%s' must result in a boolean value", conditional->mExpr.c_str()));