Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse C/C++ Developer Guide
Previous Page Home Next Page

Debugging a project

The debugger lets you control the execution of your program by setting breakpoints, suspending executed programs, stepping through your code, and examining the contents of variables.

To debug a project:

  1. Click Run > Debug Configurations....

    The Debug Configurations dialog opens.

  2. Double-click C/C++ Application.
  3. In the Name field, type Hello World.
  4. You can now select this debug launch configuration by name the next time that you debug this project.

  5. In the Project box, type or choose your project, e.g. HelloWorld.
    Your executable should be selected under "C/C++ Application."
    If not, the Search Project button should find the executable in the project.

     

    • If you see the error "[Debugger]: No debugger available", select the Debugger tab and choose a valid debugger for your platform (e.g. gdb/mi).
  6. Click Debug.
  7. You will be prompted to switch to the Debug Perspective. Click Yes

    You will now see the debug perspective with the hello.exe application window open. The C/C++ editor repositions in the perspective.

    • If you see an error in the editor "Can't find source file" you can use the buttons provided to point to your source file, e.g. "Locate File."
  8. In the left margin of the main.cpp window, double-click to set a breakpoint on:
     cout << "You just entered"
    You'll see an icon there indicating the breakpoint is set.
  9. Click Run > Resume.
    Or, you can use the Resume button (green arrow) on the toolbar of the Debug View
  10. When prompted, in the Console view, type a value other than 'm', and hit Enter/Return.
    The breakpoint will be hit.
  11. In the Variables view, verify that the variable is not 'm'.
  12. Click Run > Resume.
  13. When prompted, again type a value other than 'm' in the Console view, and press Enter/Return.
  14. The breakpoint will be hit.

  15. In the Variables view, verify that the variable is not 'm'.
  16. In the Variables view, right-click the input variable, and select Change Value... and type 'm' between the single quotes and hit OK.
  17. Click Run > Resume.
  18. The output in the hello.exe application window is:
     "You just entered m, you need to enter m to exit."

  19. The application terminates and the debug session ends. The debug perspective remains open.

To learn more about debugging, see the related debug conceptual topics.

Back icon Back: Building a project    

Related concepts
Debug overview
Debug information

Related tasks
Debugging

Related reference
Debug view
Debug launch controls
 

QNX Copyright Statement


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire