[LLVMdev] embedding trace functions to generate variable values

Pekka Jääskeläinen pekka.jaaskelainen at tut.fi
Wed Mar 6 03:18:34 PST 2013


Hi,

On 03/06/2013 12:39 PM, Vardhan Varma wrote:
>    I'm wondering if there is feature already  in LLVM or clang to embed
>    variable tracing instructions in the compiled output, so that on
> execution
>    of the program, a dump of various variables values over time is
> generated.

At least some time ago I couldn't find something like this in
LLVM so I implemented simple IR variable dumping via injecting printf
calls to debug data flow issues in pocl parallel region formation.

The code might help you to get forward if you want to generalize it:

InjectVariablePrintouts():
http://bazaar.launchpad.net/~pocl/pocl/trunk/view/head:/lib/llvmopencl/ParallelRegion.cc#L722 


BR,
-- 
Pekka



More information about the llvm-dev mailing list