[LLVMdev] Help on LLVM Instrumentation

Andrew Lenharth alenhar2 at uiuc.edu
Mon Oct 17 08:28:36 PDT 2005


On Sun, 2005-10-16 at 13:24, Sandra Johnson wrote:
> Hi ,
> 
> I am using LLVM for my Post Graduate course project on Optimization. I
> am trying to do some insrtumentation to the bytecode.I 've been going
> through your Instrumentation code for the past few days in
> /llvm/lib/Transforms/Instrumentation folder and finally found two ways
> of instrumentation :
> 
> 1) injecting LLVM bytecode instructions
> 
> 2) calling an external C function.
> 
> I am trying both and I am comfortable with the 2).
> My goal is to insert a global variable , which will count the total
> number of functions executed.At each method entry the global variable
> should be incremented and at the last method exit , it should print
> the count. The code compiled successfully, but when I used in the opt
> tool, I get an error in the getElementPtr(..) statement and finally a
> segmentation fault error. Please help me regarding this.

One tool you may find extremely helpful is bugpoint.  Bugpoint will take
you bytecode and perform a search to find the smallest subset of the
file that triggers an error.  Sharing this "reduced" file is much better
when seeking help (if the reduction doesn't make it clear to you what
the problem is).  Check out the tool's instructions and email the list
if you need help running it.

Bugpoint is how we all stay sane when tracking down bugs.

Andrew




More information about the llvm-dev mailing list