You can only enter the DataBasic Debugger if your user-id is assigned a security profile that permits it, as described in Enabling and Disabling the Debugger. If permitted, you can enter the debugger as follows:
Press CTRL+BREAK while the program is executing.
Note: This is only effective if the BREAK function has not been disabled by execution of the BREAK-KEY-OFF or BKOFF command at TCL or by the BREAK {KEY} OFF statement within a program.
Execute a DEBUG statement from within a DataBasic program. You must have done one of the following:
Once you enter the debugger, the system displays a reason code, the program's item-id and the line number about to be executed, and prompts you with an asterisk (*). The * distinguishes the DataBasic debugger from the system debugger and TCL. For example, the following display appears when you press CTRL+BREAK while the TEST program is executing:
:RUN PROGRAM TEST
I TEST 15
*
This display indicates that the program TEST was interrupted and line 15 was about to be executed when you pressed CTRL+BREAK. The debugger prompts you for input of a debugger command.
The following are the reason codes and their meanings:
Code | Reason |
---|---|
A | Abort |
B | Break point |
D | Debug – command or statement |
E | Debugger execution – (single step) |
I | Interrupt (Break) |
M | Modal – (Call / Enter) |
R | Return |
Note: The line number shown is that in the compiled program; that is, that resulting from combining the source item with any included or chained items. To find out the actual source line number, use the L command.
If your program has been called from a PERFORM statement, the debugger prompt shows the level of nesting. This can help you keep track of which of a number of different programs or routines you are currently debugging. It is particularly useful when debugging Embedded Basic subroutines.
For example, if a Proc run from TCL runs a DataBasic program that performs the program you are debugging, the nesting level will be 1 and the debugger prompt will appear as follows:
{1}*
Embedded Basic subroutines are always at nesting level 1 or above. For example, if a program called from TCL causes an Embedded Basic subroutine to run, the subroutine will be at nesting level 1. If that subroutine then carries out an action that causes a second Embedded Basic subroutine to run, the second subroutine will be at nesting level 2.
The debugger displays
the value of undefined variables as <undefined>,
and displays null variables as <null>
.
A symbol table is created by the BASIC command when the program is compiled. The table is appended to the object code item. The symbols can be referenced in the debugger.
You can deactivate (or activate) the DataBasic Debugger on a port-by-port basis using the SSM command at TCL.
You must be logged on the SYSMAN account to use the SSM command. Briefly, the procedure is as follows:
N
disables the Basic debugger and is the default.
Y
enables the
Basic debugger to allow access to the debugger according to your privilege
level and any other restrictions that might apply.