mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 11:48:34 +02:00
* fixed extracting stack pointer and program counter from
signal context git-svn-id: trunk@5650 -
This commit is contained in:
parent
df03c25daf
commit
5b9a51eaa8
@ -15,6 +15,12 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
const
|
||||
REG_PC = 1;
|
||||
REG_nPC = 2;
|
||||
REG_O6 = 17;
|
||||
REG_SP = REG_O6;
|
||||
|
||||
const
|
||||
FPE_INTDIV = 1;
|
||||
FPE_INTOVF = 2;
|
||||
@ -30,13 +36,22 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
|
||||
var
|
||||
res : word;
|
||||
addr : pointer;
|
||||
frame : pointer;
|
||||
begin
|
||||
res:=0;
|
||||
addr:=nil;
|
||||
if assigned(sigcontext) then
|
||||
begin
|
||||
addr := pointer(sigcontext^.uc_mcontext.gregs[REG_PC]);
|
||||
frame := pointer(sigcontext^.uc_mcontext.gregs[REG_SP])
|
||||
end
|
||||
else
|
||||
begin
|
||||
addr := nil;
|
||||
frame := nil;
|
||||
end;
|
||||
case sig of
|
||||
SIGFPE :
|
||||
begin
|
||||
addr := siginfo^._sifields._sigfault._addr;
|
||||
res := 207;
|
||||
case siginfo^.si_code of
|
||||
FPE_INTDIV:
|
||||
@ -60,19 +75,17 @@ begin
|
||||
SIGILL,
|
||||
SIGSEGV :
|
||||
begin
|
||||
addr := siginfo^._sifields._sigfault._addr;
|
||||
res:=216;
|
||||
end;
|
||||
SIGBUS :
|
||||
begin
|
||||
addr := siginfo^._sifields._sigfault._addr;
|
||||
res:=214;
|
||||
end;
|
||||
end;
|
||||
reenable_signal(sig);
|
||||
{ give runtime error at the position where the signal was raised }
|
||||
if res<>0 then
|
||||
HandleErrorAddrFrame(res,addr,nil);
|
||||
HandleErrorAddrFrame(res,addr,frame);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -16,9 +16,83 @@
|
||||
|
||||
{$packrecords C}
|
||||
|
||||
{ sparc v8 definition }
|
||||
|
||||
const
|
||||
SPARC_MAXREGWINDOW = 31;
|
||||
_NGREG = 19;
|
||||
|
||||
type
|
||||
PSigContext = ^TSigContext;
|
||||
TSigContext = record
|
||||
{$ifdef cpu64}
|
||||
TGReg = clong;
|
||||
{$else}
|
||||
TGReg = cint;
|
||||
{$endif}
|
||||
|
||||
TGRegSet = array[0.._NGREG-1] of TGReg;
|
||||
|
||||
PSPBuf = ^TSPBuf;
|
||||
TSPBuf = array[0..SPARC_MAXREGWINDOW-1] of TGReg;
|
||||
|
||||
TRWindow = record
|
||||
rw_local : array[0..7] of TGReg;
|
||||
rw_in : array[0..7] of TGReg;
|
||||
end;
|
||||
|
||||
PGWindows = ^TGWindows;
|
||||
TGWindows = record
|
||||
wbcnt : cint;
|
||||
spbuf : PSPBuf;
|
||||
rwindow : array[0..SPARC_MAXREGWINDOW-1] of TRWindow;
|
||||
end;
|
||||
|
||||
TFPURegs = record
|
||||
case longint of
|
||||
0: ( fpuregs: array[0..31] of cardinal);
|
||||
1: ( fpudregs: array[0..15] of double);
|
||||
end;
|
||||
|
||||
PFQ = ^TFQ;
|
||||
TFQ = record
|
||||
fpq_addr : ^cuint;
|
||||
fpq_instr : cuint;
|
||||
end;
|
||||
|
||||
TFPU = record
|
||||
fpu_fr : TFPURegs;
|
||||
fq: PFQ;
|
||||
fpu_fsr: cardinal;
|
||||
fpu_qcnt : byte;
|
||||
fpu_q_entrysize : byte;
|
||||
fpu_e : byte;
|
||||
end;
|
||||
TFPRegSet = TFPU;
|
||||
|
||||
TXRS = record
|
||||
xrs_id : cuint;
|
||||
xrs_ptr : pointer;
|
||||
end;
|
||||
|
||||
TMContext = record
|
||||
gregs : TGRegSet;
|
||||
gwins : PGWindows;
|
||||
fpregs : TFPRegSet;
|
||||
xrs : TXRS;
|
||||
__filler : array[0..19-1] of clong;
|
||||
end;
|
||||
|
||||
TStack = record
|
||||
ss_sp : pointer;
|
||||
ss_size : size_t;
|
||||
ss_flags : cint;
|
||||
end;
|
||||
|
||||
PSigContext = ^TSigContext;
|
||||
TSigContext = record
|
||||
uc_flags : cuint;
|
||||
uc_link : PSigContext;
|
||||
uc_sigmask : sigset_t;
|
||||
uc_stack : TStack;
|
||||
uc_mcontext : TMContext;
|
||||
__uc_filler : array[0..23-1] of clong;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user