[LLVMdev] Identify which LLVM function is currently being invoked ?

Philip Reames listmail at philipreames.com
Fri May 9 09:26:27 PDT 2014


There's no general way to do this, but if you control the IR, it's 
pretty easy to insert a call to a trace function at the beginning and 
end of each function.  You could also write a pass to do the same thing.

basic steps:
- add a function declaration to the module for your trace function (i.e. 
"puts")
- insert calls to that function using constant strings as arguments (so 
the address is fixed)
- provide a definition for your trace function (i.e. linking)

Philip

On 05/08/2014 05:53 PM, Sri wrote:
> Hi All
>         Is there any way to identify which LLVM function is currently 
> executing in the program. It would be nice to know or print what is 
> the corresponding LLVM function is executing/
>
>
> Thanks
>
> Regards
> Sri.
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140509/869ab2be/attachment.html>


More information about the llvm-dev mailing list