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 1. Supported Debugging File Formats
Format Debugging file format
-gcoff COFF
-gdwarf-3 ELF/Dwarf release 3
-ginhx32 Intel HEX with extended linear address records, allowing use of addresses beyond 64kB
-ginhx032 INHX32 with initialization of upper address to zero

By default, the compiler produces Dwarf release 3 files.

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.