Retrace
Retrace is one of CodeWalker's most powerful debugging tools. It's like a time machine for your code. It follows a very simple format, and you can generate Retrace data in real time through your code or after the fact, following these simple guidelines.
Retrace File Format
A retrace file is a text file that follows the execution of your code. It is tied to the line numbers, and expects that the line numbers in your code match the line numbers reported in the file. If the numbers are off, it tries to match as closely as possible.
This was decided on to allow the developer the ability to save out retrace data as they see fit. You do not need to report every line touched. In fact, you can limit your stored data to only parts of your code that you are interested in.
At this time, retrace is limited to the 2D view, and only one file at a time. We plan to expand that eventually, to allow you to follow the logic of your code as it flows throughout your entire project. But for now, one file at a time.
A line of Retrace data is two parts, separated by a space. The line ends with a newline character.
Line Number - This should be the line of the calling function or a line number of a piece of code that executes. CodeWalker ignores comments entirely, so adding a line number for a comment will result in CodeWalker displaying the last piece of executing code prior to that line.
Data you would like to display. This is typically either the line of code or the name of a subroutine, though it can technically be anything you want to display.
So a typical sequence of Retrace lines might be...
20 Start
40 Function 1
42 Distance is >1< here.
44 ProcessDistance()
44 Distance is now >2<
Or you might add some Retrace code to your ProcessDistance subroutine and get this...
20 Start
40 Function 1
42 Distance is >1< here.
44 ProcessDistance()
120 Inside ProcessDistance now
122 Detecting distance using sonar...
124 Sonar is offline, trying a a harpoon gun...
132 Harpoon gun successful, target is...
134 2 meters away. Returning that now...
44 Distance is now >2<
And really that's all there is to it. Retrace was designed to be as lightweight as possible, so it can be generated by anything that can create ASCII data. By keeping the structure lightweight, it is our hope that retrace won't create too much of a processing burden on a system.
...