Sun Studio 12 Update 1: Debugging a Program With dbx

Compiling with the -g Option

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

For example, to compile using C++, type:

% CC -g

In C++, the -g option turns on debugging and turns off inlining of functions. The- g0 (zero) option turns on debugging and does not affect inlining of functions. You cannot debug inline functions with the -g0 option. The -g0 option can significantly decrease link time and dbx start-up 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.