mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 15:49:16 +02:00
+ copyright header
* writelns cleaned up git-svn-id: trunk@4440 -
This commit is contained in:
parent
cb01ea581c
commit
2534fc6636
@ -1,3 +1,17 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Free Pascal run time library.
|
||||||
|
This unit implements unix like signal handling for win32
|
||||||
|
Copyright (c) 1999-2006 by the Free Pascal development team.
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
unit signals;
|
unit signals;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
@ -178,7 +192,11 @@ var
|
|||||||
movl (%ebp),%eax
|
movl (%ebp),%eax
|
||||||
movl %eax,_ebp
|
movl %eax,_ebp
|
||||||
end;
|
end;
|
||||||
Writeln('In start of JumpToHandleSignal');
|
{$ifdef SIGNALS_DEBUG}
|
||||||
|
if IsConsole then
|
||||||
|
Writeln(stderr,'In start of JumpToHandleSignal');
|
||||||
|
{$endif SIGNALS_DEBUG}
|
||||||
|
|
||||||
if except_level>0 then
|
if except_level>0 then
|
||||||
dec(except_level)
|
dec(except_level)
|
||||||
else
|
else
|
||||||
@ -207,7 +225,10 @@ var
|
|||||||
|
|
||||||
if res=0 then
|
if res=0 then
|
||||||
Begin
|
Begin
|
||||||
Writeln('In JumpToHandleSignal');
|
{$ifdef SIGNALS_DEBUG}
|
||||||
|
if IsConsole then
|
||||||
|
Writeln(stderr,'In JumpToHandleSignal');
|
||||||
|
{$endif SIGNALS_DEBUG}
|
||||||
RunError(sigtype);
|
RunError(sigtype);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -232,7 +253,10 @@ var
|
|||||||
var frame,res : longint;
|
var frame,res : longint;
|
||||||
function CallSignal(sigtype,frame : longint;must_reset_fpu : boolean) : longint;
|
function CallSignal(sigtype,frame : longint;must_reset_fpu : boolean) : longint;
|
||||||
begin
|
begin
|
||||||
writeln(stderr,'CallSignal called');
|
{$ifdef SIGNALS_DEBUG}
|
||||||
|
if IsConsole then
|
||||||
|
writeln(stderr,'CallSignal called for signal ',sigtype);
|
||||||
|
{$endif SIGNALS_DEBUG}
|
||||||
{if frame=0 then
|
{if frame=0 then
|
||||||
begin
|
begin
|
||||||
CallSignal:=1;
|
CallSignal:=1;
|
||||||
@ -251,7 +275,10 @@ var
|
|||||||
excep_ContextRecord^.Eip:=longint(@JumpToHandleSignal);
|
excep_ContextRecord^.Eip:=longint(@JumpToHandleSignal);
|
||||||
excep_ExceptionRecord^.ExceptionCode:=0;
|
excep_ExceptionRecord^.ExceptionCode:=0;
|
||||||
CallSignal:=0;
|
CallSignal:=0;
|
||||||
|
{$ifdef SIGNALS_DEBUG}
|
||||||
|
if IsConsole then
|
||||||
writeln(stderr,'Exception_Continue_Execution set');
|
writeln(stderr,'Exception_Continue_Execution set');
|
||||||
|
{$endif SIGNALS_DEBUG}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -262,11 +289,11 @@ var
|
|||||||
frame:=0;
|
frame:=0;
|
||||||
{ default : unhandled !}
|
{ default : unhandled !}
|
||||||
res:=1;
|
res:=1;
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SIGNALS_DEBUG}
|
||||||
if IsConsole then
|
if IsConsole then
|
||||||
writeln(stderr,'Signals exception ',
|
writeln(stderr,'Signals exception ',
|
||||||
hexstr(excep_ExceptionRecord^.ExceptionCode,8));
|
hexstr(excep_ExceptionRecord^.ExceptionCode,8));
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SIGNALS_DEBUG}
|
||||||
case excep_ExceptionRecord^.ExceptionCode of
|
case excep_ExceptionRecord^.ExceptionCode of
|
||||||
EXCEPTION_ACCESS_VIOLATION :
|
EXCEPTION_ACCESS_VIOLATION :
|
||||||
res:=CallSignal(SIGSEGV,frame,false);
|
res:=CallSignal(SIGSEGV,frame,false);
|
||||||
@ -360,15 +387,15 @@ const
|
|||||||
Exception_handler_installed:=true;
|
Exception_handler_installed:=true;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SIGNALS_DEBUG}
|
||||||
asm
|
asm
|
||||||
movl $0,%eax
|
movl $0,%eax
|
||||||
movl %fs:(%eax),%eax
|
movl %fs:(%eax),%eax
|
||||||
movl %eax,oldexceptaddr
|
movl %eax,oldexceptaddr
|
||||||
end;
|
end;
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SIGNALS_DEBUG}
|
||||||
PreviousHandler:=SetUnhandledExceptionFilter(@API_signals_exception_handler);
|
PreviousHandler:=SetUnhandledExceptionFilter(@API_signals_exception_handler);
|
||||||
{$ifdef SYSTEMEXCEPTIONDEBUG}
|
{$ifdef SIGNALS_DEBUG}
|
||||||
asm
|
asm
|
||||||
movl $0,%eax
|
movl $0,%eax
|
||||||
movl %fs:(%eax),%eax
|
movl %fs:(%eax),%eax
|
||||||
@ -380,7 +407,7 @@ const
|
|||||||
' new exception ',hexstr(newexceptaddr,8));
|
' new exception ',hexstr(newexceptaddr,8));
|
||||||
writeln('SetUnhandledExceptionFilter returned ',hexstr(longint(PreviousHandler),8));
|
writeln('SetUnhandledExceptionFilter returned ',hexstr(longint(PreviousHandler),8));
|
||||||
end;
|
end;
|
||||||
{$endif SYSTEMEXCEPTIONDEBUG}
|
{$endif SIGNALS_DEBUG}
|
||||||
Exception_handler_installed := true;
|
Exception_handler_installed := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user