HTBasic Help
×
Menu
Index

Debugging

 

Syntax Errors

Syntax checking occurs as you enter a line of code but the line is not stored in program memory unless there are no errors when you press Enter or cursor off the line. If a syntax error is detected, the line is color-coded red and an error message is displayed on the message line. You can fix the line then or continue entering lines of code and fix them later.
 

Run With Errors

By default syntax errors left in code will not allow the program to run. However, you may want to Run With Errors and you can select this option in the Run Environment menu.
 

Debug Commands

The debug commands described below can all be invoked from either the Debug menu or toolbar, by their shortcut keys, or from a context-sensitive menu revealed by right-clicking in the Edit, Run, or Code Windows.
 

Navigating to Error Lines

 

Breakpoints

Breakpoints provide a "pause" in program execution so that variable values and other parameter changes may be observed after whcich you can press Continue.
 
 
 

Step Functions

 

TRACE

TRACE statements are placed inside your program rather than being invoked as menu/button commands. TRACE displays running program details on the message line and pauses program execution before executing a specific program line. The trace output displays the program line before it is executed and any modified simple variables or array elements and their new values. If a full array is modified then only the array name is displayed. Trace output is also sent to the PRINTALL IS device if PRINTALL is enabled. Tracing slows program execution.
 
 
Examples:
TRACE ALL 1000,1200  ! turns tracing on from line 1000 to line 1200
TRACE PAUSE 250      ! pauses the program before line 250 is executed
 

View Debug Windows

There are six Debug Windows for monitoring variables, subroutines, breakpoints and source code as it executes. To choose which windows you want to view, open the Debug Windows dialog box from the View menu. Debug windows are initially docked at the left of the main window but they can be moved and resized as needed. Double-click on a title bar to return to a previous docked position. Debug windows may be docked to the application, to each other, or remain as floating windows.
 
You can customize the contents of each window by right clicking in it to bring up a context-sensitive menu.
 
The Watch Window shows changes in values of user-defined variables during each step of program execution.
 
Select Add Watch Variable from the Debug menu option to add variables to the Watch Window. Watch variable names can be changed by double-clicking on the name. Watch variable values may be changed by clicking on the value. To remove a variable, select the variable in the Watch Window, then select Remove Watch Variable or Remove All Watch Variables.
 
The Line Breakpoints Window shows the line breakpoint settings as the program is run. You can also add or highlight a breakpoint to enable, disable or remove it from the right-click menu.
 
The Global Breakpoints Window shows the global breakpoint settings as the program is running. You can also add or highlight a breakpoint to enable, disable or remove it from the right-click menu.
 
The CALL Stack Window shows subroutines as they are called.
 
The Code Window shows  the program source code and allows you to modify breakpoints during execution.
 
The Trace Window shows which commands are being executed in a running program (unlike the TRACE statement that only shows one line at a time in the message line before scrolling away). You can clear the Trace Window from the right-click menu.
 

Cross-Reference Listings

XREF (Cross-Reference) generates a cross-reference list of program entities. Select XREF from the View menu to open the XREF dialog box