Launching a program with the debugger attached

You can launch a program with the debugger attached to step through the entire code path.

After building the debug variant of the executable, your next task is to create a debug configuration. This type of launch configuration provides the information needed by the IDE to debug your program.
To launch your program with the debugger attached:
  1. In the Project Explorer view, right-click your project and select Debug As > Debug Configurations.
    The Debug Configurations dialog appears.
  2. Create a debug configuration by selecting the appropriate project type in the left pane and clicking the New button ().
  3. Define the basic settings (e.g., name, build configuration) for your new debug configuration, but don't click OK yet.
    For information about these settings, see Creating a launch configuration.
  4. Select the Debugger tab.
  5. Optional: For GDB, select Verbose console mode to see all of the commands sent to GDB and all of the responses returned from GDB.
  6. Optional: Set Use full path to set breakpoints if you have many files with the same name in the project. When file names are identical but their paths are different, setting this option ensures that breakpoints are set for the appropriate file, as expected.
    Note: This feature works only when you use gcc 4.6 or higher and gdb 7.3 or higher.
  7. Click Apply.
  8. Click Debug.
The IDE changes to the Debug perspective.

Debug perspective for HelloWorld project
Figure 1. Default view of Debug perspective for HelloWorld QNX C++ project

If launching a debugging session doesn't work when connected to a target that has qconn, ensure that pdebug is on the target and is located in one of the directories in PATH (typically /usr/bin).

  • For serial debugging on a Windows host, the specification for the serial port has changed. When specifying a device name, you have to set COM1 instead of /dev/com1; otherwise, you'll receive an error similar to the following:
    Debug session is not started - error: 
    Failed Launching Serial Debugger 
    Error initializing: /dev/com1: No such file or directory.

    The device name /dev/com1 is no longer considered a valid name for a device. You must instead set COM1 in the Serial Port option in Debug Configuration dialog.

  • The IDE automatically changes to the Debug perspective when you debug a program. If this default is no longer set, or if you wish to change to a different perspective when you debug, you can change the setting in the Tools tab of the Debug Configuration dialog.
  • The IDE removes terminated debugging sessions from the Debug view when you launch a new session. This frees resources on your host and target systems. You can retain the completed debug sessions by deselecting Remove terminated launches when a new launch is created in the Run/Debug > Launching pane of the Preferences dialog.