4.4.1 Starting and Resuming Program Execution
There are two commands for starting or resuming program
execution: GO and STEP. The GO command starts execution.
The STEP command lets you execute a specified number of
source lines or instructions.
GO Command
The GO command starts program execution, which continues
until forced to stop. You will probably use the GO command
most often in conjunction with breakpoints, tracepoints, and
watchpoints. If you set a breakpoint in the path of execu-
tion and then enter the GO command (or press the comma
key that executes the GO command), execution will be sus-
pended when the program reaches that breakpoint. If you
set a tracepoint, the path of execution through that tracepoint
will be monitored. If you set a watchpoint, execution will be
suspended when the value of the watched variable changes.
You can also use the GO command to test for an exception
condition or an infinite loop. If an exception condition that
is not handled by your program occurs, the debugger will
take over and display the DBG> prompt so that you can is-
sue commands. If you are using screen mode, the pointer in
the source display will indicate where execution stopped. You
can then use the SHOW CALLS command (see Section 4.4.2)
to identify the currently active routine calls (the call stack).
In the case of an infinite loop, the program will not termi-
nate, so the debugger prompt will not reappear. To obtain the
prompt, interrupt the program by pressing Ctrl/Y and then
issue the DCL command DEBUG. You can then look at the
source display and a SHOW CALLS display to locate the PC.
STEP Command
The STEP command (which you can use either by entering
STEP or by pressing KP0) allows you to execute a specified
number of source lines or instructions, or to execute the pro-
gram to the next instruction of a particular kind, for example,
to the next CALL instruction.
By default, the STEP command executes a single source line
at a time. In the following example, the STEP command ex-
ecutes one line, reports the action (``stepped to . . . ''), and
displays the line number (27) and source code of the next line
to be executed:
DBG> STEP
stepped to TEST\COUNTER\%LINE 27
27: X = X + 1
DBG>
The PC is now at the first machine code instruction for line
27 of the module TEST; line 27 is in COUNTER, a rou-
tine within the module TEST. TEST\COUNTER\%LINE
27 is a directory specification. The debugger uses direc-
tory specifications to refer to symbols. (However, you do not
need to use a path name in referring to a symbol, unless
the symbol is not unique; in that case, the debugger will is-
sue an error message.) See the OpenVMS Debugger Reference
Manual or online help for more information about resolving
multiple-defined symbols.
You can specify a number of lines for the STEP command
to execute. In the following example, the STEP command
executes three lines:
DBG> STEP 3
Note that only those source lines for which code instructions
were generated by the compiler are recognized as executable
lines by the debugger. The debugger skips over any other
lines-for example, comment lines.
Also, if a line has more than one statement on it, the debug-
ger will execute all the statements on that line as part of the
single step.
You can specify different stepping modes, such as stepping by
instruction rather than by line (SET STEP INSTRUCTION).
To resume to the default behavior, enter the SET STEP LINE
command. Also by default, the debugger steps over called
routines-execution is not suspended within a called routine,
although the routine is executed. By entering the SET STEP
INTO command, you tell the debugger to suspend execution
within called routines as well as within the currently execut-
ing module. To resume the default behavior, enter the SET
STEP OVER command.