Using the Debug Toolbar

The Debug toolbar contains several tools you will employ as you work through this section. By default, this toolbar is attached to the View and Tools toolbars, and appears as a single Visual LISP toolbar.

The Debug toolbar is the left-most set of icons. Most of the items on the toolbar are inactive until you run your program in debugging mode (that is, with one or more breakpoints defined).

If you have not done so already, detach the Debug toolbar from its position at the top of the screen. To do this, grab and drag it by the two vertical grips at the left of the toolbar. You can detach any of the Visual LISP toolbars and position them on your screen where they are most effective for your style of work.

The Debug toolbar is divided into three main groups of buttons, each consisting of three buttons. When you run a program in debugging mode, the toolbar looks like the following:

The last button on the Debug toolbar is a Step Indicator. It does not execute any function but provides a visual indication of where your cursor is positioned as you step through your code. When you are not running in debugging mode, this button appears blank.

To set a breakpoint

  1. In the Visual LISP Editor window containing gpmain.lsp, position your cursor just in front of the opening parenthesis of the setq function of the following line of code, within the gp:getPointInput function:
    (setq HalfWidth (getdist EndPt "\nhalf-width of path: "))
  2. Click the mouse once. The position is illustrated in the following screen snapshot:
  3. With the text insertion point set, choose the Toggle Breakpoint button on the Debug toolbar.

    The Toggle Breakpoint button acts as a toggle, alternating between on and off states. If there is no breakpoint at the cursor position, it sets one; if there is already a breakpoint there, it removes it.

  4. Choose the Load Active Edit Window button on the Tools toolbar to load the file.
  5. Run the (C:GPath) function from the Visual LISP Console prompt.

    Visual LISP executes the program normally up to the breakpoint. In this case, it will prompt you for the first two points—the start point and endpoint of the path.

  6. Specify the start point and endpoint when prompted.

    After you specify the points, Visual LISP suspends execution of the program and returns focus to the text editor window, highlighting the line of code at the breakpoint position:

There are a couple of things to notice: