Hi,This is my first post on this forum so please use soft batons (-;
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.
It’s a little like the old unix program ctrace[1], but using LLVM, instead
of rewriting C !
[1] http://docs.oracle.com/cd/E24457_01/html/E22003/ctrace.1.html
Thanx in advance,
–Vardhan
Hi,
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,
No, I don’t believe there is a tool quite like that in LLVM. However, we have a research prototype dynamic backwards slicing tool called Giri written with LLVM. Giri instruments a program to record all basic block and loads/store executions in a trace file and can then use this trace to find all LLVM IR instructions that were executed in that execution of the program. You could probably enhance Giri with additional features to do what you describe. If you’d like a copy of Giri, please email the list. – John T.