Boost logo

Boost :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2008-05-12 08:24:51


Zoltan,

> 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
> possible front-ends.
>
> 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:
> http://portal.acm.org/citation.cfm?id=1173746&coll=portal&dl=ACM&CFID=4
> 773116&CFTOKEN=12094611
> or here: http://gsd.web.elte.hu/contents/articles/gpce06.pdf
>
> You can download both the VS binaries and the source from:
> http://people.inf.elte.hu/pocok
>
> Please feel free to use the code or any of the ideas.
> For technical question you can find Jozsef: jmihalicza_at_[hidden]
> or me.

I've tried to use this last year and found it to work reasonably well for
small/medium number of templates. The problem I encountered was that for
real world projects (i.e. trying to analyze some of the Spirit code) the
generated XML files where too huge to handle (at least for your VS plugin).
I didn't look further into extracting only certain parts out of the XML,
though.

Templight is definitely a promising first step towards better meta-template
debugging tools! I'ld love to see this to be brought forward in the future.

Regards Hartmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk