This is ../../gcc-3.4/gcc/doc/gcc.info, produced by makeinfo version
4.2 from ../../gcc-3.4/gcc/doc/gcc.texi.

Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.

   Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "GNU General Public License" and "Funding Free
Software", the Front-Cover texts being (a) (see below), and with the
Back-Cover Texts being (b) (see below).  A copy of the license is
included in the section entitled "GNU Free Documentation License".

   (a) The FSF's Front-Cover Text is:

   A GNU Manual

   (b) The FSF's Back-Cover Text is:

   You have freedom to copy and modify this GNU Manual, like GNU
software.  Copies published by the Free Software Foundation raise
funds for GNU development.
INFO-DIR-SECTION Programming
START-INFO-DIR-ENTRY
* gcc: (gcc).                  The GNU Compiler Collection.
END-INFO-DIR-ENTRY
   This file documents the use of the GNU compilers.

   Published by the Free Software Foundation
59 Temple Place - Suite 330
Boston, MA 02111-1307 USA

File: gcc.info,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC

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).  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 will probably make 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', `-gdwarf-1+',
     `-gdwarf-1', or `-gvms' (see below).

     Unlike most other C compilers, GCC allows you to use `-g' with
     `-O'.  The shortcuts taken by optimized code may occasionally
     produce surprising results: some variables you declared may not
     exist at all; flow of control may briefly move where you did not
     expect it; some statements may not be executed because they
     compute constant results or their values were already at hand;
     some statements may execute in different places because they were
     moved out of loops.

     Nevertheless it proves possible to debug optimized output.  This
     makes it reasonable to use the optimizer for programs that might
     have bugs.

     The following options are useful when GCC is generated with the
     capability for more than one debugging format.

`-ggdb'
     Produce debugging information for use by GDB.  This means to use
     the most expressive format available (DWARF 2, stabs, or the
     native format if neither of those are supported), including GDB
     extensions if at all possible.

`-gstabs'
     Produce debugging information in stabs format (if that is
     supported), without GDB extensions.  This is the format used by
     DBX on most BSD systems.  On MIPS, Alpha and System V Release 4
     systems this option produces stabs debugging output which is not
     understood by DBX or SDB.  On System V Release 4 systems this
     option requires the GNU assembler.

`-feliminate-unused-debug-symbols'
     Produce debugging information in stabs format (if that is
     supported), for only symbols that are actually used.

`-gstabs+'
     Produce debugging information in stabs format (if that is
     supported), using GNU extensions understood only by the GNU
     debugger (GDB).  The use of these extensions is likely to make
     other debuggers crash or refuse to read the program.

`-gcoff'
     Produce debugging information in COFF format (if that is
     supported).  This is the format used by SDB on most System V
     systems prior to System V Release 4.

`-gxcoff'
     Produce debugging information in XCOFF format (if that is
     supported).  This is the format used by the DBX debugger on IBM
     RS/6000 systems.

`-gxcoff+'
     Produce debugging information in XCOFF format (if that is
     supported), using GNU extensions understood only by the GNU
     debugger (GDB).  The use of these extensions is likely to make
     other debuggers crash or refuse to read the program, and may cause
     assemblers other than the GNU assembler (GAS) to fail with an
     error.

`-gdwarf'
     Produce debugging information in DWARF version 1 format (if that is
     supported).  This is the format used by SDB on most System V
     Release 4 systems.

     This option is deprecated.

`-gdwarf+'
     Produce debugging information in DWARF version 1 format (if that is
     supported), using GNU extensions understood only by the GNU
     debugger (GDB).  The use of these extensions is likely to make
     other debuggers crash or refuse to read the program.

     This option is deprecated.

`-gdwarf-2'
     Produce debugging information in DWARF version 2 format (if that is
     supported).  This is the format used by DBX on IRIX 6.

`-gvms'
     Produce debugging information in VMS debug format (if that is
     supported).  This is the format used by DEBUG on VMS systems.

`-gLEVEL'
`-ggdbLEVEL'
`-gstabsLEVEL'
`-gcoffLEVEL'
`-gxcoffLEVEL'
`-gvmsLEVEL'
     Request debugging information and also use LEVEL to specify how
     much information.  The default level is 2.

     Level 1 produces minimal information, enough for making backtraces
     in parts of the program that you don't plan to debug.  This
     includes descriptions of functions and external variables, but no
     information about local variables and no line numbers.

     Level 3 includes extra information, such as all the macro
     definitions present in the program.  Some debuggers support macro
     expansion when you use `-g3'.

     Note that in order to avoid confusion between DWARF1 debug level 2,
     and DWARF2, neither `-gdwarf' nor `-gdwarf-2' accept a
     concatenated debug level.  Instead use an additional `-gLEVEL'
     option to change the debug level for DWARF1 or DWARF2.

`-feliminate-dwarf2-dups'
     Compress DWARF2 debugging information by eliminating duplicated
     information about each symbol.  This option only makes sense when
     generating DWARF2 debugging information with `-gdwarf-2'.

`-p'
     Generate extra code to write profile information suitable for the
     analysis program `prof'.  You must use this option when compiling
     the source files you want data about, and you must also use it when
     linking.

`-pg'
     Generate extra code to write profile information suitable for the
     analysis program `gprof'.  You must use this option when compiling
     the source files you want data about, and you must also use it when
     linking.

`-Q'
     Makes the compiler print out each function name as it is compiled,
     and print some statistics about each pass when it finishes.

