How to Debug C++ code in Eclipse

Step 1:

Open project:

Step 2:

Set Breakpoints:

To set a breakpoint, select one line of code first, then move mouse to the left most area of that line. either double click or right click then select “Toggle Breakpoint” in the popup list, a small blue ball will appear, that means a breakpoint has been set successfully.

Step 3:

Start the program in debug mode:

Click item “Run” in main menu then select “Debug” in the drop list.


Debug view toolbar options




Resume icon


Select the Resume command to resume execution of the currently suspended debug target.

Suspend icon


Select the Suspend command to halt execution of the currently selected thread in a debug target.

Terminate icon


Ends the selected debug session and/or process. The impact of this action depends on the type of the item selected in the Debug view.

Disconnect icon


Detaches the debugger from the selected process (useful for debugging attached processes).

Step Into icon

Step Into

Select to execute the current line, including any routines, and proceed to the next statement.

Step Over icon

Step Over

Select to execute the current line, following execution inside a routine.

Step Return icon

Step Return

Select to continue execution to the end of the current routine, then follow execution to the routine's caller.