From: PORKOLAB Zoltan (gsd_at_[hidden])
Date: 2008-05-12 07:02:03
We have created a framework for debugging/profiling template
metaprograms in 2006. It might give you a few tips.
It works based on the same idea you have.
We instrument all template codes, both at the begining
and at the end of each template we insert a special piece
of code emitting warning messages of a well-defined form.
Before instrumentation we create an XML file to remember
the template positions in the source file. When we parse
the warning, using this information we can reconstruct
the instantiation stack knowing the original line numbers,
identifiers, etc.. At the end we produce another XML for
The framework uses boost::spirit and boost::wave. We have also
implemented and tested a visual studio plug-in.
An overview of the whole idea: http://gsd.web.elte.hu/templight/
There is also a GPCE article about the framework, you can find it here:
or here: http://gsd.web.elte.hu/contents/articles/gpce06.pdf
You can download both the VS binaries and the source from:
Please feel free to use the code or any of the ideas.
For technical question you can find Jozsef: jmihalicza_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk