1) You can debug your code on linux.
2) Here is a trick that works for me on win xp:
program project1;
{$mode delphi}
uses
SysUtils,jwawinbase,JwaWinNT,math;
function MyExceptionHandler(ExceptionInfo: PEXCEPTION_POINTERS): Longint; stdcall;
var e:exception;
begin
ExceptionInfo.ContextRecord.FloatSave.ControlWord:=ExceptionInfo.ContextRecord.FloatSave.ControlWord or $7F;
ClearExceptions(false);
result:=-1; //EXCEPTION_CONTINUE_EXECUTION;
e:= exception.Create('my exception');
raise e;
end;
var
v : Double;
h:pointer;
begin
h:=AddVectoredExceptionHandler(1,@MyExceptionHandler);
try
v:=0;
v:=1/v;
TryStrToFloat('9e9999', v);
except
on e: Exception do begin
writeln('Error:',e.ClassName);
readln;
end;
end;
end.
The code installs a custom exception vector handler as the first handler. GDB breaks the code when a SIGFPE is received. Continue will hand the exception to MyExceptionHandler. It modifies the FPU ControlWord in the Context (indirectly because the code will continue after loading registers from the Context), clear the FPU exception (similar to FCLEX), create a new exception and raise that one. The new exception will trigger your pascal exception handling.
The code will handle all exceptions the same way. You can use ExceptionInfo.ExceptionRecord.ExceptionCode to find out what the exception is about. You can also restore the FPU mask in your pascal exception handling. Hopefully that is enough to debug your fp code.