How to debug jit code


Can anyone tell me how can i debug jit code in this scenario..

Let say i have one file foo.c with two function foo1 and foo2.

file: foo.c

int foo1(int in)
   return in%64;

float foo2(float in)
   return in/foo1((int)in);

i generate llvm bytecode (ir) using llvm-gcc --emit-llvm -c ..

In test application:

load this .bc and create module , and replace function argument with contant val.. and call getpointertofunction.. and when i am using this function pointer i am getting segfault...

So please tell me if there is a way to debug this..

Thanks in advance.