Using the Visual LISP Debugging Features

In addition to setting breakpoints and running in Animate mode, as described in the Learning by Example section of this chapter, VLISP provides a number of other options for controlling program execution.

Stop Once

Causes VLISP to break unconditionally when it evaluates the very first LISP expression encountered. You turn on this mode of operation by choosing Debug Break on Error from the VLISP menu.

Break on Error

Automatically activates the interactive break loop whenever your program encounters a runtime error. You turn on this mode of operation by choosing Debug Stop Once from the VLISP menu.

Note that if this option is selected, some errors that result from function calls entered at the AutoCAD Command prompt will cause VLISP to get focus. That is, the active window may switch from AutoCAD to the VLISP Console window, where you will be in a break loop.

Break on Function Entry

Sets the Debug-on-Entry flag for a function's name symbol, causing a break to occur every time you invoke that function. At the break, the source code for the function will be shown in a special window. You can set or clear the Debug-on-Entry flag interactively with the Symbol Service dialog box. See Using the Symbol Service Dialog Box for information on setting this flag.

Top-Level Debugging Mode

Controls the loading of a program from a file or an editor window. If the option is set, breaks occur before evaluating every top-level expression (such as defun). The Top-Level debugging mode is turned on by switching off the Do Not Debug Top Level option. To find the check box for this option, choose Tools Environment Options General Options from the VLISP menu, then click the Diagnostic tab.

If Top-Level debugging and Stop Once mode are turned on, VLISP will enter the debugging mode every time you load a file because VLISP is debugging defun, setq, and other functions defined within the file as they are loaded. This is usually not a helpful debugging technique and should only be required in rare instances.