Skip to content

Debugging Facilities

Debugging Facilities

GT.M provides a number of debugging features. These features include the ability to:

  • Interactively execute routines using M commands.
  • Display lines that may contain errors using the ZPRINT command and the $ZPOSITION special variable.
  • Redisplay error messages using the $ZSTATUS special variable and the ZMESSAGE command.
  • Set breakpoints and actions to bypass an error using the ZBREAK command.
  • Execute a line at a time using the ZSTEP command.
  • Display information about the M environment using the ZSHOW command.
  • Modify the invocation stack with QUIT and ZGOTO.
  • Incrementally add or modify code using the ZLINK and ZEDIT commands.
  • Continue execution using the ZCONTINUE command.
  • Establish “watch points” with triggers to trap incorrect accesses on global variable updates.

The following table summarizes the GT.M language extensions that facilitate debugging.

GT.M Debugging Tools
EXTENSIONEXPLANATION
ZBreakEstablishes a temporary breakpoint, with optional M action and/or activation count.
ZContinueContinues routine execution from a break.
ZEDitInvokes the UNIX text editor specified by the EDITOR environment variable.
ZGotoRemoves multiple levels from the M invocation stack and transfers control.
ZLinkIncludes a new or modified M routine in the current M image; automatically recompiles if necessary.
ZMessageSignals the specified condition.
ZPrintDisplays lines of source code.
ZSHowDisplays information about the M environment.
ZSTepIncrementally executes a routine to the beginning of the next line of the same type.
ZWRiteDisplays all or some local or global variables.
$ZCSTATUSHolds the value of the status code for the last compile performed by a ZCOMPILE, ZLINK or auto-ZLINK.
$ZEDitContains the status code for the last ZEDit.
$ZJOBEXAM()Performs a ZSHOW “*” to a default file location and name, or the one optionally specified by the argument.
$ZLEVelContains the current level of DO/XECUTE nesting.
$ZMessage()Translates an error condition code into text form.
$ZPOSitionContains a string indicating the current execution location.
$ZPROmptControls the symbol displayed as the direct mode prompt.
$ZROutinesContains a string specifying a directory list containing the object, and optionally the source, files.
$ZSOurceContains name of the M source program most recently ZLINKed or ZEDITed; default name for next ZEDIT or ZLINK.
$ZStatusContains error condition code and location of the last exception condition occurring during routine execution.
$ZSTepControls the default ZSTep action.