TraceTool:  A Simple Dyninst Tracing Tool

Overview
Download
Setup
Running
Building
Credits
 

Overview

This program is called TraceTool and it's an example tracing utility which uses dyninstAPI.  The TraceTool program will instrument a given program so that function entries, exits, and callsites in the program will be instrumented with calls into designated tracing functions in the tracetool tracing library.  It currently has been tested on x86-Linux, Power-AIX, and Sparc-Solaris.

It has certain limitations.

  • I'm only printing out the first function argument and I'm only handling function arguments and return values that are integers right now.
  • I'm currently only instrumenting the non library modules.
There are three binaries that are part of this distribution.
  • tracetool   - the tracing tool utility
  • tracelib.so - the tracing library used by tracetool
  • userapp     - an example application to feed to tracetool

  •  

Download

 tracetool.tar.gz

Setup

Before TraceTool is run, certain environment variables need to be set.

For dyninstAPI, the environment variables DYNINSTAPI_RT_LIB and LD_LIBRARY_PATH need to be set appropriately.  DYNINSTAPI_RT_LIB needs to be set to the path of the dyninst runtime library file (libdyninstAPI_RT.so.1) and the environment variable LD_LIBRARY_PATH needs to be updated so that it contains the directory containing the dyninst library (libdyninstAPI.so).

For the tracetool utility, the environment variable TRACETOOL_LIB needs to be set to the path of the tracetool tracing library.

Here's example of cshell commands which I use to do the above.

setenv DYNINSTAPI_RT_LIB ~/devafs/swork/d20/lib/i386-unknown-linux2.4/libdyninstAPI_RT.so.1
setenv LD_LIBRARY_PATH ~/devafs/swork/d20/lib/i386-unknown-linux2.4:$LD_LIBRARY_PATH
setenv TRACETOOL_LIB /p/paradyn/development/schendel/proj/test150/i386_rh72/tracelib.so
 

Running

As the options below show it can either create or attach to the process to be traced.
  cumin_47> tracetool
  Usage: tracetool [-p<pid>] program [prog-arguments]
         -p: specify process id of program, for attaching
         if no pid is passed, then the process is started directly
         (need to set environment variable TRACETOOL_LIB to
          path of trace library)

Here's an example of an invocation of tracetool on the application wget that I have been using.

  • Attaching to the process

  • /p/paradyn/development/schendel/proj/test150/i386_rh72/tracetool -p2567 $A/sequential/wget/bin/wget
    where 2567 was the pid of the wget process started in another terminal
  • Creating the process

  • /p/paradyn/development/schendel/proj/test150/i386_rh72/tracetool $A/sequential/wget/bin/wget -Q500m -r http://www.cnn.com/ -o mylog | & tee log1

Building

There is a Makefile in the directory tracetool/<platform>.

In the Makefile the variable DYNINST_ROOT will need to be updated to the directory where dyninstAPI is located.  Specifically, this directory should be the directory containing the dyninst core and lib directories.

Type make to build the tracetool, tracing library, and the test application.
 

Credits

Written by:
Brandon Schendel
to contact, email paradyn@cs.wisc.edu