FpDebug: fixes for intrinsic Try/TryN, an invalid address is an error

This commit is contained in:
Martin 2024-07-23 14:19:41 +02:00
parent f660bc1abb
commit 7352ac6ad6

View File

@ -2248,6 +2248,7 @@ function TFpPascalExpressionPartIntrinsic.DoTry(AParams: TFpPascalExpressionPart
var var
Expr: TFpPascalExpressionPart; Expr: TFpPascalExpressionPart;
HighIdx, i: Integer; HighIdx, i: Integer;
ff: TFpValueFieldFlags;
begin begin
Result := nil; Result := nil;
if IsError(FExpression.Error) then if IsError(FExpression.Error) then
@ -2260,8 +2261,12 @@ begin
Expr := AParams.Items[i]; Expr := AParams.Items[i];
Result := Expr.GetResultValue; Result := Expr.GetResultValue;
if (Result <> nil) and (not IsError(FExpression.Error)) then begin if (Result <> nil) and (not IsError(FExpression.Error)) then begin
Result.AddReference; ff := Result.FieldFlags;
exit; if ( (not (svfAddress in ff)) or (IsValidLoc(Result.Address)) )
then begin
Result.AddReference;
exit;
end;
end; end;
Expr.ResetEvaluationRecursive; Expr.ResetEvaluationRecursive;
@ -2279,6 +2284,7 @@ function TFpPascalExpressionPartIntrinsic.DoTryN(
var var
Expr: TFpPascalExpressionPart; Expr: TFpPascalExpressionPart;
HighIdx, i: Integer; HighIdx, i: Integer;
ff: TFpValueFieldFlags;
begin begin
Result := nil; Result := nil;
if IsError(FExpression.Error) then if IsError(FExpression.Error) then
@ -2291,8 +2297,9 @@ begin
Expr := AParams.Items[i]; Expr := AParams.Items[i];
Result := Expr.GetResultValue; Result := Expr.GetResultValue;
if (Result <> nil) and (not IsError(FExpression.Error)) then begin if (Result <> nil) and (not IsError(FExpression.Error)) then begin
if ( (not (svfAddress in Result.FieldFlags)) or (not IsNilLoc(Result.Address)) ) and ff := Result.FieldFlags;
( (not (svfDataAddress in Result.FieldFlags)) or (not IsNilLoc(Result.DataAddress)) ) if ( (not (svfAddress in ff)) or (IsReadableLoc(Result.Address)) ) and
( (not (svfDataAddress in ff)) or (IsReadableLoc(Result.DataAddress)) )
then begin then begin
Result.AddReference; Result.AddReference;
exit; exit;