Go to main content
Oracle® Developer Studio 12.6: Debugging a Program with dbx

Exit Print View

Updated: June 2017
 
 

Compiling With the –g Option

The –g option instructs the compiler to generate debugging information during compilation.

For example, to compile using the C++ compiler:

% CC -g example_source.cc

    For the C++ compiler:

  • The –g option alone, with no optimization level specified, enables capturing debugging information and disables inlining of functions.

  • The –g option used with the –O option or the –xOlevel option turns on debugging information and does not disable inlining of functions. This set of options produces limited debugging information and inlined functions.

  • The –g0 (zero) option turns on debugging information and does not affect inlining of functions. You cannot debug inline functions in code compiled with the –g0 option. The –g0 option can significantly decrease link time and dbx startup time, depending on the use of inlined functions by the program.

To compile optimized code for use with dbx, compile the source code with both the –O (uppercase letter O) and the –g options.