[LLVMdev] LLVM instrumentation

Thomas Yang yangchunbai at gmail.com
Wed Jun 12 19:02:35 PDT 2013


Hello everyone, 

I want to use LLVM to perform instrumentation on existing bitcode file. I
want to declare a global variable using cpp standard library, say
vector<int> glVector(3); 

So I need to get the LLVM Type* of the global variable and then the initial
value Constant* of the global variable. However, the type of vector is not
the primitive type but defined in the vector.h of C++ standard library. Is
there a easy way to perform the instrumentation as if the original bitcode
file has include <vector>? 

I create a quite simple cpp file as followed and compile it into a llvm
bitcode file. The bitcode file has 800 lines of code. I suppose the naive
way of instrumenting the declaration of everything of the vector.h is not
practical. Any suggestion is welcome. 

#include <iostream>
#include <vector>
using namespace std; 

vector<int> abc(3); 
int main() { 
        abc[0]=1; 
        abc[1]=2; 
        abc[2]=3; 
        cout<<"abc[1]: " << abc[1] << endl; 
        return 0; 
} 

Regards, 
Thomas Yang 



--
View this message in context: http://llvm.1065342.n5.nabble.com/LLVM-instrumentation-tp58472.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list