diff --git a/ide/fpcatch.pas b/ide/fpcatch.pas index 09280f6eec..70861c0464 100644 --- a/ide/fpcatch.pas +++ b/ide/fpcatch.pas @@ -47,6 +47,18 @@ Const Procedure EnableCatchSignals; Procedure DisableCatchSignals; +{$ifdef DEBUG} +procedure Generate_SIGSEGV; +procedure Generate_SIGFPE; +{$endif DEBUG} + +{$ifndef GABOR} +var + StopJmp : Jmp_Buf; +const + StopJmpValid : boolean = false; +{$endif} + Implementation uses @@ -65,6 +77,28 @@ uses Const LastCtrlC : longint = 0; +{$ifdef DEBUG} + +procedure Generate_SIGSEGV; +var + l : plongint; +begin + { Force a SIGSEGV } + l:=$ffffffff; + l^:=1; +end; + +procedure Generate_SIGFPE; +var + x,y : real; +begin + { Force a SIGFPE } + y:=-5; + x:=sqrt(y); +end; + +{$endif DEBUG} + {$ifdef HasSignal} {$ifdef Unix} Procedure CatchSignal(Sig : Integer);cdecl; @@ -195,7 +229,10 @@ end. { $Log$ - Revision 1.3 2001-10-24 14:17:27 pierre + Revision 1.4 2002-03-20 14:48:27 pierre + * moved StopJmp buffer to fpcatch unit + + Revision 1.3 2001/10/24 14:17:27 pierre * try to fix the Win2000 mouse problem Revision 1.2 2001/08/05 02:01:47 peter diff --git a/ide/fpcompil.pas b/ide/fpcompil.pas index 2009d2f1bc..60c6b044f2 100644 --- a/ide/fpcompil.pas +++ b/ide/fpcompil.pas @@ -125,12 +125,6 @@ procedure ParseUserScreen; procedure RegisterFPCompile; -{$ifndef GABOR} -var - StopJmp : Jmp_Buf; -const - StopJmpValid : boolean = false; -{$endif} implementation @@ -149,6 +143,9 @@ uses {$ifdef win32} signals, {$endif} +{$ifdef HasSignal} + fpcatch, +{$endif HasSignal} Dos,Video, StdDlg,App,tokens, {$ifdef FVISION} @@ -824,7 +821,9 @@ procedure DoCompile(Mode: TCompileMode); var s,FileName: string; ErrFile : Text; - MustRestartDebugger : boolean; + MustRestartDebugger, + StoreStopJumpValid : boolean; + StoreStopJmp : Jmp_buf; JmpRet,Error,LinkErrorCount : longint; E : TEvent; DummyView: PView; @@ -920,6 +919,8 @@ begin WUtils.DeleteFile(GetExePath+PpasFile); SetStatus('Compiling...'); {$ifndef GABOR} + StoreStopJumpValid:=StopJmpValid; + StoreStopJmp:=StopJmp; StopJmpValid:=true; JmpRet:=SetJmp(StopJmp); if JmpRet=0 then @@ -956,7 +957,8 @@ begin CompilerMessageWindow^.AddMessage(V_error,'Long jumped out of compilation...','',0,0); SetStatus('Long jumped out of compilation...'); end; - StopJmpValid:=false; + StopJmpValid:=StoreStopJumpValid; + StopJmp:=StoreStopJmp; {$endif} { tokens are created and distroyed by compiler.compile !! PM } InitTokens; @@ -1238,6 +1240,7 @@ begin begin S^.Reset; Dispose(S, Done); + S:=nil; OK:=true; end; fileclose:=OK; @@ -1255,7 +1258,10 @@ end; end. { $Log$ - Revision 1.6 2001-11-13 01:58:34 carl + Revision 1.7 2002-03-20 14:48:27 pierre + * moved StopJmp buffer to fpcatch unit + + Revision 1.6 2001/11/13 01:58:34 carl * Range check error fix Revision 1.5 2001/10/03 10:21:43 pierre