Tracing your program
Or you can use the TRACE instruction, described in
TRACE.
- To find out where your program is going, use TRACE Labels. The
example shows a program and the trace it gives on the screen.
Figure 1. ROTATE EXECThis gives the trace:
/* ROTATE EXEC */ /* Example: two iterations of wheel, six iterations */ /* of cog. On the first three iterations, "x < 2" */ /* is true. On the next three, it is false. */ trace L do x = 1 to 2 wheel: do 3 cog: if x < 2 then do true: end else do false: end end end done:rotate 6 *-* wheel: 8 *-* cog: 10 *-* true: 8 *-* cog: 10 *-* true: 8 *-* cog: 10 *-* true: 6 *-* wheel: 8 *-* cog: 13 *-* false: 8 *-* cog: 13 *-* false: 8 *-* cog: 13 *-* false: 17 *-* done: - To see how the language processor is computing expressions, use TRACE Intermediates.
- To find out whether you are passing the right data to a command or subroutine, use TRACE Results.
- To make sure that you get to see nonzero return codes from commands, use TRACE Errors.