Using Breakpoints in MyEclipse
Add breakpoints to your JavaScript and TypeScript code from within the IDE. Use breakpoints to interrupt the execution of your code at a particular location that is not functioning as expected, and then use the debugger tools to locate the problem.
This page details breakpoint functionality in MyEclipse. For details on using breakpoints in CodeMix, see Debugging in CodeMix.
Working with Breakpoints
When a breakpoint is encountered, execution is suspended and the Debug perspective is opened. From the Debug perspective, you can view the code in the editor, the suspended thread in the stack frame, the console output, variables and breakpoints associated with the frame, and the loaded JavaScript files.
Adding a Breakpoint
From the line of code in the source editor, right-click on the marker bar in the left margin and select Toggle Breakpoint. Or, double-click from the left margin to toggle the breakpoint on. The breakpoint is represented by a blue circle in the marker bar and the breakpoint is added to the Breakpoints view.
Removing a Breakpoint
When your remove a breakpoint, the icon is removed from the marker bar and the breakpoint no longer appears in the Breakpoints view.
From the Source Editor—Access the line of code with a breakpoint in the source editor, right-click on the marker bar in the left margin and select Toggle Breakpoint. Or, double-click from the left margin to toggle an active breakpoint off.
From the Breakpoints View—You can also delete a breakpoint from the Breakpoints view. Select the breakpoint, right-click and select Remove; or, click the Remove button .
Tip: Select Remove All to delete all breakpoints in the Breakpoints view or click the Remove All button .
Disabling a Breakpoint
When you need to ignore a breakpoint but want to use it in the future, you can choose to disable the breakpoint instead of removing it. A disabled breakpoint is represented by a hollow circle .
From the Source Editor—Access the line of code with a breakpoint in the source editor, right-click on the marker bar in the left margin and select Disable Breakpoints.
From the Breakpoints View—Clear the check box to the left of the breakpoint or right-click on the breakpoint and select Disable.
Enabling a Breakpoint
When you want to reinstate a previously disabled breakpoint, you can do it from the source editor or the Breakpoints view. When you enable a breakpoint, a blue circle replaces the hollow circle in the marker bar.
From the Source Editor—Access the line of code with a disabled breakpoint in the source editor, right-click on the marker bar in the left margin and select Enable Breakpoints.
From the Breakpoints View—Select the check box to the left of the breakpoint or right-click on the breakpoint and select Enable.
Applying a Hit Count to a Breakpoint
You can edit the properties of a breakpoint to include a hit count that suspends the execution of a thread after it is hit a specified number of times. At that point the breakpoint is disabled until it is enabled again or the hit count is modified.
From the Source Editor
- From the line of code, right-click on the marker bar in the left margin and select Breakpoint Properties.
- Select the Hit count check box.
- Enter a number.
- Click OK.
From the Breakpoints View
- Select the breakpoint.
- Select Hit Count in the bottom of the view.
- Enter a number.
Creating a Conditional Breakpoint
Use conditional breakpoints to suspend execution of a thread when an expression is true or the result changes. When you create a conditional breakpoint, a question mark is added to the icon in the marker bar .
From the Source Editor
- From the line of code, right-click on the marker bar in the left margin and select Breakpoint Properties.
- Select the Conditional check box.
- Select to suspend the execution when true or when the value changes.
- Type the expression in JavaScript in the box.
- Click OK.
- Click on the breakpoint or press Ctrl+S to save your changes.
From the Breakpoints View
- Select the breakpoint.
- Select Conditional in the bottom of the view.
- Select to suspend the execution when true or when the value changes.
- Type the expression in JavaScript in the box at the bottom of the view.
- Click on the breakpoint or press Ctrl+S to save your changes.
Controlling Debugger Execution
After a breakpoint is hit, use the following commands to step through the code and locate any errors.
Command | Button | Details |
Step over (F6) | The current line is executed and execution suspends on the next executable line. | |
Step into (F5) | The next executable expression on the current line is invoked and execution suspends at the next executable line in the method that is invoked. | |
Step Return (F7) | Execution resumes until the next return statement in the current method is executed and execution suspends on the next executable line. | |
Suspend | Suspends the selected thread. | |
Resume | Resumes a suspended thread. | |
Drop to Frame | Enters the selected stack frame. | |
Skip All Breakpoints | Marks all breakpoints in the current view as skipped. |