博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SystemTap知识(二)
阅读量:7224 次
发布时间:2019-06-29

本文共 2519 字,大约阅读时间需要 8 分钟。

Unbuntu安装systemtap:

1 更新源到

2 apt-get install systemtap

3 apt-get install systemtap-sdt-dev

4

cdcdHOME

$ sudo apt-get install dpkg-dev debhelper gawk

apt-get install ncurses-dev

$ mkdir tmp

$ cd tmp

sudoaptgetbuilddepnoinstallrecommendslinuximagesudoapt−getbuild−dep−−no−install−recommendslinux−image−(uname -r)

aptgetsourcelinuximageapt−getsourcelinux−image−(uname -r)

$ cd linux-2.6.31 (this is currently the kernel version of 9.10)

$ fakeroot debian/rules clean

$ AUTOBUILD=1 fakeroot debian/rules binary-generic skipdbg=false

$ sudo dpkg -i ../linux-image-debug-2.6.31-19-generic_2.6.31-19.56_amd64.ddeb

出现错误:

/usr/share/systemtap/runtime/transport/relay_v2.c:241:2: error: initialization from incompatible pointer type [-Werror]

/usr/share/systemtap/runtime/transport/relay_v2.c:241:2: error: (near initialization for ?._stp_relay_callbacks.create_buf_file?. [-Werror]

In file included from /usr/share/systemtap/runtime/print.c:18:0,

                 from /usr/share/systemtap/runtime/runtime.h:128,

                 from /tmp/stapXuHMle/stap_f534cd5578062befad3b2b49cf30135c_2471.c:59:

/usr/share/systemtap/runtime/transport/transport.c: In function ?.stp_get_root_dir?.

/usr/share/systemtap/runtime/transport/transport.c:386:8: error: ?.truct hlist_head?.has no member named ?.ext?

In file included from /tmp/stapXuHMle/stap_f534cd5578062befad3b2b49cf30135c_2471.c:61:0:

/usr/share/systemtap/runtime/stat.c: In function ?.stp_stat_get?.

/usr/share/systemtap/runtime/stat.c:213:2: error: ?.pu_possible_map?.undeclared (first use in this function)

/usr/share/systemtap/runtime/stat.c:213:2: note: each undeclared identifier is reported only once for each function it appears in

/usr/share/systemtap/runtime/stat.c: In function ?.stp_stat_clear?.

/usr/share/systemtap/runtime/stat.c:248:2: error: ?.pu_possible_map?.undeclared (first use in this function)

cc1: all warnings being treated as errors

解决:

测试是否成功:

stap -e 'probe kernel.function("vfs_read") { printf("%s \n", $$vars)}' -vv

用户域的探针

Systemtap最初是用于内核态的探针的,但是基于用户态的探针能定位解决用户的程序问题。Systemtap0.6能往用户态的进程中放入探针。SystemTap能支持在用户态的进程中的某个方法的入口和出口的地方放入探针。

用户态Systemtap的探针要求安装utrace内核扩展。utrace的介绍在:

使用命令来判断当前系统是否安装了utrace

grep CONFIG_UTRACE /boot/config-`uname -r`

如果支持用户态探针,会输出:

CONFIG_UTRACE=y

用户态Systemtap也需要uprobes内核模块。如果没有安装的话,你在运行需要uprobes模块的时候会出现下面的问题:

用户态的事件

用户态事件以process开始,有下面几种形式

PATH是可执行程序的路径

process("PATH").function("function")

process("PATH").statement("statement")

process("PATH").mark("marker")

process.begin

process.thread.begin

process.end

process.thread.end

process.syscall

转载地址:http://yieym.baihongyu.com/

你可能感兴趣的文章
python面试
查看>>
oracle中去掉回车换行空格的方法详解
查看>>
eval(gzinflate(base64_decode N层,自动解密
查看>>
Apache CXF 2.7.0 的 wsdl2java 生成客户端java类中required 未定义的问题
查看>>
中国大学排名定向爬虫
查看>>
657. Insert Delete GetRandom O(1)
查看>>
Java编程资料
查看>>
duilib 设计界面 初体验(附超链接开发)
查看>>
jvm内存区域
查看>>
IOS--常用控件--UIScrollView
查看>>
能够使开发和调试更为方便的java日志框架
查看>>
冷门Javascript API——element.insertAdjacentHTML
查看>>
绘制希尔伯特曲线
查看>>
LOJ 572 「LibreOJ Round #11」Misaka Network 与求和——min_25筛
查看>>
test
查看>>
[精华][推荐]CAS SSO单点登录服务端客户端实例
查看>>
「hadoop」ssh
查看>>
pulseaudio备注
查看>>
PAT1064 Complete Binary Search Tree (30)(BST)
查看>>
FPGA负数的右移 计算
查看>>