3 Copyright (c) 1998-2000 by Michael Van Canneyt
5 Unit to catch segmentation faults and Ctrl-C and exit gracefully
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *********************************************************************
27 { go32v2 stack check goes nuts if ss is not the data selector (PM) }
53 OldSigInt
,OldSigFPE
: SignalHandler
;
56 Const in_const_evaluation
: boolean = false;
62 Procedure CatchSignal(Sig
: Integer);cdecl;
64 Function CatchSignal(Sig
: longint):longint;
69 { Temporary message - until we get an error number... }
70 writeln ('Panic : Internal compiler error, exiting.');
74 If in_const_evaluation
then
75 Writeln('FPE error computing constant expression')
77 Writeln('FPE error inside compiler');
81 WriteLn('Ctrl-C Signaled!');
89 {$endif def has_signal}
96 NewSignal
:=SignalHandler(@CatchSignal
);
98 NewSignal
:=SignalHandler(CatchSignal
);
100 OldSigSegm
:=Signal (SIGSEGV
,NewSignal
);
101 OldSigInt
:=Signal (SIGINT
,NewSignal
);
102 OldSigFPE
:=Signal (SIGFPE
,NewSignal
);
109 Revision 1.1 2002/02/19 08:21:30 sasu
112 Revision 1.1.2.1 2000/09/10 16:12:20 marco
113 removed don't catch define for BSD
115 Revision 1.1 2000/07/13 06:29:44 michael
118 Revision 1.14 2000/04/07 20:52:24 marco
119 * For BSD signals are off for now
121 Revision 1.13 2000/03/20 09:37:51 florian
122 * catching of exceptions is switched off on all targets if the define
125 Revision 1.12 2000/02/18 12:34:43 pierre
126 DEBUG implies NOCATCH for go32v2
128 Revision 1.11 2000/02/09 13:22:45 peter
131 Revision 1.10 2000/01/07 01:14:20 peter
132 * updated copyright to 2000
134 Revision 1.9 1999/08/25 16:41:04 peter
135 * resources are working again
137 Revision 1.8 1999/08/10 12:27:15 pierre
138 * not stack check inside catch !!