4.6 Stepping Into BASIC Routines
This section provides details of the STEP/INTO command
that are specific to BASIC.
In the following example, the debugger is waiting to proceed
at source line 63. If you enter a STEP command at this point,
the debugger will proceed to source line 64 without stopping
during the execution of the function call. To step through
the source code in the DEF function deffun , you must use
the STEP/INTO command. A STEP/INTO command en-
tered while the debugger has stopped at source line 63 causes
the debugger to display the source code for extfun and stop
execution at source code line 3.
1 DECLARE LONG FUNCTION deffun (LONG)
2 DECLARE LONG A
3 DEF LONG deffun (LONG x)
4 deffun = x
5 END DEF
.
.
.
->63 A = deffun (6%)
64 Print "The value of A is: "; A
The STEP/INTO command is useful for stepping into exter-
nal functions and DEF functions in DEC BASIC and DEF
functions in VAX BASIC. In DEC BASIC and VAX BASIC, if
you use this command to step into GOSUB blocks, the debug-
ger steps into Run-Time Library (RTL) routines providing
you with not useful information. In VAX BASIC, if you use
this command to step into external functions, the debug-
ger steps into RTL routines, providing you with no useful
information.
In the following program, the debugger has suspended ex-
ecution at source line 8. If you now enter a STEP/INTO
command, the debugger steps into the relevant RTL code and
informs you that no source lines are available.
1 10 RANDOMIZE
.
.
.
->8 GOSUB Print_routine
9 STOP
.
.
.
20 Print_routine:
21 IF Competition = Done
22 THEN PRINT "The winning ticket is #";Winning_ticket
23 ELSE PRINT "The game goes on."
24 END IF
25 RETURN
As in the previous example, a STEP command alone will
cause the debugger to proceed directly to source line 9. In
VAX BASIC, to step through the source code of GOSUB
blocks or external functions, use the SET BREAK command.
The SET BREAK command is described in Section 4.4.3. In
this case, a breakpoint set at the label Print_routine allows
you step through the subroutine beginning at source line 20.
Table 4-1 summarizes the resultant behavior of the STEP
/INTO command when used to step into external func-
tions, DEF functions, and GOSUB blocks in DEC BASIC and
VAX BASIC.