ubuntu 11.04下安装systemtap

本文详细介绍了如何在Ubuntu系统上安装并配置SystemTap进行Linux内核调试,包括下载并编译Linux内核源码、安装依赖库、配置内核编译选项等步骤,并提供了几个简单的示例来验证SystemTap的安装与使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    1.首先安装systemtap:

    sudo apt-get install systemtap


    2.安装linux kernel的debug info

    可以到http://ddebs.ubuntu.com/pool/main/l/linux/下载与kernel版本一致的debug info包,可以参照http://blog.youkuaiyun.com/ustc_dylan/article/details/7079876来进行。

    我这里用另外一种方法,就是重新编译kernel。过程如下:

    (1)apt-get install linux-source-2.6.38   下载内核源码

    (2)进入源码目录:

    cd /usr/src/

    解压源码包:

    bzip2 -d linux-source-2.6.38.tar.bz2

    tar xvf linux-source-2.6.38.tar

    (3)进入源码目录,执行make menuconfig

/usr/src/linux-source-2.6.38/linux-source-2.6.38# make menuconfig
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 ***
 *** Install ncurses (ncurses-devel) and try again.
 ***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1

    这是由于libncurses5-dev包没有安装,执行以下命令:

    apt-get install libncurses5-dev


    再尝试make menuconfig,将以下编译选项选中(默认都是选中的)

Kernel hacking
    Kernel debugging
    Compile the kernel with debug info

General setup
    Kprobes

    执行make;make modules_install;make install

    执行cp vmlinux /lib/modules/2.6.38/2.6.38-prep (从一个教程上看来的,但是觉得没有必要这么做)

    重启系统。


    (4)安装elfutils

    sudo apt-get install elfutils


    (5)执行以下命令,有正确的返回值说明systemtap安装成功

#stap -ve ’probe begin { log("hello world") exit () }’
#stap -c df -e ’probe syscall.open { if (target()==pid()) log(name." ".argstr) }’


参考:

http://blog.chinaunix.net/space.php?uid=20589995&do=blog&id=1621748

http://linux.chinaunix.net/docs/2006-12-15/3479.shtml

  



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值