CFI(calling frame info)的作用是出现异常时stack的回滚(unwind)

而回滚的过程是一级级CFA往上回退,直到异常被catch

DWARF4标准section 6.4:

The call frame is identified by an address on the stack. We refer to this address as the Canonical Frame Address orCFA. Typically, the CFA is defined to be the value of the stack pointer at the call site in the previous frame (which may be different from its value on entry to the current frame).

CFA定义为执行call xxxSP(stack pointer)所指向的地址。


 
  1. pushl %ebp

  2. .cfi_def_cfa_offset 8

  3. .cfi_offset 5, -8

表示执行完pushl %ebpSPCFA偏了8字节(4字节return address,4字节ebp


 
  1. movl %esp, %ebp

  2. .cfi_def_cfa_register 5

表示执行完movl %esp, %ebpcfa_register不再是esp,而是ebp


 
  1. leave

  2. .cfi_restore 5

  3. .cfi_def_cfa 4, 4

表示执行完leaveebp的值已经恢复到初始状态,并且CFA的计算方式应该是esp+4

其中寄存器对应的数字是架构相关的,详细参考xxx_map_dwarf_register

  1. i386
  2. x86_64
  3. sparc
  4. arm

参考:

Dwarf2 Exception Handler HOWTO

CFI directives

都是英文版的,可以下载谷歌浏览器,查看时翻译,正确率很高够用。

转自:

https://blog.csdn.net/jtli_embeddedcv/article/details/9321253

最新文章

  1. [LeetCode] Word Pattern 词语模式
  2. asp.net反向代理
  3. $().click(function(){}) 不管用 live()替代品 append之后
  4. Java SE 基础:注释
  5. sql执行顺序
  6. redis安装与基本配置
  7. SAP大数据为"海上F1"提供技术支持
  8. android91 代码注册广播接收者
  9. 如何使代码审查更高效【摘自InfoQ】
  10. crmplugin项目加入key文件
  11. Git详解及 github与gitlab使用
  12. Django 后台定制自己的选择框删除函数
  13. 补充的flask实例化参数以及信号
  14. android 开发 Intent使用技巧点
  15. kooboocms遇到的问题
  16. PHP学习目标
  17. Kivy 中文教程 实例入门 简易画板 (Simple Paint App):0. 项目简介 & 成果展示
  18. Android中创建PopupMenu弹出式菜单
  19. Android keytool 生成keystore与给APK签名
  20. php 批量过滤关键字

热门文章

  1. windows2008r2防火墙设置一例
  2. 1.端口被占用问题:Embedded servlet container failed to start. Port 8097 was already in use.
  3. Linux 环境下 jar 加解密命令?
  4. html br标签 语法
  5. XML 浏览器支持
  6. hdu 1695 欧拉函数+容斥原理
  7. sh_09_打印多条分隔线
  8. Android视频处理 --处理视频第一帧缩略图
  9. (62)通信协议之一protobuf
  10. [CSP-S模拟测试]:括号密码(贪心)