-
Notifications
You must be signed in to change notification settings - Fork 6
HowTo
This is a short how to for using Templar as template debugger. Most of the information has been extracted from this talk: https://www.youtube.com/watch?v=i0bzwHBiNc4
After loading a trace (File -> Open Trace) the source code of the compiled file will be visible.
The buttons "Rewind" (
) and "Fast Forward" (
) allow to jump to the start and end of all instantiations. With the help of "Previous step" (
) and "Next step" (
) one can step backwards and forwards through instantiations. If the follow node button (
) is activated (pressed in), the graph will automatically center on the node of the current event while stepping. Else, it will stay at the current position.
In the graph view the whole instantiation graph can be seen:
In this graph the nodes signify template instantiations (angle boxes) or memoizations (ellipses). Edges show the dependency of one template on another. The color of a node indicates the current status of the template instantiation/memoization: Grey means the node has not yet been reached. Orange means the node is being instaniated (right now). Green means the node has been instantiated. The blue border on a node means that it was selected (by clicking on it).
While stepping through the instantiation the code browser will show the relevant section of the source code. Below the source code browser the type of the current event (Begin/End? of instantiation), the kind (Instantiation, Memoization), the name and the file position of the relevant code are displayed. Besides this a list of all instantiations that have begun but not yet ended is shown (you can select them to jump to them in the graph/source code browser)
You can add a breakpoint by clicking on the button "Breakpoint".
A dialog will pop up that allows you to manage existing breakpoints and add new ones.
A breakpoint is a that is tested on each event of an instantiation/memoization and if it matches the name of the template of this exent, program breaks.
Instead of stepping through the program you now can add the breakpoint and fast forward/rewind to the breakpoints.
When dealing with realworld programs (that use the stdlib) we get much more instantiations than only those we are interested in. Filtering allows us to skip templates that match the [expression](http://qt-project.org/doc/qt-4.8/qregexp.html#details regular) we entered in the filter.
If you select a node prior to clicking on the "Filter" button the nodes text will be inserted as (escaped) regex.
Q: Can I set breakpoints on lines?
A: No, the regex is only matched against the template name. However, you can try to build a regex representing the line.
