Forum > Packages and Libraries

[SOLVED] PascalScript SIGFPE

(1/1)

alpine:
I am trying to make a small project using PascalScript included into the Lazarus distribution. I have an issue when I deliberately code a zero division into the script.

My expectations was that the TPSScript.Execute will return false and then ExecErrorCode will be ErDivideByZero, but unfortunately the whole program aborts and the control is not returned to my calling method.

The exception is thrown in TPSExec.DoCalc, upsRuntime.pas, line 5948.

I can see later in the TPSExec.DoCalc some exception handling code, line 6329:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  except    {$IFDEF DELPHI6UP}    Tmp := AcquireExceptionObject;    {$ELSE}    if RaiseList <> nil then    begin      Tmp := Exception(PRaiseFrame(RaiseList)^.ExceptObject);  ... 
I have tried to enable all runtime checks in the project, but it doesn't helps.

The message is:

Project PAScr raised exception class 'External: SIGFPE'.

 In file 'uPSRuntime.pas' at line 5948:
btS32: tbts32(var1^) := tbts32(var1^) div tbts32(var2^);

The Pascal script is:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  A, B, C: Integer;begin  A := 1;  B := 2;  C := A + B;  C := B div 0;end. 
Does anybody have an idea what I'm missing?

Lazarus 1.9.0 r63034 FPC 3.1.1 i386-win32-win32/win64

alpine:
Update: Everything runs as expected when started without debugger. It is not related to PascalScript. It seems to be related to the GDB.

Tested with the test example from https://forum.lazarus.freepascal.org/index.php/topic,22877.msg135755.html#msg135755
Also aborts immediately on SGFPE when debugged (doesn't write the class name) and works fine when started in console.

Most probably the GDB.exe must be updated...

Navigation

[0] Message Index

Go to full version