递归栈帧分析
来源:互联网 发布:java实现base64加密 编辑:程序博客网 时间:2024/06/03 20:10
<pre name="code" class="cpp">#include <stdio.h>/** * @source : c++ primer plus * p239 程序清单7.16 recur.cpp */int countdown(int n);int main(){ countdown(4); return 0;}int countdown(int n){ printf("Counting down ... %d\n", n); if(n > 0){ countdown(n-1); } printf("%d : Kaboom! \n", n);}eip : 当前指令地址 ebp : 栈地址======================================================================Stack level 0, frame at 0xbffff2d0:----------------------------------------------------------------------eip = 0x8048406 in countdown (recur.c:11); saved eip 0x804842ecalled by frame at 0xbffff2f0source language c.Arglist at 0xbffff2c8, args: n=0Locals at 0xbffff2c8, Previous frame's sp is 0xbffff2d0Saved registers: ebp at 0xbffff2c8, eip at 0xbffff2cc======================================================================Stack level 1, frame at 0xbffff2f0:----------------------------------------------------------------------eip = 0x804842e in countdown (recur.c:13); saved eip 0x804842ecalled by frame at 0xbffff310, caller of frame at 0xbffff2d0source language c.Arglist at 0xbffff2e8, args: n=1Locals at 0xbffff2e8, Previous frame's sp is 0xbffff2f0Saved registers: ebp at 0xbffff2e8, eip at 0xbffff2ec======================================================================Stack level 2, frame at 0xbffff310:----------------------------------------------------------------------eip = 0x804842e in countdown (recur.c:13); saved eip 0x804842ecalled by frame at 0xbffff330, caller of frame at 0xbffff2f0source language c.Arglist at 0xbffff308, args: n=2Locals at 0xbffff308, Previous frame's sp is 0xbffff310Saved registers: ebp at 0xbffff308, eip at 0xbffff30c======================================================================Stack level 3, frame at 0xbffff330:----------------------------------------------------------------------eip = 0x804842e in countdown (recur.c:13); saved eip 0x804842ecalled by frame at 0xbffff350, caller of frame at 0xbffff310source language c.Arglist at 0xbffff328, args: n=3Locals at 0xbffff328, Previous frame's sp is 0xbffff330Saved registers: ebp at 0xbffff328, eip at 0xbffff32c======================================================================Stack level 4, frame at 0xbffff350:----------------------------------------------------------------------eip = 0x804842e in countdown (recur.c:13); saved eip 0x80483f9called by frame at 0xbffff370, caller of frame at 0xbffff330source language c.Arglist at 0xbffff348, args: n=4Locals at 0xbffff348, Previous frame's sp is 0xbffff350Saved registers: ebp at 0xbffff348, eip at 0xbffff34c======================================================================Stack level 5, frame at 0xbffff370:---------------------------------------------------------------------- eip = 0x80483f9 in main (recur.c:6); saved eip 0xb7e394e3 caller of frame at 0xbffff350 source language c. Arglist at 0xbffff368, args: Locals at 0xbffff368, Previous frame's sp is 0xbffff370 Saved registers: ebp at 0xbffff368, eip at 0xbffff36c======================================================================
参考资料:[1]:<GDB详解> http://www.cnblogs.com/ggjucheng/archive/2011/12/14/2288004.html
[2]:<函数调用之-frame>http://blog.csdn.net/yangzhongxuan/article/details/6910402
[3]:《c++ primer plus》
0 0
- 递归栈帧分析
- 递归分析
- 递归下降分析程序
- 数据结构:递归 算法分析
- 递归下降分析法
- 递归程序分析
- 递归 塔罗牌分析
- 递归算法详细分析
- Java递归分析
- java递归分析
- 递归算法分析-分享
- 递归下降分析子程序
- 递归算法详细分析
- TreeView的递归分析
- 递归算法详细分析
- 尾递归分析
- 递归算法分析
- 分治与递归分析
- 设置了LaunchImage为什么没有显示
- 【CSS】CSS概述
- [数据结构和算法]九宫格算法
- 【CodeVS】1073 家族
- java后台框架 springmvc mybatis(oracle 和 mysql数据库)
- 递归栈帧分析
- 四种常见的 POST 提交数据方式
- 使用js实现“别踩白块儿”游戏
- FFMPEG SDK 快速截取I帧
- 三角形测试用例
- yum---Shell前端软件包管理器
- 新的开始!
- 返回日期相关的
- Android 实时监听网络状态