Product SiteDocumentation Site

Chapter 15. Debugging Aids

15.1. Interactive Debugging of Programs
15.2. Debugging Aids
15.3. RXTRACE Variable
In addition to the TRACE instruction described in Section 2.29, “TRACE”, there are the following debugging aids.

15.1. Interactive Debugging of Programs

The debug facility permits interactively controlled execution of a program. Adding the prefix character ? to the TRACE instruction, the TRACE function, or TRACE keyword of the ::OPTIONS directive. For example, TRACE ?I, TRACE(?I), or ::OPTIONS TRACE ?I) turns on interactive debugging and indicates to the user that interactive debugging is active. Further TRACE instructions in the program are ignored, and the language processor pauses after nearly all instructions that are traced at the console (see Section 15.2, “Debugging Aids” for the exceptions). When the language processor pauses, the following debug actions are available:
  • Entering a null line causes the language processor to continue with the execution until the next pause for debugging input. Repeatedly entering a null line, therefore, steps from pause point to pause point. For TRACE ?A, for example, this is equivalent to single-stepping through the program.
  • Entering an equal sign (=) with no surrounding whitespace causes the language processor to reexecute the clause last traced. For example, if an IF clause is about to take the wrong branch, you can change the value of the variables on which it depends, and then reexecute it.
    Once the clause has been reexecuted, the language processor pauses again.
  • Anything else entered is treated as a line of one or more clauses, and processed immediately (that is, as though DO; line; END; had been inserted in the program). The same rules apply as for the INTERPRET instruction (for example, DO-END constructs must be complete). If an instruction contains a syntax error, a standard message is displayed and you are prompted for input again. Similarly, all other SIGNAL conditions are disabled while the string is processed to prevent unintentional transfer of control.
    During interpretation of the string, no tracing takes place, except that nonzero return codes from commands are displayed. The special variable RC and the environment symbol .RS are not set by commands executed from the string. Once the string has been processed, the language processor pauses again for further debugging input.
Interactive debug is turned off in either of the following cases:
  • A TRACE instruction uses the ? prefix while interactive debug is in effect
  • At any time, if TRACE O or TRACE with no options is entered