[fpc-pascal] Stack overflow error

Carsten Bager carsten at beas.dk
Tue Jul 24 15:24:59 CEST 2007


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





More information about the fpc-pascal mailing list