Debugging a Program in the IDE

When you have successfully built your project, you're ready to debug it. Some debugging techniques that you might use include stepping through your code as it executes, stopping your program at various code points when specific conditions are met, and reviewing and changing your data.

The IDE supports the following types of debugging:

The IDE uses the GNU debugger (GDB), by translating each user action into a sequence of GDB commands, then processing the GDB output to show the current state of the program.

Note: The IDE updates the views in the Debug perspective when the program is suspended. But you should avoid editing your source at this time. Doing so causes the line numbering to become inaccurate because the debug information is tied directly to the source.

Target-side debugging utilities (qconn and pdebug)

The qconn utility provides support, such as system profiling information, to the IDE. When you debug your application, you should have qconn running on your target.

CAUTION:
Don't run qconn in a production setting as part of the normal system setup. The qconn utility is insecure because it doesn't validate users and always runs as root, which lets users download and execute arbitrary code on the target. You can use the utility temporarily in a development setting, by accessing the target machine through Telnet or SSH and starting qconn manually. Or, you can secure the traffic using SSH, as explained in "Securing qconn".

The pdebug utility acts as the interface between GDB and the process being debugged. Typically, qconn starts pdebug as needed. This latter utility requires pseudo-terminals (ptys and hence, devc-pty) as well as a command shell (e.g., ksh) to be running on the target system.

To use the Debug perspective, you must use debug variants of executables. For instructions on building these executable variants, see Building an executable for debugging.

Lazy binding

By default, lazy binding—the process by which symbol resolution isn't done until a symbol is used—is disabled (pdebug sets LD_BIND_NOW to 1). You can prevent pdebug from setting LD_BIND_NOW by specifying the -l ("el") option. This way, you'll see a different backtrace for the first function call into the shared object as the runtime linker resolves the symbol. For more information about lazy binding, see the Compiling and Debugging chapter in the QNX Neutrino Programmer's Guide.