mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 07:43:04 +01:00 
			
		
		
		
	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:
		
							parent
							
								
									ca8cc759ac
								
							
						
					
					
						commit
						a311c53167
					
				@ -735,13 +735,13 @@ end;
 | 
			
		||||
Procedure fpc_AnsiStr_CheckZero(p : pointer);[Public,Alias : 'FPC_ANSISTR_CHECKZERO'];  compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  if p=nil then
 | 
			
		||||
    HandleErrorFrame(201,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
Procedure fpc_AnsiStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK'];  compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  if (index>len) or (Index<1) then
 | 
			
		||||
    HandleErrorFrame(201,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
{$else VER2_4}
 | 
			
		||||
@ -750,7 +750,7 @@ end;
 | 
			
		||||
Procedure fpc_AnsiStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_ANSISTR_RANGECHECK'];  compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  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;
 | 
			
		||||
{$endif FPC_HAS_ANSISTR_CHECKRANGE}
 | 
			
		||||
{$endif VER2_4}
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,7 @@ type
 | 
			
		||||
procedure fpc_dynarray_rangecheck(p : pointer;i : tdynarrayindex);[Public,Alias:'FPC_DYNARRAY_RANGECHECK']; compilerproc;
 | 
			
		||||
  begin
 | 
			
		||||
     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;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -68,7 +68,7 @@ procedure fpc_dynarray_clear(var p : pointer;ti : pointer); [Public,Alias:'FPC_D
 | 
			
		||||
      exit;
 | 
			
		||||
    realp:=pdynarray(p-sizeof(tdynarray));
 | 
			
		||||
    if realp^.refcount=0 then
 | 
			
		||||
      HandleErrorFrame(204,get_frame);
 | 
			
		||||
      HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
 | 
			
		||||
 | 
			
		||||
    if declocked(realp^.refcount) then
 | 
			
		||||
      begin
 | 
			
		||||
@ -92,7 +92,7 @@ procedure fpc_dynarray_incr_ref(p : pointer);[Public,Alias:'FPC_DYNARRAY_INCR_RE
 | 
			
		||||
 | 
			
		||||
     realp:=pdynarray(p-sizeof(tdynarray));
 | 
			
		||||
     if realp^.refcount=0 then
 | 
			
		||||
       HandleErrorFrame(204,get_frame);
 | 
			
		||||
       HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
 | 
			
		||||
 | 
			
		||||
     inclocked(realp^.refcount);
 | 
			
		||||
  end;
 | 
			
		||||
@ -132,7 +132,7 @@ procedure fpc_dynarray_setlength(var p : pointer;pti : pointer;
 | 
			
		||||
  begin
 | 
			
		||||
     { negative length is not allowed }
 | 
			
		||||
     if dims[0]<0 then
 | 
			
		||||
       HandleErrorFrame(201,get_frame);
 | 
			
		||||
       HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
 | 
			
		||||
     { skip kind and name }
 | 
			
		||||
     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      }
 | 
			
		||||
               if (size<sizeof(tdynarray)) or
 | 
			
		||||
                 ((elesize>0) and (size<elesize)) then
 | 
			
		||||
                 HandleErrorFrame(201,get_frame);
 | 
			
		||||
                 HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
 | 
			
		||||
               { resize? }
 | 
			
		||||
               { here, realp^.refcount has to be one, otherwise the previous }
 | 
			
		||||
 | 
			
		||||
@ -1231,7 +1231,7 @@ end;
 | 
			
		||||
             (q3 shr 15<>0) and
 | 
			
		||||
              ((q3<>word(word(1) shl 15)) or not(sign))
 | 
			
		||||
             ) then
 | 
			
		||||
             HandleErrorFrame(215,get_frame);
 | 
			
		||||
             HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
 | 
			
		||||
 | 
			
		||||
           if sign then
 | 
			
		||||
             fpc_mul_integer:=-q3
 | 
			
		||||
@ -1264,7 +1264,7 @@ end;
 | 
			
		||||
                  overflow occurs                                      }
 | 
			
		||||
                if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and
 | 
			
		||||
                  ((_f1>fpc_mul_word) or (f1>fpc_mul_word)))) then
 | 
			
		||||
                  HandleErrorFrame(215,get_frame);
 | 
			
		||||
                  HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
 | 
			
		||||
              end;
 | 
			
		||||
            { when bootstrapping, we forget about overflow checking for qword :) }
 | 
			
		||||
            f1overflowed:=f1overflowed or ((f1 and (1 shl 15))<>0);
 | 
			
		||||
