3.9. Options for Debugging Your Program or GCC
3.9 Options for Debugging Your Program or GCC
GCC has various special options that are used for debugging either your program or GCC:
-g
-
Produce debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2). GDB can work with this debugging information.
On most systems that use stabs format,
-g
enables use of extra debugging information that only GDB can use; this extra information makes debugging work better in GDB but probably makes other debuggers crash or refuse to read the program. If you want to control for certain whether to generate the extra information, use-gstabs+
,-gstabs
,-gxcoff+
,-gxcoff
, or-gvms
(see below).GCC allows you to use
-g
with-O
. The shortcuts taken by optimized code may occasionally produce surprising results: some variabl