From 866331de346aef301c74e97e7e7d80a5760452ed Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 3 Mar 2019 17:14:56 +0000 Subject: [PATCH] * fixed CFI registers for leave on x86-64, and place CFI directives closer to the instructions they apply to git-svn-id: branches/debug_eh@41576 - --- compiler/x86/cgx86.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 6e66e1e64a..cb3fc8618c 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -3710,19 +3710,22 @@ unit cgx86; else begin {$if defined(x86_64)} + current_asmdata.asmcfi.cfa_def_cfa_register(list,NR_RSP); list.Concat(taicpu.op_reg_reg(A_MOV,S_Q,NR_RBP,NR_RSP)); + current_asmdata.asmcfi.cfa_restore(list,NR_RBP); + current_asmdata.asmcfi.cfa_def_cfa_offset(list,8); list.Concat(taicpu.op_reg(A_POP,S_Q,NR_RBP)); {$elseif defined(i386)} + current_asmdata.asmcfi.cfa_def_cfa_register(list,NR_ESP); list.Concat(taicpu.op_reg_reg(A_MOV,S_L,NR_EBP,NR_ESP)); + current_asmdata.asmcfi.cfa_restore(list,NR_EBP); + current_asmdata.asmcfi.cfa_def_cfa_offset(list,4); list.Concat(taicpu.op_reg(A_POP,S_L,NR_EBP)); {$elseif defined(i8086)} list.Concat(taicpu.op_reg_reg(A_MOV,S_W,NR_BP,NR_SP)); list.Concat(taicpu.op_reg(A_POP,S_W,NR_BP)); {$endif} end; - current_asmdata.asmcfi.cfa_restore(list,NR_EBP); - current_asmdata.asmcfi.cfa_def_cfa_register(list,NR_ESP); - current_asmdata.asmcfi.cfa_def_cfa_offset(list,sizeof(pint)); end;