博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ubuntu 11.10 安装systemtap
阅读量:7172 次
发布时间:2019-06-29

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

hot3.png

 转载:

1.  从源安装systemtap

$ sudo apt-get install systemtap

2. 由于ubuntu 桌面版默认没有安装kernel-debug-info,所以安装了systemtap后仍然不能够追踪内核信息,因此需要手动安装kernel-debug-info包。

 (1)查看当前内核版本

$ uname -ar(2)下载对应内核版本的debug-info package

 
 这里下载

3. 安装linux-image-3.0.0-15-generic-dbgsym_3.0.0-15.24_i386.ddeb

$sudo dpkg -i linux-image-3.0.0-15-generic-dbgsym_3.0.0-15.24_i386.ddeb

经过以上安装配置后,就可以跟踪监控内核信息了,但是现在还不能跟踪linux内核模块的信息,因为,systemtap对linux内核模块的跟踪是通过libelf库来查找
/usr/lib/debug目录下以.ko.dedug结尾的模块,但是linux发行版通常将linux模块的扩展名修改为.ko。

4. 安装elfutils并进行相应配置

$sudo apt-get install 
elfutils
  1. for file in `find /usr/lib/debug-name'*.ko' -print`
  2.     do
  3.     buildid=`eu-readelf-n $file| grep Build.ID:| awk '{print $3}'`
  4.     dir=`echo $buildid| cut-c1-2`
  5.     fn=`echo $buildid| cut-c3-`
  6.     rm -fr /usr/lib/debug/.build-id
  7.     mkdir -p/usr/lib/debug/.build-id/$dir
  8.     ln -s $file/usr/lib/debug/.build-id/$dir/$fn
  9.     ln -s $file/usr/lib/debug/.build-id/$dir/${
    fn}.debug
  10.     done

5. 写个例子测试下

$sudo stap -ve 'probe begin { log("hello world") exit() }'

如果能够打印出hello world,说明安装配置成功!

[cpp] 
  1. <pre name="code" class="css"><pre name="code" class="cpp"><pre name="code" class="css"><pre></pre>  
  2. <pre></pre>  
  3. <pre></pre>  
  4. <pre></pre>  
  5. <pre></pre>  
  6. <pre></pre>  
  7. <pre></pre>  
  8. <pre></pre>  
  9. <pre></pre>  
  10. <pre></pre>  
  11. <pre></pre>  
  12. <pre></pre>  
  13. <pre></pre>  
  14. <pre></pre>  
  15. <pre></pre>  
  16. <pre></pre>  
  17. <pre></pre>  
  18. <pre></pre>  
  19. <pre></pre>  
  20. <pre></pre>  
  21. <pre></pre>  
  22. <pre></pre>  
  23. <pre></pre>  
  24. <pre></pre>  
  25. <pre></pre>  
  26. <pre></pre>  
  27. <pre></pre>  
  28. <pre></pre>  
  29. <pre></pre>  
  30. <pre></pre>  
  31. <pre></pre>  
  32. <pre></pre>  
  33. <pre></pre>  
  34. <pre></pre>  
  35. <pre></pre>  
  36. <pre></pre>  
  37.   
  38. </pre></pre></pre>  

转载于:https://my.oschina.net/lcxidian/blog/178664

你可能感兴趣的文章
centos7格式化大于2T的硬盘
查看>>
为什么要进行项目总结呢?又如何进行项目总结呢?
查看>>
iOS——重写Cell分割线
查看>>
window与linux下,php的redis扩展安装
查看>>
VirtualBox虚拟机网络设置
查看>>
Mongodb 之 安全权限控制
查看>>
httpclient发送网络请求
查看>>
可自动切换登录不同系统测试实例
查看>>
jQuery Validate
查看>>
Building IKEv1 and IKEv2 on CentOS 7
查看>>
Zabbix server is not running:zabbix access denied
查看>>
我的友情链接
查看>>
linux下的软硬链接
查看>>
【JAVA的 IO流之FileInputStream和FileOutputStream】
查看>>
远程连接mysql 授权方法详解
查看>>
FreeBSD网络配置
查看>>
@synthesize window=_window; 的理解
查看>>
Greenlet理解要点
查看>>
罗森伯格应邀主讲CDCC百家大讲堂38期
查看>>
How to Install Nextcloud 13 Server on Debian 9
查看>>