In the Navigator view, right-click the project and select Properties.
Debugging lets you examine and troubleshoot your application. When you debug, you can control when the application must stop at specific points in the code. You can also monitor important variables and test your code. Debugging uses a configuration to control how applications are launched. When you debug your application, you run the debug version of the application file.
Before you use the ColdFusion Debugger, ensure that you do the following:
Before you use the Debugger, ensure the following:
In the Navigator view, right-click the project and select Properties.
In the Properties dialog box, select ColdFusion Server Settings.
Under Select Servers, ensure that a server is selected. If no server is selected, select the Servers drop-down list and select an available server, or select Add Server to configure a new server.
In ColdFusion Administrator, select Debugging & Logging > Debugger Settings.
Select Allow Line Debugging.
Specify the port to use for debugging. The default value is 5005.
Specify the maximum number of simultaneous debug sessions. The default value is 5.
Click Submit Changes.
To increase the time after which requests time out, do the following:
Select Server Settings > Settings.
Select Timeout Requests After (Seconds) and enter the required timeout value. For example, 300.
Click Submit Changes.
The debugger server listens for commands from ColdFusion Builder on a separate port than the one specified in step 3. By default, ColdFusion launches the debugger server with a random available port. This could be a problem if ColdFusion (and hence debugger server) is behind a firewall. Because, the firewall blocks the random port that the debugger is listening. To prevent this problem, specify a fixed debugger server port number and allow this port in the firewall. To set a fixed debugger server port number, specify the following JVM argument on the Java And JVM page of the ColdFusion Administrator (or the appropriate place for your J2EE Application Server). Replace portNumber with the port that you want to use:
Restart ColdFusion. If you are running the J2EE configuration of ColdFusion, restart the server in debug mode with the debug port as specified.
If you are not running the server configuration of ColdFusion, specify Java debugging parameters in the configuration file or startup script of the application server you are running. The parameters must look like the following:
Ensure that the port number you specify is the same port number specified on the Debugger Settings page of ColdFusion Administrator.If you are running the server configuration, ColdFusion writes these debugging parameters to the jvm.config file when you use the Debugger Settings page of the ColdFusion Administrator.
If you are not running the server configuration and your application server is not running on JRE 1.6, copy the tools.jar file of the JDK version that your application server is running to the \lib folder of ColdFusion. For example, if you are running JRun that runs on JRE 1.4, copy the tools.jar file of JDK 1.4 to the \lib folder of ColdFusion.
If you are running the server version of ColdFusion and you specify a JRE version other than JRE 1.6 in the jvm.config file, copy the tools.jar file of the JDK version specified in your jvm.config file to the \lib folder of ColdFusion.
Specify debugger settings in ColdFusion Builder
In ColdFusion Builder, select Window > Preferences.
In the tree view, select ColdFusion > Debug Settings.
Specify the home page URL that points to the page that appears in the Debug Output Buffer of the debugger when you click the Home button.
Specify the extensions of the types of files that you can debug and debugger scopes that you want the Debugger to recognize. To improve performance when debugging large files, deselect all scopes for which you do not require information.
Select Break On CFML Runtime Exception to stop the debugger on the line that causes a ColdFusion error.
Select Log An Exception To The Eclipse Error Log to display the server logs in the TailView view instead of showing a warning dialog.
After you enabled the debugger in the ColdFusion Administrator and configured the debugger in ColdFusion Builder, you can debug projects in ColdFusion Builder.
When you debug a project in your application, ColdFusion Builder creates a project-specific launch configuration for the first time that you debug. The launch configuration automatically defines a project name (based on the project that you are debugging), main application file, and the path to debug the application.
Launch configurations are managed through the Create, Manage, and Run Configurations dialog box.
You can edit the default launch configuration that ColdFusion Builder creates.
Select the project to debug in the Navigator view.
You can access the launch configuration in the following ways:
Select the launch configuration to edit in the Debug Configurations dialog box.You can also create a launch configuration or base a new configuration on an existing configuration.
Click the Perspectives link to modify the launch configuration preferences, as required.
Run the application that you want to debug before setting any breakpoints. Running the application before debugging compiles the application and improves performance during debugging.
Select the project to run in the Navigator view.
Select or modify the Run configuration using the Run Configurations dialog box. You can access this dialog box in the following ways:
Select the configuration to run or modify, if necessary.
The application is run in your computer’s default browser. To specify a different external browser, do as follows:
You use breakpoints to control the running of your application so you can inspect your code and debug your application. You add breakpoints in the code editor and then manage them in the Breakpoints view. You can also set breakpoints as you write code or while you debug.
For more information about managing breakpoints using the Breakpoints view, see Breakpoints view.
ColdFusion breakpoints have the following four states in the ColdFusion debugger:
Open the ColdFusion Builder project that contains the code in which you want to set breakpoints.
Locate the line of code where you want to set a breakpoint, and do one of the following:
Select Run > Toggle Breakpoint or Run > Toggle Line Breakpoint.
Toggle Method Breakpoint and Toggle Watchpoint are not supported in ColdFusion Builder.
You can set breakpoints in your CFML file to stop executing the page at particular points. When you set a breakpoint on a line, the CFML stops executing just before that line. For example, if you set a breakpoint on the third line in the following CFML page, execution stops before <cfset myName = "Wilson">.
<cfoutput>Your name is #yourName#.</cfoutput>
A blue dot appears before the line on which you set the breakpoint.
You can also view a list of breakpoints set in the current project in the Breakpoints view of the ColdFusion Builder Debugging perspective.
After setting breakpoints in your code, you can ignore all breakpoints at the time of debugging.
Open the ColdFusion Builder project that contains the code with breakpoints.
In the Breakpoints view toolbar, select Skip All Breakpoints.
In the marker bar along the left-edge of the editor, double-click an existing breakpoint.
The breakpoint is removed from the marker bar and the Breakpoints view of the ColdFusion Builder Debugging perspective.
To remove all the breakpoints in the file, select Run > Remove all Breakpoints from the main toolbar menu.
In the Navigator view, select the project or file to debug.
You can start the debugging session in the following ways:
The Debug launch configuration is automatically created and launched.
If you are debugging a page and then try to browse to or refresh that page, it can result in unexpected behavior in the Debugger.
Use the Debug view to control the debugging of the application, to suspend, resume, or terminate the application, or to step into or over code.
For information about the various views in the ColdFusion Debug perspective, see ColdFusion Debugging perspective.
You can use the Step Into, Step Over, and Step Return buttons to proceed through your CFML application line by line.
For the stepping process to work properly, clear the cache of compiled classes. To do so, recompile all CFML pages compiled with an earlier version of ColdFusion.
In large files, you sometimes find that stepping and breakpoints are slow. To improve performance, do the following:
In ColdFusion Builder, select Windows > Preferences.
In the tree view, select ColdFusion > Debug Settings
Deselect all scopes for which you do not require information.
Use Step Into for UDFs, CFCs, custom tags, and included files. Avoid using Step Into on CFML tags such as the cfset tag. Step Into is more performance intensive than Step Over. When stepping into functions, tags, and files, the file must be displayed in one of the open projects. The file that you are stepping in must be in an open project.
Use Step Over to proceed through your CFML application, bypassing included files, such as UDFs or CFCs.
Use Step Return to return to the original page from which you entered the included file, such as UDFs or CFCs.
As you run CFML code, you can see the values and scope of variables in the Variables view. Only variables whose scopes are what you selected in the Preferences dialog box appear in the Variables view. For more information about using the Variables view, see Variables view.
Watch expressions are useful to watch critical variables that sometimes go out of scope when you step into a different function. You can create your own expressions to watch and evaluate. You can modify the expressions during the debugging session.
You can do the following in the Expressions view:
For more information about using the Expressions view, see Expressions view.
If ColdFusion is running on a remote server, configure a remote server connection and specify a mapping between ColdFusion and ColdFusion Builder. Mapping ensures that ColdFusion Builder and ColdFusion are working on a copy of the same project or file.
In the Server view, right-click the server and select Edit Server. In the Mappings screen of the Server wizard, enter the following mapping details:
Remote Path: Path to the project or folder on the remote ColdFusion server.
You can specify multiple mappings between the remote ColdFusion server and ColdFusion Builder.
For example, if you are editing files in a ColdFusion project that points to D:\MyCoolApp and the corresponding files exist on a remote server at D:\Shared\websites\MyCoolSite. Then, create a mapping by specifying the local path as D:\MyCool App and the remote path as D:\Shared\websites\MyCoolSite.When you deploy the files to the ColdFusion server, you copy them to W:\websites\MyCoolSite\, which the ColdFusion server recognizes as D:\Shared\websites\MyCoolSite. The mapping in ColdFusion Builder specifies that the ColdFusion Builder directory is D:\MyCoolApp and the server is D:\Shared\websites\MyCoolSite. So, ColdFusion Builder translates the file path (D:\MyCoolApp\index.cfm) to a path that the ColdFusion server recognizes (D:\Shared\websites\MyCoolSite\index.cfm). To see more information about the interaction between the client and the server, add the following to the JVM arguments in the ColdFusion Administrator:
In the Navigator view, select the project or file to debug and click in the workbench toolbar.