您的位置:首页 > 其它

关于.cfl指令的简单介绍

2014-03-28 19:42 260 查看
Modern ABIs don't require frame pointers to be usedin functions. However missing FPs bring difficulties when doing a backtrace.One solution is to provide Dwarf-2 CFI data for each suchfunction. This can be easily done for example
by GCC in it's output,but isn't that easy to write by hand for pure assembler functions.
With the help of these .cfi_* directivesone can add appropriate unwind info into his asm source without too muchtrouble.
Directives implemented so far:
.cfi_startproc
Use at thebeginning of each function. It initializes some internal data structures andemits initial CFI instructions.
.cfi_endproc
Opens .eh_frame,generates appropriate binary structures (CIE, FDE) and sets up relocationrecords.
.cfi_def_cfa reg,imm
Set a rule forcomputing CFA to: take content of register reg and add imm toit.
.cfi_def_cfa_register reg
Change rule forCFA to use reg. Offset remains the same.
.cfi_def_cfa_offset imm
Change rule forCFA to use offset imm. Register remains the same.
.cfi_adjust_cfa_offset imm
Like the previousone but imm is a relative value that will be added to currentoffset instead of an absolute value as in .cfi_def_cfa_offset.
.cfi_offset reg,imm
Generate a rulesaying that register reg is saved at offset imm fromCFA.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  .cfi x86 gcc 汇编