|Command||basic.debugger.overview Introductory/BASIC: Debugger
Applicable release versions: AP, R83, AP 6.0 FlashBASIC
|Category||BASIC: Debugger (38)|
|Description||facilitates the debugging of new Pick/BASIC programs and the maintenance of existing Pick/BASIC programs.
The Pick/BASIC debugger has the following general capabilities:
1) Step through execution of program in single or multiple steps. (see the "e" command).
2) Transfer to a specified line number. (see the "g" command)
3) "Break" execution (temporarily halt) at given line numbers or when specified conditions have been satisfied. (see the "b" command)
4) Display or change any variables, including dimensioned variables. (see the "/" command).
5) "Trace" variables. (see the "t" command)
6) Enter the system debugger. (see the "de" and "debug" commands)
7) Direct output to either terminal or printer. (see the "lp" command)
8) Display and/or pop GOSUB stack. (see the "r" command)
9) Display source code lines. (see the "l" and "c" commands)
Note: sys2 privileges are required to use the Pick/BASIC debugger.
When the Pick/BASIC debugger is entered, it indicates the source code line number to be executed next and prompts for commands with an asterisk (*).
When a Pick/BASIC program is compiled, a symbol table is generated, unless the "s" (suppress table) option has been used with the "compile" or "basic" verb. The symbol table is stored as part of the object code and is used by the Pick/BASIC debugger to reference symbolic variables.
If a program calls an external subroutine, and the Pick/BASIC debugger has been entered previously, a complete symbol table is set up for the external subroutine.
Entering the debugger: There are several ways to enter the debugger. Some of them are voluntary. Among the voluntary methods are:
1) Pressing the "break" key while a Pick/BASIC program is executing.
2) Running the program with a "d" option:
run bp enter.customer (d)<return>
If the program is cataloged, a "d" option may follow the program name at TCL:
3) Placing a "debug" statement within the program at the point where the debugger is needed.
4) Running the program with a "e" option, which "breaks" at any "non-fatal" warning message:
run bp enter.customer (e)<return>
If the program is cataloged, an "e" option may follow the program name at TCL:
The other ways of entering the debugger are, of course, involuntarily. This occurs if a runtime error is encountered (unless the "a" (abort) option of the "run" verb is selected), or if an "abort" statement is executed in the program.
The "*" (asterisk) character is used as the Pick/BASIC Debugger prompt character. When it appears in the leftmost column of the terminal display screen, this indicates that the debugger is ready to accept any legal command. The number of "*" characters indicates the current level.
"Breakpoints" may be set in the debugger. A "breakpoint" is a conditional expression constructed with a symbol reference (one of the variables from the program), an operator (like "=" or "#"), and a specific value. For instance: item-id#"" sets up a conditional to break into the debugger when the variable "item-id" is non-null. (see the "b" command)
Break points set up for a subroutine are independent from break points set up in the main program or other subroutines; however, the execution counters "e" and "n" are global. That is, the break point counters count both main program and subroutine break points in the order they are encountered. The use of multiple symbol tables allows the programmer to set up different break points and/or variable traces for different subroutines. (see the "e" and "n" commands)
Operators are used to perform relational comparisons and are used with the "b" command for setting breakpoint conditions. The valid operators are as follows:
= equal to.
> greater than.
< less than.
>= greater than or equal to.
<= less than or equal to.
# not equal to.
Referencing variables : once in the debugger, the current value of any variable may be interrogated (and optionally changed) using the following forms:
This accesses a plain variable and displays its current value.
This access a single-dimensioned array variable. With the subscript designated, only that element is displayed.
If a dimensioned array is referenced without a subsrcipt, each element is displayed. Another <break> while in this mode exits this display without stepping through all the elements.
This accesses a specific location of a two-dimensional array. See the above form for array references without subscripts.
This displays the current assignment of every variable in the program.
In each of the above cases (except the "*" form), the operator is given the opportunity to change the requested value. If a <return> is entered at the "=" prompt, the symbol remains unchanged. Otherwise, any value entered is placed into the symbol.
Zone output specification :
The "zone" command sets left and right output zone limits of debugger display. Both "limit" arguments must be numeric, and it is advised that the second argument be larger than the first. The "["command, followed by a <return>, removes zone limits.