Difference between revisions of "SystemTap"

From ArchWiki
Jump to: navigation, search
(wrong i18n)
m (Wuxb moved page Systemtap to SystemTap: use caption 'T')
(17 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Category: Kernel}}
+
[[Category:Kernel]]
{{i18n|Systemtap}}
+
[[zh-CN:SystemTap]]
 
+
[http://sourceware.org/systemtap/ SystemTap] provides free software (GPL)
[http://sourceware.org/systemtap/ Systemtap] provides free software (GPL)
+
 
infrastructure to simplify the gathering of information about the running Linux system.
 
infrastructure to simplify the gathering of information about the running Linux system.
  
 
==Easy and fast==
 
==Easy and fast==
Officially, it is recommended to build a ''linux-custom'' package to run systemtap, but rebuilding the original {{Pkg|linux}} package can be very easy and efficient.
+
Officially, it is recommended to build a ''linux-custom'' package to run SystemTap, but rebuilding the original {{Pkg|linux}} package can be very easy and efficient.
  
 
===Prepare===
 
===Prepare===
You can run {{ic|sudo abs; cp -r /var/abs/core/linux .}} to get the original kernel build files.
+
You can run {{ic|<nowiki>ABSROOT=. abs core/linux; cd core/linux</nowiki>}} to get the original kernel build files.
 +
Then use {{ic|makepkg --verifysource}} to get the additional files. By performing the verification, you can safely skip the step of "Update checksum".
  
 
===modify config===
 
===modify config===
 
Edit '''config''' (for 32-bit systems) or '''config.x86_64''' (for 64-bit systems), turn on these options:
 
Edit '''config''' (for 32-bit systems) or '''config.x86_64''' (for 64-bit systems), turn on these options:
* CONFIG_DEBUG_INFO=y
 
 
* CONFIG_KPROBES=y
 
* CONFIG_KPROBES=y
* CONFIG_RELAY=y
+
* CONFIG_KPROBES_SANITY_TEST=n
* CONFIG_DEBUG_FS=y
+
* CONFIG_KPROBE_EVENT=y
* CONFIG_MODULES=y
+
* CONFIG_NET_DCCPPROBE=m
* CONFIG_MODULE_UNLOAD=y
+
* CONFIG_NET_SCTPPROBE=m
* CONFIG_UTRACE=y
+
* CONFIG_NET_TCPPROBE=y
By default only ''CONFIG_DEBUG_INFO'' and ''CONFIG_KPROBES'' are not set.
+
* CONFIG_DEBUG_INFO=y
 +
* CONFIG_DEBUG_INFO_REDUCED=n
 +
* CONFIG_X86_DECODER_SELFTEST=n
 +
By default only ''CONFIG_DEBUG_INFO'' and ''CONFIG_DEBUG_INFO_REDUCED'' are not set.
  
With current core/linux (3.3.8) you can simply do this:
+
With current core/linux (3.6.10) you can simply append these lines into config[.x86_64]:
{{hc|i686|<nowiki>
+
{{hc|x86_64|
echo "CONFIG_DEBUG_INFO=y" >> config
+
<nowiki>
echo "CONFIG_KPROBES=y" >> config
+
echo '
</nowiki>}}
+
CONFIG_KPROBES=y
{{hc|x86_64|<nowiki>
+
CONFIG_KPROBES_SANITY_TEST=n
echo "CONFIG_DEBUG_INFO=y" >> config.x86_64
+
CONFIG_KPROBE_EVENT=y
echo "CONFIG_KPROBES=y" >> config.x86_64
+
CONFIG_NET_DCCPPROBE=m
</nowiki>}}
+
CONFIG_NET_SCTPPROBE=m
 +
CONFIG_NET_TCPPROBE=y
 +
CONFIG_DEBUG_INFO=y
 +
CONFIG_DEBUG_INFO_REDUCED=n
 +
CONFIG_X86_DECODER_SELFTEST=n
 +
' >> config.x86_64
 +
</nowiki>
 +
}}
 +
 
 +
===Update checksum===
 +
''You can safely skip this step if you believe the source files are correct''.
  
===update checksum===
 
 
Run {{ic|md5sum config[.x86_64]}} to get a new md5sum.
 
Run {{ic|md5sum config[.x86_64]}} to get a new md5sum.
  
Line 41: Line 52:
 
Optional: you can set {{ic|<nowiki>MAKEFLAGS="-j16"</nowiki>}} in {{ic|/etc/makepkg.conf}} to speed up the compilation.
 
Optional: you can set {{ic|<nowiki>MAKEFLAGS="-j16"</nowiki>}} in {{ic|/etc/makepkg.conf}} to speed up the compilation.
  
Run {{ic|makepkg}} to compile, then simply {{ic|sudo pacman -U *.pkg.tar.gz}} to install the packages.
+
Run {{ic|makepkg}} or {{ic|makepkg --skipchecksums}} to compile, then simply {{ic|sudo pacman -U *.pkg.tar.gz}} to install the packages.
 
'''pacman''' will tell you '''reinstall''', That's great!
 
'''pacman''' will tell you '''reinstall''', That's great!
  
Line 48: Line 59:
 
Via this method, external modules (e.g. {{Pkg|nvidia}} and {{Pkg|virtualbox}}) don't need to be rebuilt.
 
Via this method, external modules (e.g. {{Pkg|nvidia}} and {{Pkg|virtualbox}}) don't need to be rebuilt.
  
===Systemtap===
+
===SystemTap===
Simply install systemtap from [[AUR]]: {{AUR|systemtap}}, all done.
+
Simply install SystemTap from [[AUR]]: {{AUR|systemtap}}, all done.
 +
 
 +
However, the SystemTap package in AUR seems to be outdated. You could also try a newer version of PKGBUILD from this site: [https://raw.github.com/wuxb45/Snippet/master/PKGBUILDs/systemtap/PKGBUILD].
  
 
==Build custom kernel==
 
==Build custom kernel==
 
Please reference this [http://sourceware.org/git/?p=systemtap.git;a=blob_plain;f=README;hb=HEAD README]
 
Please reference this [http://sourceware.org/git/?p=systemtap.git;a=blob_plain;f=README;hb=HEAD README]
 +
 +
==Troubleshooting==
 +
 +
=== Pass 4 fails when launching ===
 +
 +
If you have:
 +
 +
    /usr/share/systemtap/runtime/stat.c:214:2: error: 'cpu_possible_map' undeclared (first use in this function)
 +
 +
Try to install systemtap-git package
 +
 +
=== System.map is missing ===
 +
 +
You can recover it where you build your linux kernel with DEBUG_INFO enabled
 +
   
 +
    cp src/linux-3.6/System.map /boot/System.map-3.6.7-1-ARCH

Revision as of 12:13, 20 April 2013

SystemTap provides free software (GPL) infrastructure to simplify the gathering of information about the running Linux system.

Easy and fast

Officially, it is recommended to build a linux-custom package to run SystemTap, but rebuilding the original linux package can be very easy and efficient.

Prepare

You can run ABSROOT=. abs core/linux; cd core/linux to get the original kernel build files. Then use makepkg --verifysource to get the additional files. By performing the verification, you can safely skip the step of "Update checksum".

modify config

Edit config (for 32-bit systems) or config.x86_64 (for 64-bit systems), turn on these options:

  • CONFIG_KPROBES=y
  • CONFIG_KPROBES_SANITY_TEST=n
  • CONFIG_KPROBE_EVENT=y
  • CONFIG_NET_DCCPPROBE=m
  • CONFIG_NET_SCTPPROBE=m
  • CONFIG_NET_TCPPROBE=y
  • CONFIG_DEBUG_INFO=y
  • CONFIG_DEBUG_INFO_REDUCED=n
  • CONFIG_X86_DECODER_SELFTEST=n

By default only CONFIG_DEBUG_INFO and CONFIG_DEBUG_INFO_REDUCED are not set.

With current core/linux (3.6.10) you can simply append these lines into config[.x86_64]:

x86_64

echo '
CONFIG_KPROBES=y
CONFIG_KPROBES_SANITY_TEST=n
CONFIG_KPROBE_EVENT=y
CONFIG_NET_DCCPPROBE=m
CONFIG_NET_SCTPPROBE=m
CONFIG_NET_TCPPROBE=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_INFO_REDUCED=n
CONFIG_X86_DECODER_SELFTEST=n
' >> config.x86_64

Update checksum

You can safely skip this step if you believe the source files are correct.

Run md5sum config[.x86_64] to get a new md5sum.

In PKGBUILD file, the md5sums=('sum-of-first' ... 'sum-of-last') has the same order with source=('first-source' ... 'last-source'), put your new md5sum in the right place.

Build and Install

Optional: you can set MAKEFLAGS="-j16" in /etc/makepkg.conf to speed up the compilation.

Run makepkg or makepkg --skipchecksums to compile, then simply sudo pacman -U *.pkg.tar.gz to install the packages. pacman will tell you reinstall, That's great!

linux and linux-headers should be reinstalled, linux-docs does not matter.

Via this method, external modules (e.g. nvidia and virtualbox) don't need to be rebuilt.

SystemTap

Simply install SystemTap from AUR: systemtapAUR, all done.

However, the SystemTap package in AUR seems to be outdated. You could also try a newer version of PKGBUILD from this site: [1].

Build custom kernel

Please reference this README

Troubleshooting

Pass 4 fails when launching

If you have:

   /usr/share/systemtap/runtime/stat.c:214:2: error: 'cpu_possible_map' undeclared (first use in this function)

Try to install systemtap-git package

System.map is missing

You can recover it where you build your linux kernel with DEBUG_INFO enabled

   cp src/linux-3.6/System.map /boot/System.map-3.6.7-1-ARCH