Now the dirty trick I use is to put in the template to debug a call to a dummy function located in a .c file, and to put the breakpoint in that function.
Do you know if it is possible to activate the debugging in templates?
I hope so, with some effort... Please, put it to readmine (and perhaps create "debugger" group).