Replace HandleErrorFrame calls by HandleErrorAddrFrameInd where possible in common code (to allow correct backtrace for mips cpu)

git-svn-id: trunk@21900 -
This commit is contained in:
pierre 2012-07-12 11:53:59 +00:00
parent ca8cc759ac
commit a311c53167
9 changed files with 37 additions and 36 deletions

View File

@ -735,13 +735,13 @@ end;
Procedure fpc_AnsiStr_CheckZero(p : pointer);[Public,Alias : 'FPC_ANSISTR_CHECKZERO']; compilerproc; Procedure fpc_AnsiStr_CheckZero(p : pointer);[Public,Alias : 'FPC_ANSISTR_CHECKZERO']; compilerproc;
begin begin
if p=nil then if p=nil then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
Procedure fpc_AnsiStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK']; compilerproc; Procedure fpc_AnsiStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK']; compilerproc;
begin begin
if (index>len) or (Index<1) then if (index>len) or (Index<1) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
{$else VER2_4} {$else VER2_4}
@ -750,7 +750,7 @@ end;
Procedure fpc_AnsiStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK']; compilerproc; Procedure fpc_AnsiStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK']; compilerproc;
begin begin
if (p=nil) or (index>PAnsiRec(p-AnsiFirstOff)^.Len) or (Index<1) then if (p=nil) or (index>PAnsiRec(p-AnsiFirstOff)^.Len) or (Index<1) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
{$endif FPC_HAS_ANSISTR_CHECKRANGE} {$endif FPC_HAS_ANSISTR_CHECKRANGE}
{$endif VER2_4} {$endif VER2_4}

View File

@ -38,7 +38,7 @@ type
procedure fpc_dynarray_rangecheck(p : pointer;i : tdynarrayindex);[Public,Alias:'FPC_DYNARRAY_RANGECHECK']; compilerproc; procedure fpc_dynarray_rangecheck(p : pointer;i : tdynarrayindex);[Public,Alias:'FPC_DYNARRAY_RANGECHECK']; compilerproc;
begin begin
if not(assigned(p)) or (i<0) or (i>pdynarray(p-sizeof(tdynarray))^.high) then if not(assigned(p)) or (i<0) or (i>pdynarray(p-sizeof(tdynarray))^.high) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
@ -68,7 +68,7 @@ procedure fpc_dynarray_clear(var p : pointer;ti : pointer); [Public,Alias:'FPC_D
exit; exit;
realp:=pdynarray(p-sizeof(tdynarray)); realp:=pdynarray(p-sizeof(tdynarray));
if realp^.refcount=0 then if realp^.refcount=0 then
HandleErrorFrame(204,get_frame); HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
if declocked(realp^.refcount) then if declocked(realp^.refcount) then
begin begin
@ -92,7 +92,7 @@ procedure fpc_dynarray_incr_ref(p : pointer);[Public,Alias:'FPC_DYNARRAY_INCR_RE
realp:=pdynarray(p-sizeof(tdynarray)); realp:=pdynarray(p-sizeof(tdynarray));
if realp^.refcount=0 then if realp^.refcount=0 then
HandleErrorFrame(204,get_frame); HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
inclocked(realp^.refcount); inclocked(realp^.refcount);
end; end;
@ -132,7 +132,7 @@ procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
begin begin
{ negative length is not allowed } { negative length is not allowed }
if dims[0]<0 then if dims[0]<0 then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
{ skip kind and name } { skip kind and name }
ti:=aligntoptr(Pointer(pti)+2+PByte(pti)[1]); ti:=aligntoptr(Pointer(pti)+2+PByte(pti)[1]);
@ -198,7 +198,7 @@ procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
{ the values it was calculated from } { the values it was calculated from }
if (size<sizeof(tdynarray)) or if (size<sizeof(tdynarray)) or
((elesize>0) and (size<elesize)) then ((elesize>0) and (size<elesize)) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
{ resize? } { resize? }
{ here, realp^.refcount has to be one, otherwise the previous } { here, realp^.refcount has to be one, otherwise the previous }

View File

@ -1231,7 +1231,7 @@ end;
(q3 shr 15<>0) and (q3 shr 15<>0) and
((q3<>word(word(1) shl 15)) or not(sign)) ((q3<>word(word(1) shl 15)) or not(sign))
) then ) then
HandleErrorFrame(215,get_frame); HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
if sign then if sign then
fpc_mul_integer:=-q3 fpc_mul_integer:=-q3
@ -1264,7 +1264,7 @@ end;
overflow occurs } overflow occurs }
if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and
((_f1>fpc_mul_word) or (f1>fpc_mul_word)))) then ((_f1>fpc_mul_word) or (f1>fpc_mul_word)))) then
HandleErrorFrame(215,get_frame); HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
end; end;
{ when bootstrapping, we forget about overflow checking for qword :) } { when bootstrapping, we forget about overflow checking for qword :) }
f1overflowed:=f1overflowed or ((f1 and (1 shl 15))<>0); f1overflowed:=f1overflowed or ((f1 and (1 shl 15))<>0);
@ -1307,7 +1307,7 @@ end;
(q3 shr 15<>0) and (q3 shr 15<>0) and
((q3<>dword(dword(1) shl 31)) or not(sign)) ((q3<>dword(dword(1) shl 31)) or not(sign))
) then ) then
HandleErrorFrame(215,get_frame); HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
if sign then if sign then
fpc_mul_longint:=-q3 fpc_mul_longint:=-q3
@ -1343,7 +1343,7 @@ end;
overflow occurs } overflow occurs }
if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and
((_f1>fpc_mul_dword) or (f1>fpc_mul_dword)))) then ((_f1>fpc_mul_dword) or (f1>fpc_mul_dword)))) then
HandleErrorFrame(215,get_frame); HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
end; end;
{ when bootstrapping, we forget about overflow checking for qword :) } { when bootstrapping, we forget about overflow checking for qword :) }
f1overflowed:=f1overflowed or ((f1 and (1 shl 31))<>0); f1overflowed:=f1overflowed or ((f1 and (1 shl 31))<>0);
@ -1383,7 +1383,7 @@ function fpc_div_dword(n,z : dword) : dword; [public,alias: 'FPC_DIV_DWORD']; co
begin begin
result:=0; result:=0;
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
lzz:=count_leading_zeros_32bit(z); lzz:=count_leading_zeros_32bit(z);
lzn:=count_leading_zeros_32bit(n); lzn:=count_leading_zeros_32bit(n);
{ if the denominator contains less zeros { if the denominator contains less zeros
@ -1413,7 +1413,7 @@ function fpc_mod_dword(n,z : dword) : dword; [public,alias: 'FPC_MOD_DWORD']; co
begin begin
result:=0; result:=0;
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
lzz:=count_leading_zeros_32bit(z); lzz:=count_leading_zeros_32bit(z);
lzn:=count_leading_zeros_32bit(n); lzn:=count_leading_zeros_32bit(n);
{ if the denominator contains less zeros { if the denominator contains less zeros
@ -1444,7 +1444,7 @@ function fpc_div_longint(n,z : longint) : longint; [public,alias: 'FPC_DIV_LONGI
d1,d2 : dword; d1,d2 : dword;
begin begin
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
sign:=false; sign:=false;
if z<0 then if z<0 then
begin begin
@ -1477,7 +1477,7 @@ function fpc_mod_longint(n,z : longint) : longint; [public,alias: 'FPC_MOD_LONGI
r,nq,zq : dword; r,nq,zq : dword;
begin begin
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
nq:=abs(n); nq:=abs(n);
if z<0 then if z<0 then

View File

@ -153,7 +153,7 @@
begin begin
fpc_div_qword:=0; fpc_div_qword:=0;
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
lzz:=count_leading_zeros(z); lzz:=count_leading_zeros(z);
lzn:=count_leading_zeros(n); lzn:=count_leading_zeros(n);
{ if the denominator contains less zeros } { if the denominator contains less zeros }
@ -185,7 +185,7 @@
begin begin
fpc_mod_qword:=0; fpc_mod_qword:=0;
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
lzz:=count_leading_zeros(z); lzz:=count_leading_zeros(z);
lzn:=count_leading_zeros(n); lzn:=count_leading_zeros(n);
{ if the denominator contains less zeros } { if the denominator contains less zeros }
@ -218,7 +218,7 @@
begin begin
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
{ can the fpu do the work? } { can the fpu do the work? }
begin begin
sign:=false; sign:=false;
@ -256,7 +256,7 @@
begin begin
if n=0 then if n=0 then
HandleErrorFrame(200,get_frame); HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
if n<0 then if n<0 then
nq:=-n nq:=-n
else else
@ -306,7 +306,7 @@
overflow occurs } overflow occurs }
if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and
((_f1>fpc_mul_qword) or (f1>fpc_mul_qword)))) then ((_f1>fpc_mul_qword) or (f1>fpc_mul_qword)))) then
HandleErrorFrame(215,get_frame); HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
end; end;
{ when bootstrapping, we forget about overflow checking for qword :) } { when bootstrapping, we forget about overflow checking for qword :) }
f1overflowed:=f1overflowed or ((f1 and (1 shl 63))<>0); f1overflowed:=f1overflowed or ((f1 and (1 shl 63))<>0);
@ -351,7 +351,7 @@
(q3 shr 63<>0) and (q3 shr 63<>0) and
((q3<>qword(qword(1) shl 63)) or not(sign)) ((q3<>qword(qword(1) shl 63)) or not(sign))
) then ) then
HandleErrorFrame(215,get_frame); HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
if sign then if sign then
fpc_mul_int64:=-q3 fpc_mul_int64:=-q3

