From 7352ac6ad60540e81700d29115be4f8a030a402d Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 23 Jul 2024 14:19:41 +0200 Subject: [PATCH] FpDebug: fixes for intrinsic Try/TryN, an invalid address is an error --- components/fpdebug/fppascalparser.pas | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/components/fpdebug/fppascalparser.pas b/components/fpdebug/fppascalparser.pas index 31946a14b4..458373230e 100644 --- a/components/fpdebug/fppascalparser.pas +++ b/components/fpdebug/fppascalparser.pas @@ -2248,6 +2248,7 @@ function TFpPascalExpressionPartIntrinsic.DoTry(AParams: TFpPascalExpressionPart var Expr: TFpPascalExpressionPart; HighIdx, i: Integer; + ff: TFpValueFieldFlags; begin Result := nil; if IsError(FExpression.Error) then @@ -2260,8 +2261,12 @@ begin Expr := AParams.Items[i]; Result := Expr.GetResultValue; if (Result <> nil) and (not IsError(FExpression.Error)) then begin - Result.AddReference; - exit; + ff := Result.FieldFlags; + if ( (not (svfAddress in ff)) or (IsValidLoc(Result.Address)) ) + then begin + Result.AddReference; + exit; + end; end; Expr.ResetEvaluationRecursive; @@ -2279,6 +2284,7 @@ function TFpPascalExpressionPartIntrinsic.DoTryN( var Expr: TFpPascalExpressionPart; HighIdx, i: Integer; + ff: TFpValueFieldFlags; begin Result := nil; if IsError(FExpression.Error) then @@ -2291,8 +2297,9 @@ begin Expr := AParams.Items[i]; Result := Expr.GetResultValue; if (Result <> nil) and (not IsError(FExpression.Error)) then begin - if ( (not (svfAddress in Result.FieldFlags)) or (not IsNilLoc(Result.Address)) ) and - ( (not (svfDataAddress in Result.FieldFlags)) or (not IsNilLoc(Result.DataAddress)) ) + ff := Result.FieldFlags; + if ( (not (svfAddress in ff)) or (IsReadableLoc(Result.Address)) ) and + ( (not (svfDataAddress in ff)) or (IsReadableLoc(Result.DataAddress)) ) then begin Result.AddReference; exit;