Option Type | Default Value | #pragma options | C | C++ |
-flag | - | - | x | x |
Syntax
-g
Purpose
Generates debugging information used by tools such as
the xldb graphical debugger.
Notes
Avoid using this option with -O
(optimization) option. The information produced may be incomplete
or misleading.
If you specify the -g option, the inlining option defaults to -Q! (no functions are inlined).
The default with -g is not to include information about unreferenced symbols in the xldb debugging information.
To include information about both referenced and unreferenced symbols, use the -qdbxextra option with -g.
To specify that source files used with -g are referred to by either their absolute or their relative path name, use -qfullpath.
You can also use the -qlinedebug option to produce abbreviated debugging information in a smaller object size.
Example
To compile myprogram.c to produce an executable program
testing so you can debug it with xldb,
enter:
xlC myprogram.c -o testing -g
To compile myprogram.c to produce an executable program testing_all containing additional information about unreferenced symbols, so you can debug it with xldb, enter:
xlC myprogram.c -o testing_all -g -qdbxextra
List of Compiler Options and Their
Defaults
Options that Specify Debugging Features
-qlinedebug Compiler Option