BackUp LevelNext

Running the Interactive Debugger

Running the debugger helps you find problems in code by tracing the way ColdFusion evaluates the page, step by step. You do this by placing breakpoints in the page to stop execution of the page, and then step through subsequent lines of code, checking the values of variables and expressions to make sure the code is behaving as you'd expect.

After you've set up remote development settings and file mappings, you can use the commands on the Debug menu and the Debug toolbar to run the debugger.

See Chapter 3, ColdFusion Studio Quick Start for a list of keyboard shortcuts for the debugger.

Note

You cannot debug encrypted templates.

To run the interactive debugger:

  1. In ColdFusion Studio, open the first page in the application you want to debug.

    The Debug toolbar appears at the bottom of the application window. You can undock the toolbar by double-clicking on the undock bars on the left-hand side of the toolbar, drop it into the Quick Bar, or keep it docked.

  2. In your ColdFusion application page, set breakpoints in your code by clicking in the gutter on the left side of the editor window.

    The breakpoint lines are colored red. Choose Debug > Toggle Breakpoints to turn breakpoints on and off. Use the Debug > Clear Breakpoints to delete all breakpoints in the current document.

  3. In the Debug toolbar, hit the Start/Continue tool.

    The Remote Development Settings dialog box appears. It shows the default local server.

  4. Specify the Start URL, which is the URL you use to view the page, and click OK. The list box shows the pages currently 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.

    The Debug Start dialog box displays every time you press the Start button in the Debugger. Use the check box on the Debug Start pane to disable the display of this box the next time you hit the RUN button.

    Whenever possible, ColdFusion Studio tries to calculate the URLs of open file using the RDS development mappings, which you can set in the Mappings tab. These mappings are also required to develop on remote servers.

    Based on the RDS Security settings at your site, you'll see a login prompt to access protected resources.

  5. Enter a user name and password if necessary to access remote servers.

    The debugger starts, and it forwards your URL to the Browse view. When the ColdFusion server encounters the breakpoint, a blue bar appears at the breakpoint in the Edit view. At this point, the ColdFusion server has an open session, and it waits for your reply from ColdFusion Studio.

  6. To continue, hit the Start/Continue button again, and the server moves to the next breakpoint.

    The final time you hit the Start/Continue button, ColdFusion executes the page and outputs it to the browser.

  7. To stop the debugging session, hit the End button.

Note

The debugger is active until you hit the End button on the Debug toolbar or choose Debug > End. This allows you to debug across multiple pages.

Debug windows

Choose View > Debug Window to open the Debug window. There are several panes to this window:

Each of these windows has an associated command button on the Debug toolbar.

You can undock these windows individually, so you can see breakpoints while you're looking at the Watches, for example.

Stepping through code

You can use the Step Into, Step Over, Step Out, and Run to Cursor tools on the Debug toolbar to step through your code.

Evaluating expressions and setting watches

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

Watches allow you to evaluate the same expression or variable every time you stop execution. When you set a watch, the debugger evaluates the watched expression. A hand pops up when the expression's value changes from one line to the next as you step through code.

To set watches:

  1. Choose Debug > Watches or click the Watches button on the Debug toolbar. The Watches pane appears.
  2. Cut and paste the expression or variable you want to watch into the list box at the top of the pane.
  3. Choose Evaluate to find the value of the expression at the next breakpoint or line where the Debugger stops.

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

  4. Choose Watch to add the expression in the evaluator list box to the list of watched expressions.

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

  5. Press the Start/Continue button to continue debugging.
  6. When you are finished debugging, press End.

Note

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

Debugging across multiple pages

The debugger is active even after a page is loaded, and until you press the End button on the Debug toolbar or choose Debug > End.

This enables you to debug applications across multiple HTML and CFML pages. For example, you can test the submission of an HTML form and its subsequent processing by a ColdFusion application page.


BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.