Adapt TSigContext to structure found by debugging

git-svn-id: trunk@22482 -
This commit is contained in:
pierre 2012-09-27 15:49:13 +00:00
parent 5deddaec8c
commit abef064786

View File

@ -18,38 +18,44 @@
procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);public name '_FPC_DEFAULTSIGHANDLER';cdecl;
var
res : word;
addr : pointer;
addr, framebp : pointer;
begin
res:=0;
addr:=nil;
framebp:=nil;
case sig of
SIGFPE :
begin
addr := siginfo^._sifields._sigfault._addr;
case siginfo^.si_code of
FPE_INTDIV:
res:=200;
FPE_INTOVF:
res:=215;
FPE_FLTDIV:
res:=200;
FPE_FLTOVF:
res:=205;
FPE_FLTUND:
res:=206;
else
res:=207;
end;
if assigned(siginfo) then
begin
addr := siginfo^._sifields._sigfault._addr;
case siginfo^.si_code of
FPE_INTDIV:
res:=200;
FPE_INTOVF:
res:=215;
FPE_FLTDIV:
res:=200;
FPE_FLTOVF:
res:=205;
FPE_FLTUND:
res:=206;
else
res:=207;
end;
end;
end;
SIGBUS :
begin
addr := siginfo^._sifields._sigfault._addr;
if assigned(siginfo) then
addr := siginfo^._sifields._sigfault._addr;
res:=214;
end;
SIGILL,
SIGSEGV :
begin
addr := siginfo^._sifields._sigfault._addr;
if assigned(siginfo) then
addr := siginfo^._sifields._sigfault._addr;
res:=216;
end;
SIGINT:
@ -58,9 +64,16 @@ begin
res:=233;
end;
reenable_signal(sig);
if assigned(sigcontext) then
begin
addr:=pointer(sigcontext^.sigc_pc);
framebp:=pointer(sigcontext^.sigc_gregs[SIG_SP]);
end;
{ give runtime error at the position where the signal was raised }
if res<>0 then
HandleErrorAddrFrame(res,addr,nil);
HandleErrorAddrFrame(res,addr,framebp);
end;