Debugging Options

Use the -g option to produce debug information. When you specify -g, the compiler disables optimizations by invoking -O0. Specifying the -g or -O0 option automatically enables the -fp option (IA-32 only). The -fp option disables using the EBP register as general purpose register.

If you specify -g with -O1, -O2, or -O3, then -fp is disabled and allows the compiler to use the EBP register as a general purpose register in optimizations. However, most debuggers expect EBP to be used as a stack frame pointer, and cannot produce a stack backtrace unless this is so.  Using the -fp option can result in slightly less efficient code.

Option(s) Result
-g Debugging information produced, -O0 enabled, -fp enabled for IA-32-targeted compilations.
-g -O1 Debugging information produced, -O1 optimizations enabled, -fp disabled for IA-32-targeted compilations.
-g -O2 Debugging information produced, -O2 optimizations enabled, -fp disabled for IA-32-targeted compilations.
-g -O3 Debugging information produced, -O3 optimizations enabled, -fp disabled for IA-32-targeted compilations.
-g -O3 -fp Debugging information produced, -O3 optimizations enabled, -fp enabled for IA-32-targeted compilations.
-ip Symbols and line numbers produced for debugging.
-ipo Symbols and line numbers produced for debugging.