Stack overflow error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Stack overflow error

Carsten Bager
I am using the FPC Arm compiler on a embedded system.
To get the FPC complier to reported the actual error address when a
Stack overflow error occurs. I have replaced the call to
HandleError(202);
with
HandleErrorFrame(202,get_frame);
Otherwise the address reported is the
fpc_stackcheck address.

I think this problem will be the same on a normal system.

Regards Carsten.

------------------------
procedure
fpc_stackcheck(stack_size:SizeUInt);[public,alias:'FPC_STACKCHECK'];
var
  c : Pointer;
begin
  { Avoid recursive calls when called from the exit routines }
  if StackError then
   exit;
  c := Sptr - (stack_size + STACK_MARGIN);
  if (c <= StackBottom) then
   begin
     StackError:=true;
     HandleErrorFrame(202,get_frame);
   end;
end;
Med venlig hilsen
Carsten Bager

BEAS A/S
Brørupvænget 10
DK-7650 Bøvlingbjerg
Tlf. : +45 9788 5222 Fax : +45 9788 5434
www.beas.dk


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal