Using the Interactive Debugger

Running the interactive debugger helps you find problems in code by tracing how ColdFusion evaluates a page, step by step. You place one or more breakpoints in a page to pause its execution, then step through the code, checking the values of variables and expressions as you go, to ensure that t he code executes as you expect.

When you have configured RDS and file mappings, you can use the commands on the Debug menu and the Debug toolbar to run the debugger.

You can undock the Debug toolbar by double-clicking on the undock bars on the left-hand side of the toolbar, or you can drop the toolbar into the QuickBar.

The Debug Start dialog box displays each time you press the Start button in the Debugger. To disable the display of this box , select the option on the check Debug Start pane, the next time you click Run.

Debug breakpoint lines are shaded red. To turn breakpoints on and off, select Debug�> Toggle Breakpoints. To delete all breakpoints in the current document, select Debug�> Clear Breakpoints.

You cannot debug encrypted CFML templates.

About the Debugger toolbar

This toolbar displays by default below the Resources Window tabs, but you can drag it to any other location in the Workspace. The toolbuttons let you quickly start, manage, and complete a debugging session.

Running the Debugger

To run the interactive debugger:

  1. Open an application page.

    The Debug toolbar displays at the bottom of the application window.

  2. In the application page, set one or more breakpoints in your code, by clicking in the gutter on the left side of the editor window.
  3. In the Debug toolbar, click the Start/Continue tool.

    The Remote Development Settings dialog box displays the default local server.

  4. Enter the Start URL, which is the page URL. Click OK.

    The list box displays the pages that are open in ColdFusion Studio.

    Enter a fully qualified file path relative to your local ColdFusion server; for example, http://127.0.0.1/SomeServerPath/index.cfm.

    ColdFusion Studio calculates URLs of open file using the RDS development mappings (which you set in the Mappings tab.) The mappings are also required to develop code on remote servers.

    Based on the RDS Security configuration for your site, a login prompt for accessing protected resources displays.

  5. Enter a user name and password, if necessary.

    The debugger starts. It forwards your URL to the Browse view. When the ColdFusion server encounters a breakpoint, a blue bar displays at the breakpoint in Edit view. ColdFusion Server pauses until you click the Start/Continue button. The server processes the code to the next breakpoint.

    When you click Start/Continue after the last breakpoint, ColdFusion executes the page and outputs it to the browser.

  6. To stop the debugging session, click the End button.

The debugger remains active until you select Debug�> End.

Debug windows

To open the Debug window, elect View > Debug Window. The panes are as follows:
Pane
Purpose
Variables 
Displays all scopes of local variables
Watches 
Lets you set watches and evaluate expressions and variables
Recordsets 
Displays the list of recordsets initialized in the current application page. Tracks CFQUERY-based database recordsets and dynamic recordsets generated programmatically
Output 
Shows the output of a page as it is being generated
Breakpoints 
Shows the breakpoints that you have set in all files. Lets you view, disable, edit conditions, and and remove breakpoints
Tag Stack 
Shows a hierarchy of tag and page attributes and values

Each pane has an associated command button on the Debug toolbar.

You can undock panes individually, so that, for example, you can display Breakpoints while you're displaying Watches.

Debugging across multiple pages

The debugger is active after a page is loaded, until you click End on the Debug toolbar or select Debug > End. This lets you debug applications across multiple HTML and CFML pages. For example, you can test the submittal of an HTML form and its subsequent processing by a ColdFusion application page.

Stepping through code

To execute code in debug mode, you use these tools on the Debug toolbar:

Evaluating an expressions and setting a watch

To evaluate an arbitrary expression, when the debugger is suspended at a breakpoint, you use the evaluator box at the top of the Watches pane in the Debug window. Use the evaluator when you want to know how an expression evaluates as you step through code.

A watch lets you evaluate the same expression or variable each time you stop execution. When you set a watch, the debugger evaluates the watched expression. If the watched expression's value changes, a hand icon displays.

You can use the evaluator to change values of variables, create new variables, or to insert ColdFusion functions in your expressions.

To set a watch:

  1. Select Debug > Watches or click the Watches button on the Debug toolbar. The Watches pane displays.
  2. Cut and paste an expression or variable into the list box at the top of the pane.
  3. To find the value of the expression at the next breakpoint or line where the Debugger stops, select Evaluate.

    The Evaluator window shows the results of the evaluation at the current point in processing.

  4. To add an expression in the evaluator list box to the list of watched expressions, select Watch.

    The Watch area shows the values of watched expressions and any error messages in resolving these parameters.

  5. To continue debugging, click the Start/Continue button.
  6. Click End. Debugging stops.

LiveDocs comments are not longer enabled for ColdFusion 5.0. Please use one of the following resources instead.

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 5.0