Debugging a core file

If you're running an application in Run mode (without the debugger attached) and the remote process crashes, the IDE gives you the option of downloading the resulting core file to your host and debugging that file. This is the preferred postmortem debugging method because it's convenient and lets you begin debugging a crashed process immediately.

Note: All application binaries—executable and library—on your host must match those on your target so GDB can step through the code. To debug, the host and target must run the same SDP build. Even a minor difference in library binaries prevents the debugger from working correctly.
Your target must be running the dumper utility for a core file to be generated following a crash. The IDE detects the crash based on the program's nonzero exit code and displays a popup window asking whether you want to debug the core file. If you click OK, the IDE:
  1. Downloads the core file from the target to the host's workspace area, into the project root directory.
  2. Creates a C/C++ QNX Remote Core Dump Debugging launch configuration, with a name of remote core binary_name. This new launch configuration, along with the Debug mode and the target on which the process ran, are selected in the launch bar.
  3. Switches to the Debug perspective and launches the debugger with the core file attached. The views in this perspective display the active threads and their stack frames as well as the source code at the crash location. This lets you examine the terminated program's final state. For information on the debugging controls, see Debug perspective controls.

Debugging a locally stored core file

If you obtain a core file from another source (e.g., a customer), you can manually launch the debugger to debug that file:
  1. Copy the file to a convenient workspace location, such as the project root directory. If necessary, refresh the Project Explorer (by clicking the project and pressing F5) to see the copied file.
  2. Double-click the core file to open the Core Info editor, which displays the core dump contents, similar to the coreinfo utility. This editor also contains a Debug button (Icon: Small green bug) at the top that opens the core file in GDB.

    You can also right-click the file, then select Debug As > C/C++ QNX Local Core Dump Debugging.

    Note: In the previous IDE version, you had to right-click the binary executable, choose Debug As > Debug Configurations, then provide the path of the core file in a new debug configuration. This release simplifies the loading of core files but still supports that legacy workflow. If you do use this other workflow, be sure to select C/C++ QNX Core Dump Debugging as the launch configuration type, not C/C++ Postmortem Debugger. This second, Eclipse-based configuration doesn't work for debugging core files produced on QNX-based systems.

At this point, the IDE creates a C/C++ QNX Local Core Dump Debugging launch configuration, with a name of core.binary_name. For this launch configuration type, the IDE uses a special launch target, Local, and Debug mode; the launch bar selections are updated appropriately.