Debugging Embedded Basic Subroutines
Global DEBUG options
Three options, set in your operating environment or from within the DataBasic debugger, allow you to specify that DataBasic programs will enter the debugger on encountering a DEBUG statement, or if a warning is generated:
DB.DEBUGCauses any DataBasic program initiated by the user to enter the DataBasic debugger on executing DEBUG statements within the program. This is similar to starting the program with the DEBUG command, but can also be used to debug programs called from PERFORM statements and from Procs.
Programs initiated by the user are those that are started directly or indirectly from TCL. They include those initiated by a Proc or other program that was itself started directly or indirectly from TCL.
EB.DEBUGCauses any DataBasic program run from External Basic to enter the DataBasic debugger on executing DEBUG statements within the program. Programs run from External Basic include Embedded Basic subroutines such as file triggers and dictionary subroutines; you should set EB.DEBUG before starting to debug these types of routine.
Note
To debug a RealWeb subroutine, use the RW.DEBUG program.
FATAL.WARNINGS
Causes all warning messages generated by DataBasic programs to be treated as
fatal errors. Enters the DataBasic debugger to allow determination of error
and possible recovery. Equivalent to starting the program with the F option.
These options can be cleared with the CLEAR-OPTION command or from within the DataBasic debugger.
Debugger commands
The following debugger commands make it possible to debug Embedded Basic subroutines:
@*This command toggles the appropriate global DEBUG option (DB.DEBUG or EB.DEBUG), depending on whether the program being debugged was entered from the TCL prompt or was called from Embedded Basic.
MToggles the option that causes a break whenever a CALL or RETURN statement is encountered; that is, each time your program calls or returns from an external subroutine.
WFToggles the option that treats warning messages as fatal errors. The effect is limited to the currently running program.
WF*Toggles the global FATAL.WARNINGS option.
WSToggles the option that suppresses run-time warning messages (otherwise enabled by running your program with the S option).
Note
These debugger commands also make it easier to debug DataBasic programs called from PERFORM statement and Procs.
Debugger prompt
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.
Embedded Basic subroutines are always at nesting level 1 or above. For example, if a program called from TCL causes a file trigger to run, the trigger will be at nesting level 1. If that trigger then carries out an action that causes a second trigger to run, the second trigger will be at nesting level 2 and the debugger prompt will appear as follows:
{2}*
See Also
Embedded Basic Subroutines
How to Write an Embedded Basic Subroutine
Embedded Basic Examples
How to Associate a Trigger with a File
Triggers Dos and Don'ts