Puts an implicit BREAK
statement after the current statement and after every NSTATEMENTS
subsequent statements, until an ENDDEBUG
is reached.
Options
CHANNEL = scalar |
Channel number; default 1 |
---|---|
NSTATEMENTS = scalar |
Number of statements between breaks; default 1 |
FAULT = string token |
Whether to invoke DEBUG only at the next fault (yes , no ); default no |
No parameters
Description
The straightforward use of DEBUG
causes an immediate break, and then further breaks at regular intervals until you issue an ENDDEBUG
statement. Alternatively, by setting option FAULT=yes
, you can arrange for Genstat to continue until the next fault diagnostic, and then break. The interval before each further break is specified by the NSTATEMENTS
option; by default, breaks take place after every statement.
During the breaks, Genstat takes statements from the channel specified by the CHANNEL
option; by default they are taken from channel 1. Each individual break is terminated by an ENDBREAK
, exactly like a break invoked explicitly by the BREAK
directive.
Options: CHANNEL
, NSTATEMENTS
, FAULT
.
Parameters: none.
See also
Directives: ENDDEBUG
, BREAK
, CALCULATE
.
Commands for: Program control.
Example
" Example DEBU-1: De-bugging a procedure" PROCEDURE 'POLAR' PARAMETER 'X','Y','R','THETA' " Takes (x,y) and returns (r,theta) " CALCULATE R = SQRT(X*X + Y*Y) CALCULATE THETA = ARCCOS(X/R) CALCULATE THETA = THETA + 2*(3.14159 - THETA)*(Y < 0) ENDPROCEDURE " Run thge procedure statement by statement" SCALAR Xpos,Ypos; VALUE=3,4 DEBUG POLAR Xpos; Y=Ypos; R=Radius; THETA=Angle ENDBREAK PRINT R ENDBREAK PRINT THETA ENDBREAK CALCULATE Deg = THETA*180/3.14159 PRINT Deg ENDDEBUG PRINT Xpos,Ypos,Radius,Angle