Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Dave Nomura <dcnltc <at> us.ibm.com>
Subject: [PATCH 0/2][RFC] user space instruction tracing
Newsgroups: gmane.linux.systemtap
Date: Wednesday 17th October 2007 20:54:22 UTC (over 10 years ago)
[PATCH 0/2] Instruction tracing

This patch set provides the tapset required to support user space 
instruction tracing and is only applicable to the x86 architecture.  It 
exploits the utrace mechanism for doing single-step instruction tracing.

Some language extensions have been discussed on the mailing list but 
there have been no translator changes made.  This patch only deals with 
the tapset to support instruction tracing.  The current proposal is to 
have the following instruction tracing tapscript syntax:
        probe usr_itrace.single_step
                or
        probe usr_itrace.block_step

The SystemTap translator will generate a trap handler routine for the 
body of the probe.  The body can employ any SystemTap language 
constructs that doesn't assume
a particular PC context.
The body could use internal variables to distinguish different behavior 
for different instruction tracing regions.

When the translator sees a single_step or block_step probe, it also inserts
        usr_itrace_init("single_step", trap_handler_address)
                or
        usr_itrace_init("block_step", trap_handler_address)
in the module initialization code.

The current SystemTap support for uprobes is still non-symbolic, but it 
can be used to turn on/off instruction tracing by making calls to the 
usr_itrace functions:
usr_itrace_on:long (pid:long) (returns 1=SUCCESS, 0=FAILURE)
usr_itrace_off (pid:long)

The example in [patch 2/2] shows how this can be done.

These patches are against:
2.6.23-rc5      (kernel containing utrace support)
but a RHEL5.1 system should contain all of the necessary kernel support.

Dependencies
systemtap:
I developed against version 0.6/0.129 built 2007-09-24

uprobes:
1. The version of uprobes in systemtap cvs/patches/uprobes/ should still 
work fine.  You can build uprobes into the kernel or as a module.  If 
you want the module version, you need to make sure your kernel has the 
right exports.  See README in that directory.

2. As of 10/08/07, the systemtap cvs view contains a working version of 
uprobes.  You can get a cvs view of systemtap's src directory, and build 
and install systemtap as described in src/README.  Assuming you have a 
utrace-enabled kernel WITH APPROPRIATE EXPORTS (RHEL 5.1 needs to export 
access_process_vm), stap will automatically build and insmod uprobes 
when you run a stap script that uses uprobes.  Or you can just
# cd src/runtime/uprobes
# make
# insmod uprobes.ko

TODO:
- add support for instruction tracing child threads
- add support for instruction tracing forked children
- add more useful instruction tracing output routines that can be called 
from the single step instruction handler
- port to PPC

Summary of patches:
[patch 1/2] usr_itrace.stp
[patch 2/2] User Instruction Tracing Example
 
CD: 2ms