Debugging your IB programs using the Trace Commands
The trace statements allow you to easily debug your IB programs whether they run in foreground or background. When Tracing, a "Trace window" pops up on the console of the Comet machine that displays much of what you would want to see to follow the progress of the program. Trace statements are executable statements.
Trace on / Trace off There are several trace commands that control the detail of the information displayed in the trace window, but the only statement you need to use to see tracing is:
This is an executable statement than can be placed anywhere in your program. When Comet encounters this command it will pop up the trace window and tracing will continue until the program ends or the Trace off command is executed. The following commands control the information displayed in the trace window. By default most of these items are enabled when tracing. In addition to these, whenever a Comet32 Proc is entered and whenever a comet32 ProcReturn is executed, information about this is displayed.
Trace Labels on/off
Displays whenever a program label is hit during execution
Trace Source on/off
If the source files are available when executing the program, the source line is displayed.
Trace Time on/off
A time stamp is displayed on each trace line. This is turned off by default.
Trace Events on/off
Each time an event is fired in the program, the event information is displayed.
Trace Exceptions on/off
Each time an exception is encountered in the program, the exception is displayed.
Trace Partition on/off
Controls whether the partition name is displayed on the trace line. This is off by default.
Trace Gosubs on/off
Turns on/off tracing inside of subroutines. This is on by default.
Trace Print string-expression
Displays the string expression in the trace window.
Trace File filename DIR=dirname
Sends trace output to the specified text file.
This will cause trace to pause as if the user clicked on the trace window “pause” button. It will also display a message to let the user know it has paused. Clicking “Next” or “Resume” will continue program execution as expected.
The trace window is a single window owned by Comet32. All trace output is displayed in this window from all programs actively tracing whether these are Background or Foreground, Xap or CometAnywhere. This can be useful to see interaction among programs, but can be disconcerting at times.
If the source file is not available in the same directory from which it was compiled, at execution time, the line number information will be displayed, but not the text of the source.
Tracing continues into entered programs.
Trace information is compiled into the Comet32 object file. Comet programs compiled under Comet16, or Comet32 programs compiled with builds earlier than 444 will not have that information and therefore it will not be displayed.
The Trace statement was introduced in Comet 2011 build 444. These commands are available in Comet32 only.