@ -1307,7 +1307,7 @@ end;
 | 
			
		||||
             (q3 shr 15<>0) and
 | 
			
		||||
              ((q3<>dword(dword(1) shl 31)) or not(sign))
 | 
			
		||||
             ) then
 | 
			
		||||
             HandleErrorFrame(215,get_frame);
 | 
			
		||||
             HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
 | 
			
		||||
 | 
			
		||||
           if sign then
 | 
			
		||||
             fpc_mul_longint:=-q3
 | 
			
		||||
@ -1343,7 +1343,7 @@ end;
 | 
			
		||||
                  overflow occurs                                      }
 | 
			
		||||
                if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and
 | 
			
		||||
                  ((_f1>fpc_mul_dword) or (f1>fpc_mul_dword)))) then
 | 
			
		||||
                  HandleErrorFrame(215,get_frame);
 | 
			
		||||
                  HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
 | 
			
		||||
              end;
 | 
			
		||||
            { when bootstrapping, we forget about overflow checking for qword :) }
 | 
			
		||||
            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
 | 
			
		||||
     result:=0;
 | 
			
		||||
     if n=0 then
 | 
			
		||||
       HandleErrorFrame(200,get_frame);
 | 
			
		||||
       HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
     lzz:=count_leading_zeros_32bit(z);
 | 
			
		||||
     lzn:=count_leading_zeros_32bit(n);
 | 
			
		||||
     { 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
 | 
			
		||||
    result:=0;
 | 
			
		||||
    if n=0 then
 | 
			
		||||
      HandleErrorFrame(200,get_frame);
 | 
			
		||||
      HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
    lzz:=count_leading_zeros_32bit(z);
 | 
			
		||||
    lzn:=count_leading_zeros_32bit(n);
 | 
			
		||||
    { 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;
 | 
			
		||||
  begin
 | 
			
		||||
     if n=0 then
 | 
			
		||||
       HandleErrorFrame(200,get_frame);
 | 
			
		||||
       HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
     sign:=false;
 | 
			
		||||
     if z<0 then
 | 
			
		||||
       begin
 | 
			
		||||
@ -1477,7 +1477,7 @@ function fpc_mod_longint(n,z : longint) : longint; [public,alias: 'FPC_MOD_LONGI
 | 
			
		||||
     r,nq,zq : dword;
 | 
			
		||||
  begin
 | 
			
		||||
     if n=0 then
 | 
			
		||||
       HandleErrorFrame(200,get_frame);
 | 
			
		||||
       HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
     nq:=abs(n);
 | 
			
		||||
 | 
			
		||||
     if z<0 then
 | 
			
		||||
 | 
			
		||||
@ -153,7 +153,7 @@
 | 
			
		||||
      begin
 | 
			
		||||
         fpc_div_qword:=0;
 | 
			
		||||
         if n=0 then
 | 
			
		||||
           HandleErrorFrame(200,get_frame);
 | 
			
		||||
           HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
         lzz:=count_leading_zeros(z);
 | 
			
		||||
         lzn:=count_leading_zeros(n);
 | 
			
		||||
         { if the denominator contains less zeros }
 | 
			
		||||
@ -185,7 +185,7 @@
 | 
			
		||||
      begin
 | 
			
		||||
         fpc_mod_qword:=0;
 | 
			
		||||
         if n=0 then
 | 
			
		||||
           HandleErrorFrame(200,get_frame);
 | 
			
		||||
           HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
         lzz:=count_leading_zeros(z);
 | 
			
		||||
         lzn:=count_leading_zeros(n);
 | 
			
		||||
         { if the denominator contains less zeros }
 | 
			
		||||
@ -218,7 +218,7 @@
 | 
			
		||||
 | 
			
		||||
      begin
 | 
			
		||||
         if n=0 then
 | 
			
		||||
           HandleErrorFrame(200,get_frame);
 | 
			
		||||
           HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
         { can the fpu do the work? }
 | 
			
		||||
           begin
 | 
			
		||||
              sign:=false;
 | 
			
		||||
@ -256,7 +256,7 @@
 | 
			
		||||
 | 
			
		||||
      begin
 | 
			
		||||
         if n=0 then
 | 
			
		||||
           HandleErrorFrame(200,get_frame);
 | 
			
		||||
           HandleErrorAddrFrameInd(200,get_pc_addr,get_frame);
 | 
			
		||||
         if n<0 then
 | 
			
		||||
           nq:=-n
 | 
			
		||||
         else
 | 
			
		||||
@ -306,7 +306,7 @@
 | 
			
		||||
                  overflow occurs                                      }
 | 
			
		||||
                if checkoverflow and (f1overflowed or ((_f1<>0) and (f1<>0) and
 | 
			
		||||
                  ((_f1>fpc_mul_qword) or (f1>fpc_mul_qword)))) then
 | 
			
		||||
                  HandleErrorFrame(215,get_frame);
 | 
			
		||||
                  HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
 | 
			
		||||
              end;
 | 
			
		||||
            { when bootstrapping, we forget about overflow checking for qword :) }
 | 
			
		||||
            f1overflowed:=f1overflowed or ((f1 and (1 shl 63))<>0);
 | 
			
		||||
@ -351,7 +351,7 @@
 | 
			
		||||
                (q3 shr 63<>0) and
 | 
			
		||||
                 ((q3<>qword(qword(1) shl 63)) or not(sign))
 | 
			
		||||
                ) then
 | 
			
		||||
                HandleErrorFrame(215,get_frame);
 | 
			
		||||
                HandleErrorAddrFrameInd(215,get_pc_addr,get_frame);
 | 
			
		||||
 | 
			
		||||
              if sign then
 | 
			
		||||
                fpc_mul_int64:=-q3
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,8 @@
 | 
			
		||||
{$ifdef FPC_HAS_FEATURE_VARIANTS}
 | 
			
		||||
    procedure DoDispCallByIDError(res : Pointer; const disp : IDispatch;desc : PDispDesc; params : Pointer);
 | 
			
		||||
      begin
 | 
			
		||||
        handleerrorframe(RuntimeErrorExitCodes[reVarDispatch],get_frame);
 | 
			
		||||
        handleerroraddrframeind(RuntimeErrorExitCodes[reVarDispatch],
 | 
			
		||||
          get_pc_addr,get_frame);
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -46,7 +47,7 @@
 | 
			
		||||
    function fpc_do_as(aclass : tclass;aobject : tobject): tobject;[public,alias: 'FPC_DO_AS']; compilerproc;
 | 
			
		||||
      begin
 | 
			
		||||
         if assigned(aobject) and not(aobject.inheritsfrom(aclass)) then
 | 
			
		||||
           handleerrorframe(219,get_frame);
 | 
			
		||||
           handleerroraddrframeInd(219,get_pc_addr,get_frame);
 | 
			
		||||
         result := aobject;
 | 
			
		||||
      end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -949,7 +949,7 @@ Begin
 | 
			
		||||
     Writeln(pstdout^,'Runtime error ',Errorcode,' at $',hexstr(erroraddr));
 | 
			
		||||
     { to get a nice symify }
 | 
			
		||||
     Writeln(pstdout^,BackTraceStrFunc(Erroraddr));
 | 
			
		||||
     dump_stack(pstdout^,ErrorBase);
 | 
			
		||||
     dump_stack(pstdout^,ErrorBase,ErrorAddr);
 | 
			
		||||
     Writeln(pstdout^,'');
 | 
			
		||||
   End;
 | 
			
		||||
  SysFlushStdIO;
 | 
			
		||||
 | 
			
		||||
