5 Debugging

5.7 Tracing

Beside the stack browser, MLWorks has another facility to help the debugging process: tracing. It is controlled from the trace manager, invoked from the MLWorks podium with Break / Trace > Trace Manager. The trace manager works in exactly the same way as the breakpoint manager: it contains a list of functions whose execution must be traced each time they are called. You can add or remove functions in the list. Again, functions that are to be traced must have been compiled in debug mode.

Figure 5.6 The MLWorks trace manager.

A trace of a function listed in the trace manager proceeds as follows: whenever the function is called, MLWorks reports that it has been called, and also reports the result of the call when the function returns.

If you now add efact to the trace manager and type efact 6 in the listener, MLWorks will trace all the recursive calls to efact:

MLWorks> efact 6;
efact 6
	efact 4
		efact 2
			efact 0
			efact returns 1
		efact returns 2
	efact returns 24
efact returns 720
val it : int = 720 


MLWorks User Guide (UNIX version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker