What is System Tap ?
It is an infrastructuer coming with a scripting language that allows collecting information on a running linux kernel. It can be used by System Administrators to see for example which process are hitting hardly the disks, or by Kernel/UserSpace developers to instrument their code and gather information about disk access, network usage... A great tool to fine tune and optimize application.
It is similar to DTrace available for Solaris and BDS Oses.
A good documentation exists for System Tap: http://sourceware.org/systemtap/tutorial/
User Space debugging
For Debian Squeeze System Tap works out of the box for probing kernel code. But when I wanted to trace userspace code I was facing the following error:
So it seems like my Debian kernel is lacking of utrace supports. Let's recompile it :). First of all we have to get a vanilla kernel (because with the debian I can't apply utrace patches properly):
Then the utrace patches:
The trick here is that tracehook.patch is a gzip archive and not a plain text file:
Untar linux sources and apply the patches:
Compile the kernel:
Enable the option CONFIG_UTRACE
Also modify grub to add an entry pointing to your new kernel and initrd image.
Reboot and that's it !