@ -167,7 +167,7 @@ end;
 | 
			
		||||
 | 
			
		||||
procedure UnicodeStringError;
 | 
			
		||||
  begin
 | 
			
		||||
    HandleErrorFrame(204,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -924,13 +924,13 @@ end;
 | 
			
		||||
Procedure fpc_UnicodeStr_CheckZero(p : pointer);[Public,Alias : 'FPC_UNICODESTR_CHECKZERO']; compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  if p=nil then
 | 
			
		||||
    HandleErrorFrame(201,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
Procedure fpc_UnicodeStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  if (index>len) or (Index<1) then
 | 
			
		||||
    HandleErrorFrame(201,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
{$else VER2_4}
 | 
			
		||||
@ -939,7 +939,7 @@ end;
 | 
			
		||||
Procedure fpc_UnicodeStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_UNICODESTR_RANGECHECK']; compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  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;
 | 
			
		||||
{$endif FPC_HAS_UNICODESTR_RANGECHECK}
 | 
			
		||||
{$endif VER2_4}
 | 
			
		||||
@ -2155,7 +2155,7 @@ procedure unimplementedunicodestring;
 | 
			
		||||
      Writeln(StdErr,SRecompileWithUnicodestrings);
 | 
			
		||||
      end;
 | 
			
		||||
{$endif FPC_HAS_FEATURE_CONSOLEIO}
 | 
			
		||||
    HandleErrorFrame(233,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(233,get_pc_addr,get_frame);
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -70,7 +70,7 @@ end;
 | 
			
		||||
 | 
			
		||||
procedure WideStringError;
 | 
			
		||||
  begin
 | 
			
		||||
    HandleErrorFrame(204,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(204,get_pc_addr,get_frame);
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -486,20 +486,20 @@ end;
 | 
			
		||||
Procedure fpc_WideStr_CheckZero(p : pointer);[Public,Alias : 'FPC_WIDESTR_CHECKZERO']; compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  if p=nil then
 | 
			
		||||
    HandleErrorFrame(201,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
Procedure fpc_WideStr_CheckRange(len,index : SizeInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  if (index>len div 2) or (Index<1) then
 | 
			
		||||
    HandleErrorFrame(201,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(201,get_pc_addr,get_frame);
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
{$else VER2_4}
 | 
			
		||||
Procedure fpc_WideStr_CheckRange(p: Pointer; index: SizeInt);[Public,Alias : 'FPC_WIDESTR_RANGECHECK']; compilerproc;
 | 
			
		||||
begin
 | 
			
		||||
  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;
 | 
			
		||||
{$endif VER2_4}
 | 
			
		||||
 | 
			
		||||
@ -975,7 +975,7 @@ procedure unimplementedwidestring;
 | 
			
		||||
      Writeln(StdErr,SRecompileWithWidestrings);
 | 
			
		||||
      end;
 | 
			
		||||
{$endif FPC_HAS_FEATURE_CONSOLEIO}
 | 
			
		||||
    HandleErrorFrame(233,get_frame);
 | 
			
		||||
    HandleErrorAddrFrameInd(233,get_pc_addr,get_frame);
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
{$warnings off}
 | 
			
		||||
 | 
			
		||||
@ -62,7 +62,7 @@ begin
 | 
			
		||||
    begin
 | 
			
		||||
      if assigned(UContext) then
 | 
			
		||||
        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 }
 | 
			
		||||
          if sig=SIGFPE then
 | 
			
		||||
            begin
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user