systemtap 用户态调试
2015-09-16 20:03
543 查看
#include <stdio.h> int main( void) { int a=0; a=fun(1115,20); printf("%d\n",a); } int fun(int a,int b) { return a+b; }
test.c
gcc -g test.c
生成 a.out
----------------------------------
用SecureCRT 创建两个会话到 redhat 5.3,我已经升极内核到3.5,支持用户态调试
session 1
1.执行 stap -L 'process("./a.out").function("*")'
process("/root/a.out").function("fun@/root/test.c:11") $a:int $b:int
process("/root/a.out").function("main@/root/test.c:3") $a:int
得到以上两行结果,现在我要跟踪fun函数的值,有两个符号变量,$a,$b ,并且为整型
2.执行 stap -e 'probe process("a.out").function("fun"){printf("0x%x 0x%x\n",$a,$b )}'
3.session 2 中执行 [root@localhost ~]# ./a.out
4.观察会话2控制台中 会显示结果 0x45b 0x14
相关文章推荐
- freebsd 禁用root登录ssh并给普通用户登录权限
- AWK 简明教程
- (新手向)幻想战境DEMO(一)
- ubuntu -locate 和 find:两个查找文件的命令
- C/C++从入门到精通(入门、进阶、精通)
- MyBatis学习总结(二)使用MyBatis对表执行CRUD操作
- 各种排序算法
- Win7 系统下给 Users 组用户安装字体的权限
- PX4(PIXHAWK)源码开发人员文档(二)——Hello Sky(续)
- STL——heap堆
- 利用SolrJ操作solr API完成index操作
- 机器学习算法
- iOS现成的引导页面的实现:纯代码
- View中的draw和onDraw,dispatchDraw的区别
- 弹框
- TCP 的那些事儿(下)
- 前端性能优化(六)
- 2015区域赛长春网络赛 Elven Postman
- 三元运算符
- Machine learning (1)线性回归