fengggli / comanche

comanche
Apache License 2.0
0 stars 1 forks source link

systemtap #10

Open fengggli opened 5 years ago

fengggli commented 5 years ago
fengggli commented 5 years ago

install

sudo apt-get update sudo apt-get install linux-image-$(uname -r)-dbgsym

* test installation

sudo env "PATH=$PATH" stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'


* Use script

sudo env "PATH=$PATH" stap test.tap -x 7931

// better one ps aux|grep mcas|head -1 |awk '{print $2}' | sudo env "PATH=$PATH" xargs -I{} stap test.tap -x {}


* How to write probes: https://linux.die.net/man/5/stapprobes
fengggli commented 5 years ago

image

Fixd by using?: (not actually, this was an error in my script)

# apt-get install -y elfutils

for file in `find /usr/lib/debug -name '*.ko' -print`
do
        buildid=`eu-readelf -n $file| grep Build.ID: | awk '{print $3}'`
        dir=`echo $buildid | cut -c1-2`
        fn=`echo $buildid | cut -c3-`
        mkdir -p /usr/lib/debug/.build-id/$dir
        ln -s $file /usr/lib/debug/.build-id/$dir/$fn
        ln -s $file /usr/lib/debug/.build-id/$dir/${fn}.debug
done