1 --- fpc-2.2.2/fpcsrc/rtl/inc/system.inc.ori 2009-03-16 16:28:29.000000000 +0100
2 +++ fpc-2.2.2/fpcsrc/rtl/inc/system.inc 2009-03-16 18:29:45.000000000 +0100
5 *****************************************************************************}
7 +{ MOP 2009 patch: call sigabort when -gl was used in compilation }
9 + DontHaltInHandleError : boolean = false;
11 +function IsCompiledWithGl : boolean;
13 + { -gl modifies BackTraceStrFunc to point to lineinfo unit }
14 + IsCompiledWithGl := BackTraceStrFunc <> @SysBackTraceStr;
17 +procedure InternalExit; forward;
18 +{ We define next method as a macro, because we do not want to
19 + show it when a stack is dumped. Because of the same reason
20 + we call SYSCALL_KILL ourselves in assembler code. }
22 +{$define DumpStackAndAbort:=
26 + movl $20, %eax; { SYSCALL_GETPID as first argument }
27 + int $0x80; { GETPID -> eax }
28 + movl %eax, %ebx; { PID as second argument }
29 + movl $37, %eax; { SYSCALL_KILL as first argument }
30 + movl $6, %ecx; { SIGABRT as third argument }
35 +{ MOP 2009 patch ends }
37 procedure fpc_rangeerror;[public,alias:'FPC_RANGEERROR']; compilerproc;
39 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
40 HandleErrorFrame(201,get_frame);
41 + DumpStackAndAbort; { MOP 2009 patch }
45 procedure fpc_divbyzero;[public,alias:'FPC_DIVBYZERO']; compilerproc;
47 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
48 HandleErrorFrame(200,get_frame);
49 + DumpStackAndAbort; { MOP 2009 patch }
53 procedure fpc_overflow;[public,alias:'FPC_OVERFLOW']; compilerproc;
55 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
56 HandleErrorFrame(215,get_frame);
57 + DumpStackAndAbort; { MOP 2009 patch }
61 procedure fpc_threaderror; [public,alias:'FPC_THREADERROR'];
63 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
64 HandleErrorFrame(6,get_frame);
65 + DumpStackAndAbort; { MOP 2009 patch }
73 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
74 HandleErrorFrame(l,get_frame);
75 + DumpStackAndAbort; { MOP 2009 patch }
81 if assigned(SafeCallErrorProc) then
82 SafeCallErrorProc(res,get_frame);
83 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
84 HandleErrorFrame(229,get_frame);
85 + DumpStackAndAbort; { MOP 2009 patch }
90 if (c <= StackBottom) then
93 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
95 + DumpStackAndAbort; { MOP 2009 patch }
100 errorcode:=word(Errno);
103 + if DontHaltInHandleError then exit; { MOP 2009 patch }
104 + if IsCompiledWithGl then DumpStackAndAbort; { MOP 2009 patch }
105 {$ifdef FPC_HAS_FEATURE_EXCEPTIONS}
106 if ExceptAddrStack <> nil then
107 raise TObject(nil) at addr,frame;
110 erroraddr:=get_caller_addr(get_frame);
111 errorbase:=get_caller_frame(get_frame);
112 + if IsCompiledWithGl then DumpStackAndAbort; { MOP 2009 patch }
113 {$ifdef FPC_HAS_FEATURE_EXITCODE}
114 if errorcode <= maxExitCode then
116 @@ -1148,7 +1195,9 @@
118 If pointer(AbstractErrorProc)<>nil then
120 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
121 HandleErrorFrame(211,get_frame);
122 + DumpStackAndAbort; { MOP 2009 patch }
126 @@ -1156,8 +1205,11 @@
128 if pointer(AssertErrorProc)<>nil then
129 AssertErrorProc(Msg,FName,LineNo,ErrorAddr)
132 + if IsCompiledWithGl then DontHaltInHandleError := true; { MOP 2009 patch }
133 HandleErrorFrame(227,get_frame);
134 + DumpStackAndAbort; { MOP 2009 patch }