[PATCH 0/2][RFC-repost] user space instruction tracing

Dave Nomura dcnltc@us.ibm.com
Thu Nov 1 16:52:00 GMT 2007


[PATCH 0/2] Instruction tracing

This patch set provides a tapset that implements user space instruction 
tracing x86 architecture.  Although there it doesn't contain anthing x86 
specific, the tapset has not been ported to the PPC.  Specifically it 
does not deal with the non-steppable LDWARX/STWARX sequences.  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 would generate a trap handler routine for the 
body of the probe.  The body can employ any SystemTap language 
constructs that don'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 would 
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 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

-- 
Dave Nomura
LTC Linux Power Toolchain




More information about the Systemtap mailing list