8.5. Setting Breakpoints

You can easily create breakpoints in the source editor by double-clicking in the gray column on the left hand side of the editor window. A blue dot will appear in that column, next to the source line. In this context, you may find it useful to add line-numbers to the source view by selecting Window -> Preferences, expanding the node General -> Editors -> Text Editors and selecting “Show line numbers.”

Note that you can create breakpoints before beginning your debug session.

The other primary way to set breakpoints is with the Breakpoint view. In the following, that view is shown below the Debug view.


You can also set breakpoints by right-clicking on the space to the left of the source line and using the resulting contextual menu.


8.6. Troubleshooting

Regardless of the technique used, the debugger may fail to set the breakpoint, complaining that the source cannot be found. In that case you will see something like the following error dialog. (Your specific source file names will be different):


In that case, follow these steps to address the issue.

First, open the launch configuration dialog used to launch the debugger on this code. In the following figure we click on the down-arrow next to the Debug symbol on the icon bar and select “Debug Configurations...” to invoke the dialog box that shows all existing configurations:


Note that you should not click on the project’s launch configuration name directly from the Debug icon bar menu because that will simply launch the debugger with that configuration. We want to edit the configuration here, so we must invoke the configurations dialog.

If multiple launch configurations exist you may need to select the configuration corresponding to your specific project. (In the figures for this example there is only one launch configuration, named “adamain” after the name of the entry point.) With your project selected, click on the “Source” tab located at the top of the dialog so that page will come to the front:


Click the “Add...” button, and in the resulting dialog box, select “Project” as shown in the following figure:


Press OK.

Another dialog box will appear, allowing you to select the specific project to add. Select the project that contains the source file(s) within which you want to set breakpoints:


Press OK.

The specified project will now appear within the launch configuration’s Source Lookup Path:


Press Debug if you want to launch the debugger immediately, or Close if you intend to launch it later.

The above need only be done once per launch configuration, not each time that configuration is used. You can also these steps prior to ever using the launch configuration the first time, but typically these steps will not be necessary.