I am using llvm 4.0. I need to hook a function in which the argument is one of the local variable in IR e.g. I want to pass %10 value to a function. I know how to hook a function. Following is my code:
hookFunc2 = M.getOrInsertFunction("funcName", Type::getVoidTy(M.getContext()),Type::getInt8PtrTy(M.getContext()),NULL);
hook1= cast<Function>(hookFunc2);
IRBuilder <> builder1(a); //where a is the basic block pointer
BasicBlock::iterator BC = a->begin();
builder1.SetInsertPoint(&(*BC));
Value* args = builder1.CreateGlobalStringPtr(%10); //this is wrong.what should be here instead of %10? I want %10 value.
builder1.CreateCall(hook1, args)
%10is defined. - arrowd