HI ,
I understand that the standard C library functions are executed using the
native library of the host machine. ( for example when we execute a bytecode
to extract the profile info )
Is it possible to extract for each standard library function that is
executed , the arguments that the function is called with.
For example if printf ("%d", some_int ) when called during runtime
with some_int = 243 i want to get that info .
abhijit
Sure, you can do that multiple ways. Perhaps the easiest would be to write an LLVM->LLVM pass which inspects all calls to external functions (e.g. printf) and inserts some code before or after it. Thus it would turn:
printf("%d", some_int);
into:
log_printf_call(some_int);
printf("%d", some_int);
Or something. You can then provide an implementation of the logging runtime library to capture the data in any format you want.
-Chris
Right now I am trying to capture the function name and the number of arguments ,
so this following is the pass I wrote .
looks like my invocation to getGetElementPtr() is not what it should be
. But I am not sure what it should be 
The reason the above doesn't work is that the ConstantArray is not a pointer
type. You cannot use a non pointer type in a getelementptr instruction.
Instead you should create a GlobalVariable initialized with the ConstantArray
(the name) and pass a ConstantExpr::getPtrPtrFromArrayPtr(<the global
) to the function call as the name of the function.
I hope this helps,