A breakpoint is a condition that invokes the Debugger whenever it is true. A trace variable is a variable that is defined to be printed automatically when a breakpoint is encountered. The mvBASIC Debugger can support up to 4 breakpoints and up to 6 trace variables at a time. Each external subroutine to the program will have its own breakpoint and trace table, independent of the one created for the program.
The B command can be used to define a breakpoint in a program.
Format
Bvar op value [&var op value] |
Parameter(s)
var |
Variable name to be tested. Alternatively, var can be the symbol $, specifying that the line number should be tested. |
|
op |
Operator. One of the following: |
|
= |
equals |
|
# |
not equals |
|
> |
greater than |
|
< |
less than |
|
value |
Value to test the variable by. Can be a numeric value, a string, or another variable in the program. If the value is a string, it must be enclosed in single or double quotes. A backslash is not accepted as a delimiter. |
|
& |
Logical connector for two conditions. |
Description
Although spaces have been supplied above for clarity, spaces are not accepted in the syntax for the B command. If the command is accepted, a plus sign (+) is printed. If the breakpoint table is already full with its maximum of 4 breakpoints, the message TBL FULL will be printed.
To picture a breakpoint condition in mvBASIC language, think of it as being equivalent to entering the following throughout the program:
IF var op expr [AND var op expr] THEN DEBUG END |
For example, to enter the Debugger whenever the variable COUNT is greater than 10 and the variable FOUND has a logical value of false (0), type:
*BCOUNT>10&FOUND=0 |
Line numbers can be tested as well as variables. To specify that a line number is being tested, use a dollar sign ($) in place of a variable name. For example,
*B$>75&$<95 |
causes the program to re-enter the Debugger whenever the program is executing a line between 75 and 95 (exclusively). Conditions comparing line numbers can be combined with conditions comparing variables. For example,
*B$>75&FOUND=0 |
After a breakpoint condition is established with B, the program can continue execution with the G command or with a linefeed (CTRL+J). When a breakpoint condition is encountered, the Debugger is re-entered. The letter B with the breakpoint number and the line number will be printed, along with any trace variables. Trace variables are discussed in a later section.
A breakpoint can be deleted from the breakpoint table with the K command.
Format
K [n] |
Parameter(s)
n |
Delete breakpoint n. If n is omitted, delete all breakpoint conditions. v is determined by its position on the breakpoint table. |
Description
If the command is accepted, a minus sign (–) is printed.
The T command defines a trace variable. Alternatively, it turns the trace table on and off.
Format
T [var] |
Parameter(s)
var |
Trace the variable var. If var is omitted, toggle the trace table on or off. |
Description
If the trace variable is accepted, a plus sign (+) appears. If the trace table is already full with its maximum of 6 variables, the message TBL FULL prints.
If the T command is used without any arguments, it toggles the trace table on and off. If it is turned on, the word ON prints; if it is turned off, the word OFF prints. When the trace table is turned off, trace variables are not printed when a breakpoint is reached.
For example, to print the value of the variable COUNT every time a breakpoint is reached, type:
*TCOUNT |
A variable can be deleted from the trace table with the U command.
Format
U [var] |
Parameter(s)
var |
Delete variable var from the trace table. If var is omitted, all variables are deleted. |
Description
If the command is accepted, a minus sign (–) will be printed.
The breakpoint and trace tables can be displayed with the D command. For example:
*D T1 COUNT T2 CUST.ARRAY(5) T3 T4 T5 T6 B1 COUNT>10&FOUND=0 B2 $>75&FOUND=0 B3 B4 |
In the example, 2 trace variables and 2 breakpoints have been established.
See Also
Debugger Commands: Quick Reference