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,12 +18,15 @@
procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);public name '_FPC_DEFAULTSIGHANDLER';cdecl; procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigContext);public name '_FPC_DEFAULTSIGHANDLER';cdecl;
var var
res : word; res : word;
addr : pointer; addr, framebp : pointer;
begin begin
res:=0; res:=0;
addr:=nil; addr:=nil;
framebp:=nil;
case sig of case sig of
SIGFPE : SIGFPE :
begin
if assigned(siginfo) then
begin begin
addr := siginfo^._sifields._sigfault._addr; addr := siginfo^._sifields._sigfault._addr;
case siginfo^.si_code of case siginfo^.si_code of
@ -41,14 +44,17 @@ begin
res:=207; res:=207;
end; end;
end; end;
end;
SIGBUS : SIGBUS :
begin begin
if assigned(siginfo) then
addr := siginfo^._sifields._sigfault._addr; addr := siginfo^._sifields._sigfault._addr;
res:=214; res:=214;
end; end;
SIGILL, SIGILL,
SIGSEGV : SIGSEGV :
begin begin
if assigned(siginfo) then
addr := siginfo^._sifields._sigfault._addr; addr := siginfo^._sifields._sigfault._addr;
res:=216; res:=216;
end; end;
@ -58,9 +64,16 @@ begin
res:=233; res:=233;
end; end;
reenable_signal(sig); 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 } { give runtime error at the position where the signal was raised }
if res<>0 then if res<>0 then
HandleErrorAddrFrame(res,addr,nil); HandleErrorAddrFrame(res,addr,framebp);
end; end;