GithubHelp home page GithubHelp logo

liumorgan / systemtap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jav/systemtap

0.0 1.0 0.0 13.09 MB

License: GNU General Public License v2.0

Shell 4.37% Makefile 5.43% C++ 38.93% M4 2.64% Roff 2.45% Python 1.10% C 37.63% HTML 4.12% Ruby 0.28% Tcl 0.93% Perl 1.75% DTrace 0.03% Assembly 0.05% CSS 0.07% Awk 0.08% Vim Script 0.14%

systemtap's Introduction

systemtap: a linux trace/probe tool

Visit the project web site at <http://sourceware.org/systemtap>,
for documentation and mailing lists for developers and users.

This is free software.
See the COPYING file for redistribution/modification terms.
See the INSTALL file for generic build instructions.

Prerequisites:

- linux kernel with kprobes (mainline 2.6.11+ or backport)
- kernel module build environment (kernel-devel rpm)
- optionally, debugging information for kernel/user-space being instrumented
- C compiler (same as what kernel was compiled with)
- elfutils with libdwfl for debugging information parsing
- root privileges

Installation steps:

- Install the kernel development and gcc packages.
  On modern Fedora, # yum install kernel-devel-`uname -r`

- Install any debuginfo packages you need, for kernel and/or userspace.
  On modern Fedora, # debuginfo-install kernel [...]

  (Beware of confusion between kernel vs. kernel-debug vs kernel-PAE etc.
  variants.  Each likely has a corresponding development and debuginfo
  package.)

- Install the systemtap package.
  On modern Fedora, # yum install systemtap systemtap-runtime

Build steps:

- Install the kernel-debuginfo, kernel-devel, gcc and dependent
  packages (or see below if you are building your own kernels from source).

- If available, install your distribution's copy of elfutils and its
  development headers/libraries.
  Or if desired, download an elfutils source release to build in
  "bundled mode" (below), and untar it into some new directory.
  Or if desired, build elfutils separately one time, and install
  it to /usr/local.
  See http://fedorahosted.org/elfutils/
  Version 0.151 is recommended for i386 hosts probing prelinked programs.
  (PR12141)

- On modern Fedora, install general optional build-requisites:
  # yum-builddep systemtap
  On modern Debian/Ubuntu, similarly:
  # apt-get build-dep systemtap

- Download systemtap sources:
  http://sourceware.org/systemtap/ftp/releases/
  http://sourceware.org/systemtap/ftp/snapshots/
  (or)
  git clone git://sourceware.org/git/systemtap.git
      (or) http://sourceware.org/git/systemtap.git

- Build systemtap normally:
  % .../configure [other autoconf options]
  Or, with build it with a bundled internal copy of elfutils:
  % .../configure --with-elfutils=ELFUTILS-SOURCE-DIR [other autoconf options]
  (Note that elfutils > 0.139 requires gcc > 4.0 or else the
  appropriate elfutils-portability.patch.)

  Consider configuring with "--enable-dejazilla" to automatically
  contribute to our public test result database.

  Consider configuring with "--prefix=DIRECTORY" to specify an
  installation directory other than /usr/local.  It can be an ordinary
  personal directory.

  % make all
  # make install

  To uninstall systemtap:
  # make uninstall

- Run systemtap:

  To run systemtap after installation, add $prefix/bin to your $PATH, or
  refer to $prefix/bin/stap directly.  If you keep your build tree
  around, you can also use the "stap" binary there.  

  Some samples should be available under $prefix/share/doc/systemtap/examples.

  Normally, run "stap" as root.  If desired, create "stapdev" and
  "stapusr" entries in /etc/groups.  Any users in "stapdev"+"stapusr" will
  be able to run systemtap as if with root privileges.  Users in "stapusr"
  only may launch (with "staprun") pre-compiled probe modules (created
  by "stap -p4 ...") that a system administrator copied under
  /lib/modules/`uname -r`/systemtap.  "stapusr" may also be permitted to
  create arbitrary unprivileged systemtap scripts of their own.  See
  README.unprivileged for additional setup instructions.

  To run a simple test.
  # stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'

  To run the full test suite from the build tree.
  # make installcheck


Tips:

- By default, systemtap looks for the debug info in these locations:
  /boot/vmlinux-`uname -r`
  /usr/lib/debug/lib/modules/`uname -r`/vmlinux
  /lib/modules/`uname -r`/vmlinux
  /lib/modules/`uname -r`/build/vmlinux


Building a kernel.org kernel:

- Consider applying the utrace kernel patches, if you wish to probe
  user-space applications.  http://sourceware.org/systemtap/wiki/utrace

- Build the kernel using your normal procedures.  Enable
  CONFIG_DEBUG_INFO, CONFIG_KPROBES, CONFIG_RELAY, CONFIG_DEBUG_FS,
  CONFIG_MODULES, CONFIG_MODULE_UNLOAD, CONFIG_UTRACE if able
- % make modules_install install headers_install
- Boot into the kernel.

- If you wish to leave the kernel build tree in place, simply run
  % stap -r /path/to/kernel/build/tree [...]
  You're done.

- Or else, if you wish to install the kernel build/debuginfo data into
  a place where systemtap will find it without the "-r" option:
  % ln -s /path/to/kernel/build/tree /lib/modules/RELEASE/build 

- Instead of using the "-r" option, you can also use the environment 
  variable SYSTEMTAP_RELEASE to direct systemtap to the kernel data.

systemtap's People

Contributors

fche avatar cuviper avatar drsmith2 avatar wcohen avatar stanfordcox avatar lberk avatar eugmes avatar serhei avatar przemoc avatar zhaoleidd avatar stevedd avatar srikard avatar natoscott avatar lindi2 avatar sunzen avatar jankratochvil avatar petr-muller avatar groleo avatar tonyj-suse avatar erickt avatar bmr-cymru avatar flameeyes avatar jeffmoyer avatar rgrunber avatar justlooks avatar obusatto avatar mmilgram avatar lkundrak avatar bitness avatar kiiofkirc avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.