View File

@ -16,7 +16,8 @@
{$ifdef FPC_HAS_FEATURE_VARIANTS} {$ifdef FPC_HAS_FEATURE_VARIANTS}
procedure DoDispCallByIDError(res : Pointer; const disp : IDispatch;desc : PDispDesc; params : Pointer); procedure DoDispCallByIDError(res : Pointer; const disp : IDispatch;desc : PDispDesc; params : Pointer);
begin begin
handleerrorframe(RuntimeErrorExitCodes[reVarDispatch],get_frame); handleerroraddrframeind(RuntimeErrorExitCodes[reVarDispatch],
get_pc_addr,get_frame);
end; end;
@ -46,7 +47,7 @@
function fpc_do_as(aclass : tclass;aobject : tobject): tobject;[public,alias: 'FPC_DO_AS']; compilerproc; function fpc_do_as(aclass : tclass;aobject : tobject): tobject;[public,alias: 'FPC_DO_AS']; compilerproc;
begin begin
if assigned(aobject) and not(aobject.inheritsfrom(aclass)) then if assigned(aobject) and not(aobject.inheritsfrom(aclass)) then
handleerrorframe(219,get_frame); handleerroraddrframeInd(219,get_pc_addr,get_frame);
result := aobject; result := aobject;
end; end;

View File

@ -949,7 +949,7 @@ Begin
Writeln(pstdout^,'Runtime error ',Errorcode,' at $',hexstr(erroraddr)); Writeln(pstdout^,'Runtime error ',Errorcode,' at $',hexstr(erroraddr));
{ to get a nice symify } { to get a nice symify }
Writeln(pstdout^,BackTraceStrFunc(Erroraddr)); Writeln(pstdout^,BackTraceStrFunc(Erroraddr));
dump_stack(pstdout^,ErrorBase); dump_stack(pstdout^,ErrorBase,ErrorAddr);
Writeln(pstdout^,''); Writeln(pstdout^,'');
End; End;
SysFlushStdIO; SysFlushStdIO;

View File

