Displaying 4 results from an estimated 4 matches for "bishe_insert".
2011 Nov 19
2
[LLVMdev] Insert a function call in the code
...everyone
I am new to LLVM, now I got a problem
I want to add a function call before sleep(int a, int b)
code below
#include <stdio.h>
int sleep(int a, int b)
{
return a+b;
}
int main(int argc, char **argv)
{
sleep(1,2);
}
after use opt -load ../llvm-2.8/Release+Asserts/lib/bishe_insert.so
-bishe_insert <1.bc> 2.bc
I want get the code
#include <stdio.h>
int sleep(int a, int b)
{
return a+b;
}
int main(int argc, char **argv)
{
hook() //void *hook(void )
sleep(1,2);
}
after Using apt................................................
ERROR Occured
[kain...
2012 Aug 22
1
[LLVMdev] Insert Self Written Function Call from a FunctionPass?
...lvm;
Module * M;
LLVMContext Context;
Twine * name = new Twine("print");
FunctionType
*STy=FunctionType::get(Type::getInt32Ty(Context),Type::getInt32Ty(Context),
false);
Function *check = Function::Create(STy, Function::ExternalLinkage, *name
,M);
AllocaInst* count;
namespace{
struct bishe_insert : public FunctionPass{
static char ID;
bishe_insert() : FunctionPass(ID) {}
virtual bool runOnFunction(Function &func)
{
count = new AllocaInst(IntegerType::getInt32Ty(Context), 0, "count");
count->setAlignment(4);
for(Function::iterator...
2011 Nov 20
0
[LLVMdev] Insert a function call in the code
...cf
> > 1 opt 0x000000000083181a
> > 2 libpthread.so.0 0x00000033f460f4c0
> > 3 libc.so.6 0x00000033f42329a5 gsignal + 53
> > 4 libc.so.6 0x00000033f4234185 abort + 373
> > 5 libc.so.6 0x00000033f422b935 __assert_fail + 245
> > 6 opt 0x00000000007d866b
> > 7 bishe_insert.so 0x00007f94c62a2b3f
> > 8 opt 0x00000000007c47d7 llvm::MPPassManager::runOnModule(llvm::Module&)
> + 503
> > 9 opt 0x00000000007c4957 llvm::PassManagerImpl::run(llvm::Module&) + 167
> > 10 opt 0x00000000004a43be main + 2734
> > 11 libc.so.6 0x00000033f421ec5d __...
2011 Nov 21
0
[LLVMdev] How to get ELF section virtual starting address from MCSymbolRefExpr?
...cf
> > 1 opt 0x000000000083181a
> > 2 libpthread.so.0 0x00000033f460f4c0
> > 3 libc.so.6 0x00000033f42329a5 gsignal + 53
> > 4 libc.so.6 0x00000033f4234185 abort + 373
> > 5 libc.so.6 0x00000033f422b935 __assert_fail + 245
> > 6 opt 0x00000000007d866b
> > 7 bishe_insert.so 0x00007f94c62a2b3f
> > 8 opt 0x00000000007c47d7 llvm::MPPassManager::runOnModule(llvm::Module&)
> + 503
> > 9 opt 0x00000000007c4957 llvm::PassManagerImpl::run(llvm::Module&) + 167
> > 10 opt 0x00000000004a43be main + 2734
> > 11 libc.so.6 0x00000033f421ec5d __...