A dyninst example by Vince Weaver


First, install dyninst somewhere.

Then, set up the env variables

  export PLATFORM=i386-unknown-linux2.4
  export DYNINST_ROOT=/fusion/scratch2/vince/projects/dyninst/dyninstAPI-v5.0.1
  export DYNINSTAPI_RT_LIB=$DYNINST_ROOT/$PLATFORM/lib/libdyninstAPI_RT.so.1
  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYNINST_ROOT/$PLATFORM/lib
  export PATH=$PATH:.

Where the ROOT and PLATFORM are set accordingly.

Then run "make" to generate the files.

  sample_test -  a simple test program.  It takes 2 integer arguments, x and
                 y, and the test message is printed x*y times.
  inst_code.c -  contains the instrumented code inserted in each function
                 call by dyninst.  This is compiled into the sample_test
		 binary, because otherwise we'd have to construct the code
		 op-code by op-code using dyinst's complicated portable 
		 assembly.
  simpoint.cc - The actual dyninst code that does the instrumentation.
  
  
Run "./runit" to generate sample results.



Notes:
+ Only works on dynamically linked binaries
+ Even with Dyninst 5.1 has huge overhead, hello world program
  takes 512MB of RAM.
  