@ -167,7 +167,7 @@ end;
procedure UnicodeStringError; procedure UnicodeStringError;
begin begin
HandleErrorFrame(204,get_frame); HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
end; end;
@ -924,13 +924,13 @@ end;
Procedure fpc_UnicodeStr_CheckZero(p : pointer);[Public,Alias : 'FPC_UNICODESTR_CHECKZERO']; compilerproc; Procedure fpc_UnicodeStr_CheckZero(p : pointer);[Public,Alias : 'FPC_UNICODESTR_CHECKZERO']; compilerproc;
begin begin
if p=nil then if p=nil then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
Procedure fpc_UnicodeStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc; Procedure fpc_UnicodeStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
begin begin
if (index>len) or (Index<1) then if (index>len) or (Index<1) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
{$else VER2_4} {$else VER2_4}
@ -939,7 +939,7 @@ end;
Procedure fpc_UnicodeStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc; Procedure fpc_UnicodeStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
begin begin
if (p=nil) or (index>PUnicodeRec(p-UnicodeFirstOff)^.len) or (Index<1) then if (p=nil) or (index>PUnicodeRec(p-UnicodeFirstOff)^.len) or (Index<1) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
{$endif FPC_HAS_UNICODESTR_RANGECHECK} {$endif FPC_HAS_UNICODESTR_RANGECHECK}
{$endif VER2_4} {$endif VER2_4}
@ -2155,7 +2155,7 @@ procedure unimplementedunicodestring;
Writeln(StdErr,SRecompileWithUnicodestrings); Writeln(StdErr,SRecompileWithUnicodestrings);
end; end;
{$endif FPC_HAS_FEATURE_CONSOLEIO} {$endif FPC_HAS_FEATURE_CONSOLEIO}
HandleErrorFrame(233,get_frame); HandleErrorAddrFrameInd(233,get_pc_addr,get_frame);
end; end;

View File

@ -70,7 +70,7 @@ end;
procedure WideStringError; procedure WideStringError;
begin begin
HandleErrorFrame(204,get_frame); HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
end; end;
@ -486,20 +486,20 @@ end;
Procedure fpc_WideStr_CheckZero(p : pointer);[Public,Alias : 'FPC_WIDESTR_CHECKZERO']; compilerproc; Procedure fpc_WideStr_CheckZero(p : pointer);[Public,Alias : 'FPC_WIDESTR_CHECKZERO']; compilerproc;
begin begin
if p=nil then if p=nil then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
Procedure fpc_WideStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; compilerproc; Procedure fpc_WideStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; compilerproc;
begin begin
if (index>len div 2) or (Index<1) then if (index>len div 2) or (Index<1) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
{$else VER2_4} {$else VER2_4}
Procedure fpc_WideStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; compilerproc; Procedure fpc_WideStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; compilerproc;
begin begin
if (p=nil) or (index>PWideRec(p-WideFirstOff)^.len div 2) or (Index<1) then if (p=nil) or (index>PWideRec(p-WideFirstOff)^.len div 2) or (Index<1) then
HandleErrorFrame(201,get_frame); HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
end; end;
{$endif VER2_4} {$endif VER2_4}
@ -975,7 +975,7 @@ procedure unimplementedwidestring;
Writeln(StdErr,SRecompileWithWidestrings); Writeln(StdErr,SRecompileWithWidestrings);
end; end;
{$endif FPC_HAS_FEATURE_CONSOLEIO} {$endif FPC_HAS_FEATURE_CONSOLEIO}
HandleErrorFrame(233,get_frame); HandleErrorAddrFrameInd(233,get_pc_addr,get_frame);
end; end;
{$warnings off} {$warnings off}

View File

@ -62,7 +62,7 @@ begin
begin begin
if assigned(UContext) then if assigned(UContext) then
begin begin
frame:=pointer(ptruint(UContext^.uc_mcontext.sigc_regs[29])); { stack pointer } frame:=pointer(ptruint(UContext^.uc_mcontext.sigc_regs[30])); { base pointer }
addr:=pointer(ptruint(UContext^.uc_mcontext.sigc_pc)); { program counter } addr:=pointer(ptruint(UContext^.uc_mcontext.sigc_pc)); { program counter }
if sig=SIGFPE then if sig=SIGFPE then
begin begin