2.3.8. Generating debug information

This section describes options that enable you to specify whether debug tables are generated for the current compilation and, if they are, specify their format. See Pragmas for more information on controlling debug information.


Optimization criteria can limit the debug information generated by the compiler. See Defining optimization criteria for more information.

Debug table generation options

The following options specify how debug tables are generated:


This option switches on the generation of debug tables for the current compilation. The compiler produces the same code whether -g is used or is not used. The only difference is the existence of debug tables.

Optimization options for debug code are specified by -O. By default, the -g option on its own is equivalent to:

-g -dwarf2 -O0 -gt+p

-g+ is a synonym for -g. It is generated by graphical configurers (the CodeWarrior IDE for example).


This option switches off the generation of debug tables for the current compilation. This is the default option.


This option, when used with -g, switches off the generation of debug table entries for preprocessor macro definitions. This reduces the size of the debug image. -gt-p is a synonym for -gtp.


This option, when used with -g, enables preprocessor information. This is the default option, but some debuggers ignore preprocessor entries.

Debug table format options

The following option specifies the format of the debug tables generated by the compilers:


This option specifies DWARF2 debug table format. This is the default, and is the only available debug table format.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D