FpDebug: prevent div-by-zero in the debugger (in the IDE) while evaluating watches.

This commit is contained in:
Martin 2023-12-30 20:04:08 +01:00
parent 5c6662f3e7
commit 5a1d892e69

View File

@ -28,6 +28,7 @@ unit FpPascalParser;
{$IFDEF INLINE_OFF}{$INLINE OFF}{$ENDIF}
{$IF FPC_Fullversion=30202}{$Optimization NOPEEPHOLE}{$ENDIF}
{$TYPEDADDRESS on}
{$SafeFPUExceptions off}
interface
@ -79,6 +80,7 @@ type
FTextExpression: String;
FExpressionPart: TFpPascalExpressionPart;
FValid: Boolean;
FFpuMask: TFPUExceptionMask;
function GetResultValue: TFpValue;
function GetValid: Boolean;
procedure SetError(AMsg: String); // deprecated;
@ -3197,6 +3199,8 @@ end;
constructor TFpPascalExpression.Create(ATextExpression: String;
AContext: TFpDbgSymbolScope; ASkipParse: Boolean);
begin
FFpuMask := GetExceptionMask;
SetExceptionMask([low(TFPUExceptionMask)..high(TFPUExceptionMask)]);
FContext := AContext;
FContext.AddReference;
FTextExpression := ATextExpression;
@ -3211,6 +3215,8 @@ begin
FreeAndNil(FExpressionPart);
FContext.ReleaseReference;
inherited Destroy;
ClearExceptions(False);
SetExceptionMask(FFpuMask);
end;
function TFpPascalExpression.DebugDump(AWithResults: Boolean): String;