Browse Source

* improved CFI

git-svn-id: branches/debug_eh@41356 -
florian 6 years ago
parent
commit
3567d01ee4
2 changed files with 5 additions and 1 deletions
  1. 1 0
      compiler/i386/cgcpu.pas
  2. 4 1
      compiler/x86/cgx86.pas

+ 1 - 0
compiler/i386/cgcpu.pas

@@ -323,6 +323,7 @@ unit cgcpu;
                   internal_restore_regs(list,true);
                   internal_restore_regs(list,true);
                 if (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then
                 if (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then
                   list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG));
                   list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG));
+                current_asmdata.asmcfi.cfa_def_cfa_offset(list,sizeof(pint));
               end
               end
             else
             else
               begin
               begin

+ 4 - 1
compiler/x86/cgx86.pas

@@ -3405,7 +3405,10 @@ unit cgx86;
                 inc(regsize,sizeof(aint));
                 inc(regsize,sizeof(aint));
                 hreg:=newreg(R_INTREGISTER,regs_to_save_int[r],R_SUBWHOLE);
                 hreg:=newreg(R_INTREGISTER,regs_to_save_int[r],R_SUBWHOLE);
                 list.concat(Taicpu.Op_reg(A_PUSH,tcgsize2opsize[OS_ADDR],hreg));
                 list.concat(Taicpu.Op_reg(A_PUSH,tcgsize2opsize[OS_ADDR],hreg));
-                current_asmdata.asmcfi.cfa_offset(list,hreg,-(regsize+localsize));
+                if current_procinfo.framepointer<>NR_STACK_POINTER_REG then
+                  current_asmdata.asmcfi.cfa_offset(list,hreg,-(regsize+sizeof(pint)*2+localsize))
+                else
+                  current_asmdata.asmcfi.cfa_offset(list,hreg,-(regsize+sizeof(pint)+localsize));
               end;
               end;
         end;
         end;