`-ftime-report'
     Makes the compiler print some statistics about the time consumed
     by each pass when it finishes.

`-fmem-report'
     Makes the compiler print some statistics about permanent memory
     allocation when it finishes.

`-fprofile-arcs'
     Add code so that program flow "arcs" are instrumented.  During
     execution the program records how many times each branch and call
     is executed and how many times it is taken or returns.  When the
     compiled program exits it saves this data to a file called
     `AUXNAME.gcda' for each source file. The data may be used for
     profile-directed optimizations (`-fbranch-probabilities'), or for
     test coverage analysis (`-ftest-coverage'). Each object file's
     AUXNAME is generated from the name of the output file, if
     explicitly specified and it is not the final executable, otherwise
     it is the basename of the source file. In both cases any suffix is
     removed (e.g.  `foo.gcda' for input file `dir/foo.c', or
     `dir/foo.gcda' for output file specified as `-o dir/foo.o').

        * Compile the source files with `-fprofile-arcs' plus
          optimization and code generation options. For test coverage
          analysis, use the additional `-ftest-coverage' option. You do
          not need to profile every source file in a program.

        * Link your object files with `-lgcov' or `-fprofile-arcs' (the
          latter implies the former).

        * Run the program on a representative workload to generate the
          arc profile information. This may be repeated any number of
          times. You can run concurrent instances of your program, and
          provided that the file system supports locking, the data
          files will be correctly updated. Also `fork' calls are
          detected and correctly handled (double counting will not
          happen).

        * For profile-directed optimizations, compile the source files
          again with the same optimization and code generation options
          plus `-fbranch-probabilities' (*note Options that Control
          Optimization: Optimize Options.).

        * For test coverage analysis, use `gcov' to produce human
          readable information from the `.gcno' and `.gcda' files.
          Refer to the `gcov' documentation for further information.


     With `-fprofile-arcs', for each function of your program GCC
     creates a program flow graph, then finds a spanning tree for the
     graph.  Only arcs that are not on the spanning tree have to be
     instrumented: the compiler adds code to count the number of times
     that these arcs are executed.  When an arc is the only exit or
     only entrance to a block, the instrumentation code can be added to
     the block; otherwise, a new basic block must be created to hold
     the instrumentation code.

