|
After you enabled the debugger in the ColdFusion Administrator
and configured the debugger in ColdFusion Builder, you can debug
projects in ColdFusion Builder.
Create or edit launch configurationsWhen 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 Run > Debug or Run > Debug Configurations
Select in
the workbench toolbar.
Right-click the project and select Debug As > Debug Configurations.
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 applicationRun 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.
Click Run.
The application is run in your computer’s default browser. To
specify a different external browser, do as follows:
(Windows) Right-click the project and select Properties.
Go to ColdFusion Server Settings, and select a a web browser installed
on your computer.
(Mac) In the Preferences dialog box, select General >
Web Browser, and select a web browser installed on your computer.
Set and remove breakpointsYou 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 breakpointsColdFusion breakpoints have the following four states in
the ColdFusion debugger:
- Enabled and Valid
- This state indicates that the breakpoint is at a valid location. The
breakpoint appears as a solid blue circle in the left margin of
the CFML Editor. Code execution stops when this breakpoint is encountered.
- Unresolved
- ColdFusion sets the breakpoint for the page that is loaded
in its memory. If you modify the page and do not run it, the source
is no longer in sync with the page on the server. In this situation,
ColdFusion sometimes does not know whether the line where you want
to set the breakpoint is valid. A question mark (?) represents this
type of breakpoint.
- Invalid
- If ColdFusion determines that the CFML that you are editing
in ColdFusion Builder is the same as the CFML in its memory, and
that the breakpoint you have set is at an invalid line, the breakpoint
appears as a red X.
- Disabled
- This state indicates that the breakpoint is disabled.
Set a breakpoint in the code editorOpen 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:
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">.
<cfset yourName = "Tuckerman">
<cfoutput>Your name is #yourName#.</cfoutput>
<cfset myName = "Wilson"
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.
Skip all breakpoints in the code editorAfter 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.
Remove a breakpoint in the code editor 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.
Start a debugging sessionIn 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.
Note: 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.
Manage the debugging sessionUse 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.
Run code line by lineYou 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.
Step IntoUse 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.
Step OverUse Step Over to proceed through
your CFML application, bypassing included files, such as UDFs or
CFCs.
Step ReturnUse Step Return to return
to the original page from which you entered the included file, such
as UDFs or CFCs.
Inspect variablesAs 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 expressionsWatch 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:
Create a watch expression by right-clicking and selecting
Add Watch Expression. You can then enter the expression in the Add
Watch Expression dialog box.
Ignore a watch expression that you’ve added by right-clicking
the expression and selecting Disable.
Edit a watch expression by right-clicking the expression
and selecting Edit Watch Expression. You can then modify the expression.
For more information about using the Expressions view, see Expressions view.
|
|
|