facebook

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.

cfdebugbreakpointsco

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   ddbreapointicon 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 ddremovebp.  
Tip: Select Remove All to delete all breakpoints in the Breakpoints view or click the Remove All button ddremoveallbp.

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 dddisabledbp.

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 ddbreapointicon 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

  1. From the line of code, right-click on the marker bar in the left margin and select Breakpoint Properties.
  2. Select the Hit count check box.
  3. Enter a number.
  4. Click OK.

From the Breakpoints View

  1. Select the breakpoint.
  2. Select Hit Count in the bottom of the view.
  3. 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 ddconditionalbp

From the Source Editor

  1. From the line of code, right-click on the marker bar in the left margin and select Breakpoint Properties.
  2. Select the Conditional check box.
  3.  Select to suspend the execution when true or when the value changes.
  4. Type the expression in JavaScript in the box.
  5. Click OK.
  6. Click on the breakpoint or press Ctrl+S to save your changes.

From the Breakpoints View

  1. Select the breakpoint.
  2. Select Conditional in the bottom of the view.
  3. Select to suspend the execution when true or when the value changes.
  4.  Type the expression in JavaScript in the box at the bottom of the view.
  5. 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)ddstepoverThe current line is executed and execution suspends on the next executable line.
Step into (F5)ddstepintoThe 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)ddstepreturnExecution resumes until the next return statement in the current method is executed and execution suspends on the next executable line.

Suspend

ddsuspend

Suspends the selected thread.

Resume

ddresume

Resumes a suspended thread.

Drop to Frame

dddroptoframe

Enters the selected stack frame.

Skip All Breakpoints

ddskipallbp

Marks all breakpoints in the current view as skipped.