`-ftest-coverage'
     Produce a notes file that the `gcov' code-coverage utility (*note
     `gcov'--a Test Coverage Program: Gcov.) can use to show program
     coverage. Each source file's note file is called `AUXNAME.gcno'.
     Refer to the `-fprofile-arcs' option above for a description of
     AUXNAME and instructions on how to generate test coverage data.
     Coverage data will match the source files more closely, if you do
     not optimize.

`-dLETTERS'
     Says to make debugging dumps during compilation at times specified
     by LETTERS.  This is used for debugging the compiler.  The file
     names for most of the dumps are made by appending a pass number
     and a word to the DUMPNAME. DUMPNAME is generated from the name of
     the output file, if explicitly specified and it is not an
     executable, otherwise it is the basename of the source file. In
     both cases any suffix is removed (e.g.  `foo.00.rtl' or
     `foo.01.sibling').  Here are the possible letters for use in
     LETTERS, and their meanings:

    `A'
          Annotate the assembler output with miscellaneous debugging
          information.

    `b'
          Dump after computing branch probabilities, to `FILE.16.bp'.

    `B'
          Dump after block reordering, to `FILE.32.bbro'.

    `c'
          Dump after instruction combination, to the file
          `FILE.22.combine'.

    `C'
          Dump after the first if conversion, to the file `FILE.17.ce1'.
          Also dump after the second if conversion, to the file
          `FILE.23.ce2'.

    `d'
          Dump after branch target load optimization, to to
          `FILE.34.btl'.  Also dump after delayed branch scheduling, to
          `FILE.37.dbr'.

    `D'
          Dump all macro definitions, at the end of preprocessing, in
          addition to normal output.

    `e'
          Dump after SSA optimizations, to `FILE.05.ssa' and
          `FILE.010.ussa'.

    `E'
          Dump after the second if conversion, to `FILE.33.ce3'.

    `f'
          Dump after control and data flow analysis, to `FILE.15.cfg'.
          Also dump after life analysis, to `FILE.21.life'.

    `F'
          Dump after purging `ADDRESSOF' codes, to `FILE.11.addressof'.

    `g'
          Dump after global register allocation, to `FILE.27.greg'.

    `G'
          Dump after GCSE, to `FILE.12.gcse'.  Also dump after jump
          bypassing and control flow optimizations, to `FILE.14.bypass'.

    `h'
          Dump after finalization of EH handling code, to `FILE.03.eh'.

    `i'
          Dump after sibling call optimizations, to `FILE.02.sibling'.

    `j'
          Dump after the first jump optimization, to `FILE.04.jump'.

    `k'
          Dump after conversion from registers to stack, to
          `FILE.36.stack'.

    `l'
          Dump after local register allocation, to `FILE.26.lreg'.

    `L'
          Dump after loop optimization passes, to `FILE.13.loop' and
          `FILE.19.loop2'.

    `M'
          Dump after performing the machine dependent reorganization
          pass, to `FILE.37.mach'.

    `n'
          Dump after register renumbering, to `FILE.31.rnreg'.

    `N'
          Dump after the register move pass, to `FILE.24.regmove'.

    `o'
          Dump after post-reload optimizations, to `FILE.28.postreload'.

    `r'
          Dump after RTL generation, to `FILE.01.rtl'.

    `R'
          Dump after the second scheduling pass, to `FILE.35.sched2'.

    `s'
          Dump after CSE (including the jump optimization that
          sometimes follows CSE), to `FILE.019.cse'.

    `S'
          Dump after the first scheduling pass, to `FILE.25.sched'.

    `t'
          Dump after the second CSE pass (including the jump
          optimization that sometimes follows CSE), to `FILE.20.cse2'.

    `T'
          Dump after running tracer, to `FILE.18.tracer'.

    `u'
          Dump after null pointer elimination pass to `FILE.018.null'.

    `U'
          Dump callgraph and unit-at-a-time optimization `FILE.00.unit'.

    `w'
          Dump after the second flow pass, to `FILE.29.flow2'.

    `W'
          Dump after SSA conditional constant propagation, to
          `FILE.06.ssaccp'.

    `X'
          Dump after SSA dead code elimination, to `FILE.07.ssadce'.

    `z'
          Dump after the peephole pass, to `FILE.30.peephole2'.

    `a'
          Produce all the dumps listed above.

    `H'
          Produce a core dump whenever an error occurs.

    `m'
          Print statistics on memory usage, at the end of the run, to
          standard error.

    `p'
          Annotate the assembler output with a comment indicating which
          pattern and alternative was used.  The length of each
          instruction is also printed.

    `P'
          Dump the RTL in the assembler output as a comment before each
          instruction.  Also turns on `-dp' annotation.

    `v'
          For each of the other indicated dump files (except for
          `FILE.01.rtl'), dump a representation of the control flow
          graph suitable for viewing with VCG to `FILE.PASS.vcg'.

    `x'
          Just generate RTL for a function instead of compiling it.
          Usually used with `r'.

    `y'
          Dump debugging information during parsing, to standard error.

`-fdump-unnumbered'
     When doing debugging dumps (see `-d' option above), suppress
     instruction numbers and line number note output.  This makes it
     more feasible to use diff on debugging dumps for compiler
     invocations with different options, in particular with and without
     `-g'.

`-fdump-translation-unit (C and C++ only)'
`-fdump-translation-unit-OPTIONS (C and C++ only)'
     Dump a representation of the tree structure for the entire
     translation unit to a file.  The file name is made by appending
     `.tu' to the source file name.  If the `-OPTIONS' form is used,
     OPTIONS controls the details of the dump as described for the
     `-fdump-tree' options.

`-fdump-class-hierarchy (C++ only)'
`-fdump-class-hierarchy-OPTIONS (C++ only)'
     Dump a representation of each class's hierarchy and virtual
     function table layout to a file.  The file name is made by
     appending `.class' to the source file name.  If the `-OPTIONS'
     form is used, OPTIONS controls the details of the dump as
     described for the `-fdump-tree' options.

`-fdump-tree-SWITCH (C++ only)'
`-fdump-tree-SWITCH-OPTIONS (C++ only)'
     Control the dumping at various stages of processing the
     intermediate language tree to a file.  The file name is generated
     by appending a switch specific suffix to the source file name.  If
     the `-OPTIONS' form is used, OPTIONS is a list of `-' separated
     options that control the details of the dump. Not all options are
     applicable to all dumps, those which are not meaningful will be
     ignored. The following options are available

    `address'
          Print the address of each node.  Usually this is not
          meaningful as it changes according to the environment and
          source file. Its primary use is for tying up a dump file with
          a debug environment.

    `slim'
          Inhibit dumping of members of a scope or body of a function
          merely because that scope has been reached. Only dump such
          items when they are directly reachable by some other path.

    `all'
          Turn on all options.

     The following tree dumps are possible:
    `original'
          Dump before any tree based optimization, to `FILE.original'.

    `optimized'
          Dump after all tree based optimization, to `FILE.optimized'.

    `inlined'
          Dump after function inlining, to `FILE.inlined'.

`-frandom-seed=STRING'
     This option provides a seed that GCC uses when it would otherwise
     use random numbers.  It is used to generate certain symbol names
     that have to be different in every compiled file. It is also used
     to place unique stamps in coverage data files and the object files
     that produce them. You can use the `-frandom-seed' option to
     produce reproducibly identical object files.

     The STRING should be different for every file you compile.

`-fsched-verbose=N'
     On targets that use instruction scheduling, this option controls
     the amount of debugging output the scheduler prints.  This
     information is written to standard error, unless `-dS' or `-dR' is
     specified, in which case it is output to the usual dump listing
     file, `.sched' or `.sched2' respectively.  However for N greater
     than nine, the output is always printed to standard error.

     For N greater than zero, `-fsched-verbose' outputs the same
     information as `-dRS'.  For N greater than one, it also output
     basic block probabilities, detailed ready list information and
     unit/insn info.  For N greater than two, it includes RTL at abort
     point, control-flow and regions info.  And for N over four,
     `-fsched-verbose' also includes dependence info.

`-save-temps'
     Store the usual "temporary" intermediate files permanently; place
     them in the current directory and name them based on the source
     file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
     files `foo.i' and `foo.s', as well as `foo.o'.  This creates a
     preprocessed `foo.i' output file even though the compiler now
     normally uses an integrated preprocessor.

`-time'
     Report the CPU time taken by each subprocess in the compilation
     sequence.  For C source files, this is the compiler proper and
     assembler (plus the linker if linking is done).  The output looks
     like this:

          # cc1 0.12 0.01
          # as 0.00 0.01

     The first number on each line is the "user time," that is time
     spent executing the program itself.  The second number is "system
     time," time spent executing operating system routines on behalf of
     the program.  Both numbers are in seconds.

`-print-file-name=LIBRARY'
     Print the full absolute name of the library file LIBRARY that
     would be used when linking--and don't do anything else.  With this
     option, GCC does not compile or link anything; it just prints the
     file name.

`-print-multi-directory'
     Print the directory name corresponding to the multilib selected by
     any other switches present in the command line.  This directory is
     supposed to exist in `GCC_EXEC_PREFIX'.

`-print-multi-lib'
     Print the mapping from multilib directory names to compiler
     switches that enable them.  The directory name is separated from
     the switches by `;', and each switch starts with an `@' instead of
     the `-', without spaces between multiple switches.  This is
     supposed to ease shell-processing.

`-print-prog-name=PROGRAM'
     Like `-print-file-name', but searches for a program such as `cpp'.

`-print-libgcc-file-name'
     Same as `-print-file-name=libgcc.a'.

     This is useful when you use `-nostdlib' or `-nodefaultlibs' but
     you do want to link with `libgcc.a'.  You can do

          gcc -nostdlib FILES... `gcc -print-libgcc-file-name`

`-print-search-dirs'
     Print the name of the configured installation directory and a list
     of program and library directories gcc will search--and don't do
     anything else.

     This is useful when gcc prints the error message `installation
     problem, cannot exec cpp0: No such file or directory'.  To resolve
     this you either need to put `cpp0' and the other compiler
     components where gcc expects to find them, or you can set the
     environment variable `GCC_EXEC_PREFIX' to the directory where you
     installed them.  Don't forget the trailing '/'.  *Note Environment
     Variables::.

`-dumpmachine'
     Print the compiler's target machine (for example,
     `i686-pc-linux-gnu')--and don't do anything else.

`-dumpversion'
     Print the compiler version (for example, `3.0')--and don't do
     anything else.

`-dumpspecs'
     Print the compiler's built-in specs--and don't do anything else.
     (This is used when GCC itself is being built.)  *Note Spec Files::.

`-feliminate-unused-debug-types'
     Normally, when producing DWARF2 output, GCC will emit debugging
     information for all types declared in a compilation unit,
     regardless of whether or not they are actually used in that
     compilation unit.  Sometimes this is useful, such as if, in the
     debugger, you want to cast a value to a type that is not actually
     used in your program (but is declared).  More often, however, this
     results in a significant amount of wasted space.  With this
     option, GCC will avoid producing debug symbol output for types
     that are nowhere used in the source file being compiled.

