3.6.5.1 G: Produce Debugging Information Option

The -gformat option instructs the compiler to produce additional information, which can be used by hardware tools to debug your program.

The support formats are tabulated below.

Table 3-15. Supported Debugging File Formats
Format Debugging file format
-glevel Amount of debugging information produced, where level is a value from 0 thru 3.
-gdwarf-3 ELF/DWARF release 3.

By default, the compiler produces DWARF release 2 files. The -glevel form of this option can be used in addition to a -g option that specifies the debugging format.

The compiler supports the use of this option with the optimizers enabled, making it possible to debug optimized code; however, the shortcuts taken by optimized code may occasionally produce surprising results, such as variables that do not exist and flow control that changes unexpectedly.