Trace

From CometWiki

Revision as of 19:27, 1 July 2011 by Jim (Talk | contribs)
Jump to: navigation, search

Debugging your IB programs using the Trace Commands

Introduction:

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.

Syntax:

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:

Trace on

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 Print string-expression

Displays the string expression in the trace window.

Discussion:

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.

The Trace statement was introduced in Comet 2011 build 444. These commands are available in Comet32 only.

Personal tools