-g

Category

Error checking and debugging

@PROCESS

DBG

Purpose

Generates debugging information for use by a symbolic debugger, and makes the program state available to the debugging session at selected source locations.

-g is the short form of -qdbg.

Syntax

Read syntax diagramSkip visual syntax diagram-g0-g1-g2
@PROCESS:

@PROCESS DBG | NODBG

Defaults

If -g is not specified, -g0, equivalent to -qnodbg takes effect, which means that the compiler does not generate any debug information or preserve program state.

If -g is specified, the default value is -g2.

Parameters

-g0
Generates no debugging information. No program state is preserved.
-g1
Generates minimal read-only debugging information about line numbers and source file names. No program state is preserved. This option is equivalent to -qlinedebug.
-g2
Generates read-only debugging information about line numbers, source file names, and variables.

Usage

When no optimization is enabled, the debugging information is always available if you specify -g2.
Note: The current release of DBX does not support the debug information generated by IBM® Open XL Fortran for AIX® 17.1.3. A future release of DBX is planned to add this support.

Examples

Use the following command to compile myprogram.f and generate an executable program called testing for debugging:
xlf myprogram.f -o testing -g 
The following command uses a specific -g level with -O2 to compile myprogram.f and generate debugging information:
xlf myprogram.f -O2 -g2 

Related information