better handling of unhandled exceptions

This commit is contained in:
michael 1998-10-02 10:40:19 +00:00
parent 45f1890009
commit a99c5a00c7

View File

@ -100,14 +100,24 @@ begin
ExceptObjectStack^.Addr:=AnAddr;
end;
Procedure DoUnHandledException (Var Obj : TObject; AnAddr : Pointer);
begin
If ExceptProc<>Nil then
If ExceptObjectStack<>Nil then
TExceptPRoc(ExceptProc)(Obj,AnAddr);
RunError(217);
end;
Function Raiseexcept (Obj : TObject; AnAddr : Pointer) : TObject;[Public, Alias : 'FPC_RAISEEXCEPTION'];
begin
{$ifdef excdebug}
writeln ('In RAiseException');
{$endif}
PushExceptObj(Obj,AnAddr);
If ExceptAddrStack=Nil then
DoUnhandledException (Obj,AnAddr);
longjmp(ExceptAddrStack^.Buf^,FPC_Exception);
end;
@ -141,6 +151,7 @@ begin
ExceptObjectStack:=ExceptObjectStack^.Next;
end;
Procedure ReRaise;[Public, Alias : 'FPC_RERAISE'];
begin
@ -149,13 +160,8 @@ begin
{$endif}
PopAddrStack;
If ExceptAddrStack=Nil then
begin
If ExceptProc<>Nil then
If ExceptObjectStack<>Nil then
TExceptPRoc(ExceptProc)(ExceptObjectStack^.FObject,
ExceptObjectStack^.Addr);
RunError(217);
end;
DoUnHandledException (ExceptObjectStack^.FObject,
ExceptObjectStack^.Addr);
longjmp(ExceptAddrStack^.Buf^,FPC_Exception);
end;