• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/gcc/
1<html lang="en">
2<head>
3<title>Debugging Options - Using the GNU Compiler Collection (GCC)</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Using the GNU Compiler Collection (GCC)">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Invoking-GCC.html#Invoking-GCC" title="Invoking GCC">
9<link rel="prev" href="Warning-Options.html#Warning-Options" title="Warning Options">
10<link rel="next" href="Optimize-Options.html#Optimize-Options" title="Optimize Options">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
141998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
152010 Free Software Foundation, Inc.
16
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.3 or
19any later version published by the Free Software Foundation; with the
20Invariant Sections being ``Funding Free Software'', the Front-Cover
21Texts being (a) (see below), and with the Back-Cover Texts being (b)
22(see below).  A copy of the license is included in the section entitled
23``GNU Free Documentation License''.
24
25(a) The FSF's Front-Cover Text is:
26
27     A GNU Manual
28
29(b) The FSF's Back-Cover Text is:
30
31     You have freedom to copy and modify this GNU Manual, like GNU
32     software.  Copies published by the Free Software Foundation raise
33     funds for GNU development.-->
34<meta http-equiv="Content-Style-Type" content="text/css">
35<style type="text/css"><!--
36  pre.display { font-family:inherit }
37  pre.format  { font-family:inherit }
38  pre.smalldisplay { font-family:inherit; font-size:smaller }
39  pre.smallformat  { font-family:inherit; font-size:smaller }
40  pre.smallexample { font-size:smaller }
41  pre.smalllisp    { font-size:smaller }
42  span.sc    { font-variant:small-caps }
43  span.roman { font-family:serif; font-weight:normal; } 
44  span.sansserif { font-family:sans-serif; font-weight:normal; } 
45--></style>
46<link rel="stylesheet" type="text/css" href="../cs.css">
47</head>
48<body>
49<div class="node">
50<a name="Debugging-Options"></a>
51<p>
52Next:&nbsp;<a rel="next" accesskey="n" href="Optimize-Options.html#Optimize-Options">Optimize Options</a>,
53Previous:&nbsp;<a rel="previous" accesskey="p" href="Warning-Options.html#Warning-Options">Warning Options</a>,
54Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking-GCC">Invoking GCC</a>
55<hr>
56</div>
57
58<h3 class="section">3.9 Options for Debugging Your Program or GCC</h3>
59
60<p><a name="index-options_002c-debugging-500"></a><a name="index-debugging-information-options-501"></a>
61GCC has various special options that are used for debugging
62either your program or GCC:
63
64     <dl>
65<dt><code>-g</code><dd><a name="index-g-502"></a>Produce debugging information in the operating system's native format
66(stabs, COFF, XCOFF, or DWARF 2).  GDB can work with this debugging
67information.
68
69     <p>On most systems that use stabs format, <samp><span class="option">-g</span></samp> enables use of extra
70debugging information that only GDB can use; this extra information
71makes debugging work better in GDB but will probably make other debuggers
72crash or
73refuse to read the program.  If you want to control for certain whether
74to generate the extra information, use <samp><span class="option">-gstabs+</span></samp>, <samp><span class="option">-gstabs</span></samp>,
75<samp><span class="option">-gxcoff+</span></samp>, <samp><span class="option">-gxcoff</span></samp>, or <samp><span class="option">-gvms</span></samp> (see below).
76
77     <p>GCC allows you to use <samp><span class="option">-g</span></samp> with
78<samp><span class="option">-O</span></samp>.  The shortcuts taken by optimized code may occasionally
79produce surprising results: some variables you declared may not exist
80at all; flow of control may briefly move where you did not expect it;
81some statements may not be executed because they compute constant
82results or their values were already at hand; some statements may
83execute in different places because they were moved out of loops.
84
85     <p>Nevertheless it proves possible to debug optimized output.  This makes
86it reasonable to use the optimizer for programs that might have bugs.
87
88     <p>The following options are useful when GCC is generated with the
89capability for more than one debugging format.
90
91     <br><dt><code>-ggdb</code><dd><a name="index-ggdb-503"></a>Produce debugging information for use by GDB.  This means to use the
92most expressive format available (DWARF 2, stabs, or the native format
93if neither of those are supported), including GDB extensions if at all
94possible.
95
96     <br><dt><code>-gstabs</code><dd><a name="index-gstabs-504"></a>Produce debugging information in stabs format (if that is supported),
97without GDB extensions.  This is the format used by DBX on most BSD
98systems.  On MIPS, Alpha and System V Release 4 systems this option
99produces stabs debugging output which is not understood by DBX or SDB. 
100On System V Release 4 systems this option requires the GNU assembler.
101
102     <br><dt><code>-feliminate-unused-debug-symbols</code><dd><a name="index-feliminate_002dunused_002ddebug_002dsymbols-505"></a>Produce debugging information in stabs format (if that is supported),
103for only symbols that are actually used.
104
105     <br><dt><code>-femit-class-debug-always</code><dd>Instead of emitting debugging information for a C++ class in only one
106object file, emit it in all object files using the class.  This option
107should be used only with debuggers that are unable to handle the way GCC
108normally emits debugging information for classes because using this
109option will increase the size of debugging information by as much as a
110factor of two.
111
112     <br><dt><code>-gstabs+</code><dd><a name="index-gstabs_002b-506"></a>Produce debugging information in stabs format (if that is supported),
113using GNU extensions understood only by the GNU debugger (GDB).  The
114use of these extensions is likely to make other debuggers crash or
115refuse to read the program.
116
117     <br><dt><code>-gcoff</code><dd><a name="index-gcoff-507"></a>Produce debugging information in COFF format (if that is supported). 
118This is the format used by SDB on most System V systems prior to
119System V Release 4.
120
121     <br><dt><code>-gxcoff</code><dd><a name="index-gxcoff-508"></a>Produce debugging information in XCOFF format (if that is supported). 
122This is the format used by the DBX debugger on IBM RS/6000 systems.
123
124     <br><dt><code>-gxcoff+</code><dd><a name="index-gxcoff_002b-509"></a>Produce debugging information in XCOFF format (if that is supported),
125using GNU extensions understood only by the GNU debugger (GDB).  The
126use of these extensions is likely to make other debuggers crash or
127refuse to read the program, and may cause assemblers other than the GNU
128assembler (GAS) to fail with an error.
129
130     <br><dt><code>-gdwarf-</code><var>version</var><dd><a name="index-gdwarf_002d_0040var_007bversion_007d-510"></a>Produce debugging information in DWARF format (if that is
131supported).  This is the format used by DBX on IRIX 6.  The value
132of <var>version</var> may be either 2, 3 or 4; the default version is 2.
133
134     <p>Note that with DWARF version 2 some ports require, and will always
135use, some non-conflicting DWARF 3 extensions in the unwind tables.
136
137     <p>Version 4 may require GDB 7.0 and <samp><span class="option">-fvar-tracking-assignments</span></samp>
138for maximum benefit.
139
140     <br><dt><code>-gstrict-dwarf</code><dd><a name="index-gstrict_002ddwarf-511"></a>Disallow using extensions of later DWARF standard version than selected
141with <samp><span class="option">-gdwarf-</span><var>version</var></samp>.  On most targets using non-conflicting
142DWARF extensions from later standard versions is allowed.
143
144     <br><dt><code>-gno-strict-dwarf</code><dd><a name="index-gno_002dstrict_002ddwarf-512"></a>Allow using extensions of later DWARF standard version than selected with
145<samp><span class="option">-gdwarf-</span><var>version</var></samp>.
146
147     <br><dt><code>-gvms</code><dd><a name="index-gvms-513"></a>Produce debugging information in VMS debug format (if that is
148supported).  This is the format used by DEBUG on VMS systems.
149
150     <br><dt><code>-g</code><var>level</var><dt><code>-ggdb</code><var>level</var><dt><code>-gstabs</code><var>level</var><dt><code>-gcoff</code><var>level</var><dt><code>-gxcoff</code><var>level</var><dt><code>-gvms</code><var>level</var><dd>Request debugging information and also use <var>level</var> to specify how
151much information.  The default level is 2.
152
153     <p>Level 0 produces no debug information at all.  Thus, <samp><span class="option">-g0</span></samp> negates
154<samp><span class="option">-g</span></samp>.
155
156     <p>Level 1 produces minimal information, enough for making backtraces in
157parts of the program that you don't plan to debug.  This includes
158descriptions of functions and external variables, but no information
159about local variables and no line numbers.
160
161     <p>Level 3 includes extra information, such as all the macro definitions
162present in the program.  Some debuggers support macro expansion when
163you use <samp><span class="option">-g3</span></samp>.
164
165     <p><samp><span class="option">-gdwarf-2</span></samp> does not accept a concatenated debug level, because
166GCC used to support an option <samp><span class="option">-gdwarf</span></samp> that meant to generate
167debug information in version 1 of the DWARF format (which is very
168different from version 2), and it would have been too confusing.  That
169debug format is long obsolete, but the option cannot be changed now. 
170Instead use an additional <samp><span class="option">-g</span><var>level</var></samp> option to change the
171debug level for DWARF.
172
173     <br><dt><code>-gtoggle</code><dd><a name="index-gtoggle-514"></a>Turn off generation of debug info, if leaving out this option would have
174generated it, or turn it on at level 2 otherwise.  The position of this
175argument in the command line does not matter, it takes effect after all
176other options are processed, and it does so only once, no matter how
177many times it is given.  This is mainly intended to be used with
178<samp><span class="option">-fcompare-debug</span></samp>.
179
180     <br><dt><code>-fdump-final-insns</code><span class="roman">[</span><code>=</code><var>file</var><span class="roman">]</span><dd><a name="index-fdump_002dfinal_002dinsns-515"></a>Dump the final internal representation (RTL) to <var>file</var>.  If the
181optional argument is omitted (or if <var>file</var> is <code>.</code>), the name
182of the dump file will be determined by appending <code>.gkd</code> to the
183compilation output file name.
184
185     <br><dt><code>-fcompare-debug</code><span class="roman">[</span><code>=</code><var>opts</var><span class="roman">]</span><dd><a name="index-fcompare_002ddebug-516"></a><a name="index-fno_002dcompare_002ddebug-517"></a>If no error occurs during compilation, run the compiler a second time,
186adding <var>opts</var> and <samp><span class="option">-fcompare-debug-second</span></samp> to the arguments
187passed to the second compilation.  Dump the final internal
188representation in both compilations, and print an error if they differ.
189
190     <p>If the equal sign is omitted, the default <samp><span class="option">-gtoggle</span></samp> is used.
191
192     <p>The environment variable <samp><span class="env">GCC_COMPARE_DEBUG</span></samp>, if defined, non-empty
193and nonzero, implicitly enables <samp><span class="option">-fcompare-debug</span></samp>.  If
194<samp><span class="env">GCC_COMPARE_DEBUG</span></samp> is defined to a string starting with a dash,
195then it is used for <var>opts</var>, otherwise the default <samp><span class="option">-gtoggle</span></samp>
196is used.
197
198     <p><samp><span class="option">-fcompare-debug=</span></samp>, with the equal sign but without <var>opts</var>,
199is equivalent to <samp><span class="option">-fno-compare-debug</span></samp>, which disables the dumping
200of the final representation and the second compilation, preventing even
201<samp><span class="env">GCC_COMPARE_DEBUG</span></samp> from taking effect.
202
203     <p>To verify full coverage during <samp><span class="option">-fcompare-debug</span></samp> testing, set
204<samp><span class="env">GCC_COMPARE_DEBUG</span></samp> to say &lsquo;<samp><span class="samp">-fcompare-debug-not-overridden</span></samp>&rsquo;,
205which GCC will reject as an invalid option in any actual compilation
206(rather than preprocessing, assembly or linking).  To get just a
207warning, setting <samp><span class="env">GCC_COMPARE_DEBUG</span></samp> to &lsquo;<samp><span class="samp">-w%n-fcompare-debug
208not overridden</span></samp>&rsquo; will do.
209
210     <br><dt><code>-fcompare-debug-second</code><dd><a name="index-fcompare_002ddebug_002dsecond-518"></a>This option is implicitly passed to the compiler for the second
211compilation requested by <samp><span class="option">-fcompare-debug</span></samp>, along with options to
212silence warnings, and omitting other options that would cause
213side-effect compiler outputs to files or to the standard output.  Dump
214files and preserved temporary files are renamed so as to contain the
215<code>.gk</code> additional extension during the second compilation, to avoid
216overwriting those generated by the first.
217
218     <p>When this option is passed to the compiler driver, it causes the
219<em>first</em> compilation to be skipped, which makes it useful for little
220other than debugging the compiler proper.
221
222     <br><dt><code>-feliminate-dwarf2-dups</code><dd><a name="index-feliminate_002ddwarf2_002ddups-519"></a>Compress DWARF2 debugging information by eliminating duplicated
223information about each symbol.  This option only makes sense when
224generating DWARF2 debugging information with <samp><span class="option">-gdwarf-2</span></samp>.
225
226     <br><dt><code>-femit-struct-debug-baseonly</code><dd>Emit debug information for struct-like types
227only when the base name of the compilation source file
228matches the base name of file in which the struct was defined.
229
230     <p>This option substantially reduces the size of debugging information,
231but at significant potential loss in type information to the debugger. 
232See <samp><span class="option">-femit-struct-debug-reduced</span></samp> for a less aggressive option. 
233See <samp><span class="option">-femit-struct-debug-detailed</span></samp> for more detailed control.
234
235     <p>This option works only with DWARF 2.
236
237     <br><dt><code>-femit-struct-debug-reduced</code><dd>Emit debug information for struct-like types
238only when the base name of the compilation source file
239matches the base name of file in which the type was defined,
240unless the struct is a template or defined in a system header.
241
242     <p>This option significantly reduces the size of debugging information,
243with some potential loss in type information to the debugger. 
244See <samp><span class="option">-femit-struct-debug-baseonly</span></samp> for a more aggressive option. 
245See <samp><span class="option">-femit-struct-debug-detailed</span></samp> for more detailed control.
246
247     <p>This option works only with DWARF 2.
248
249     <br><dt><code>-femit-struct-debug-detailed</code><span class="roman">[</span><code>=</code><var>spec-list</var><span class="roman">]</span><dd>Specify the struct-like types
250for which the compiler will generate debug information. 
251The intent is to reduce duplicate struct debug information
252between different object files within the same program.
253
254     <p>This option is a detailed version of
255<samp><span class="option">-femit-struct-debug-reduced</span></samp> and <samp><span class="option">-femit-struct-debug-baseonly</span></samp>,
256which will serve for most needs.
257
258     <p>A specification has the syntax<br>
259[&lsquo;<samp><span class="samp">dir:</span></samp>&rsquo;|&lsquo;<samp><span class="samp">ind:</span></samp>&rsquo;][&lsquo;<samp><span class="samp">ord:</span></samp>&rsquo;|&lsquo;<samp><span class="samp">gen:</span></samp>&rsquo;](&lsquo;<samp><span class="samp">any</span></samp>&rsquo;|&lsquo;<samp><span class="samp">sys</span></samp>&rsquo;|&lsquo;<samp><span class="samp">base</span></samp>&rsquo;|&lsquo;<samp><span class="samp">none</span></samp>&rsquo;)
260
261     <p>The optional first word limits the specification to
262structs that are used directly (&lsquo;<samp><span class="samp">dir:</span></samp>&rsquo;) or used indirectly (&lsquo;<samp><span class="samp">ind:</span></samp>&rsquo;). 
263A struct type is used directly when it is the type of a variable, member. 
264Indirect uses arise through pointers to structs. 
265That is, when use of an incomplete struct would be legal, the use is indirect. 
266An example is
267&lsquo;<samp><span class="samp">struct one direct; struct two * indirect;</span></samp>&rsquo;.
268
269     <p>The optional second word limits the specification to
270ordinary structs (&lsquo;<samp><span class="samp">ord:</span></samp>&rsquo;) or generic structs (&lsquo;<samp><span class="samp">gen:</span></samp>&rsquo;). 
271Generic structs are a bit complicated to explain. 
272For C++, these are non-explicit specializations of template classes,
273or non-template classes within the above. 
274Other programming languages have generics,
275but &lsquo;<samp><span class="samp">-femit-struct-debug-detailed</span></samp>&rsquo; does not yet implement them.
276
277     <p>The third word specifies the source files for those
278structs for which the compiler will emit debug information. 
279The values &lsquo;<samp><span class="samp">none</span></samp>&rsquo; and &lsquo;<samp><span class="samp">any</span></samp>&rsquo; have the normal meaning. 
280The value &lsquo;<samp><span class="samp">base</span></samp>&rsquo; means that
281the base of name of the file in which the type declaration appears
282must match the base of the name of the main compilation file. 
283In practice, this means that
284types declared in <samp><span class="file">foo.c</span></samp> and <samp><span class="file">foo.h</span></samp> will have debug information,
285but types declared in other header will not. 
286The value &lsquo;<samp><span class="samp">sys</span></samp>&rsquo; means those types satisfying &lsquo;<samp><span class="samp">base</span></samp>&rsquo;
287or declared in system or compiler headers.
288
289     <p>You may need to experiment to determine the best settings for your application.
290
291     <p>The default is &lsquo;<samp><span class="samp">-femit-struct-debug-detailed=all</span></samp>&rsquo;.
292
293     <p>This option works only with DWARF 2.
294
295     <br><dt><code>-fenable-icf-debug</code><dd><a name="index-fenable_002dicf_002ddebug-520"></a>Generate additional debug information to support identical code folding (ICF). 
296This option only works with DWARF version 2 or higher.
297
298     <br><dt><code>-fno-merge-debug-strings</code><dd><a name="index-fmerge_002ddebug_002dstrings-521"></a><a name="index-fno_002dmerge_002ddebug_002dstrings-522"></a>Direct the linker to not merge together strings in the debugging
299information which are identical in different object files.  Merging is
300not supported by all assemblers or linkers.  Merging decreases the size
301of the debug information in the output file at the cost of increasing
302link processing time.  Merging is enabled by default.
303
304     <br><dt><code>-fdebug-prefix-map=</code><var>old</var><code>=</code><var>new</var><dd><a name="index-fdebug_002dprefix_002dmap-523"></a>When compiling files in directory <samp><var>old</var></samp>, record debugging
305information describing them as in <samp><var>new</var></samp> instead.
306
307     <br><dt><code>-fno-dwarf2-cfi-asm</code><dd><a name="index-fdwarf2_002dcfi_002dasm-524"></a><a name="index-fno_002ddwarf2_002dcfi_002dasm-525"></a>Emit DWARF 2 unwind info as compiler generated <code>.eh_frame</code> section
308instead of using GAS <code>.cfi_*</code> directives.
309
310     <p><a name="index-g_t_0040command_007bprof_007d-526"></a><br><dt><code>-p</code><dd><a name="index-p-527"></a>Generate extra code to write profile information suitable for the
311analysis program <samp><span class="command">prof</span></samp>.  You must use this option when compiling
312the source files you want data about, and you must also use it when
313linking.
314
315     <p><a name="index-g_t_0040command_007bgprof_007d-528"></a><br><dt><code>-pg</code><dd><a name="index-pg-529"></a>Generate extra code to write profile information suitable for the
316analysis program <samp><span class="command">gprof</span></samp>.  You must use this option when compiling
317the source files you want data about, and you must also use it when
318linking.
319
320     <br><dt><code>-Q</code><dd><a name="index-Q-530"></a>Makes the compiler print out each function name as it is compiled, and
321print some statistics about each pass when it finishes.
322
323     <br><dt><code>-ftime-report</code><dd><a name="index-ftime_002dreport-531"></a>Makes the compiler print some statistics about the time consumed by each
324pass when it finishes.
325
326     <br><dt><code>-fmem-report</code><dd><a name="index-fmem_002dreport-532"></a>Makes the compiler print some statistics about permanent memory
327allocation when it finishes.
328
329     <br><dt><code>-fpre-ipa-mem-report</code><dd><a name="index-fpre_002dipa_002dmem_002dreport-533"></a><br><dt><code>-fpost-ipa-mem-report</code><dd><a name="index-fpost_002dipa_002dmem_002dreport-534"></a>Makes the compiler print some statistics about permanent memory
330allocation before or after interprocedural optimization.
331
332     <br><dt><code>-fstack-usage</code><dd><a name="index-fstack_002dusage-535"></a>Makes the compiler output stack usage information for the program, on a
333per-function basis.  The filename for the dump is made by appending
334<samp><span class="file">.su</span></samp> to the <var>auxname</var>.  <var>auxname</var> is generated from the name of
335the output file, if explicitly specified and it is not an executable,
336otherwise it is the basename of the source file.  An entry is made up
337of three fields:
338
339          <ul>
340<li>The name of the function. 
341<li>A number of bytes. 
342<li>One or more qualifiers: <code>static</code>, <code>dynamic</code>, <code>bounded</code>. 
343</ul>
344
345     <p>The qualifier <code>static</code> means that the function manipulates the stack
346statically: a fixed number of bytes are allocated for the frame on function
347entry and released on function exit; no stack adjustments are otherwise made
348in the function.  The second field is this fixed number of bytes.
349
350     <p>The qualifier <code>dynamic</code> means that the function manipulates the stack
351dynamically: in addition to the static allocation described above, stack
352adjustments are made in the body of the function, for example to push/pop
353arguments around function calls.  If the qualifier <code>bounded</code> is also
354present, the amount of these adjustments is bounded at compile-time and
355the second field is an upper bound of the total amount of stack used by
356the function.  If it is not present, the amount of these adjustments is
357not bounded at compile-time and the second field only represents the
358bounded part.
359
360     <br><dt><code>-fprofile-arcs</code><dd><a name="index-fprofile_002darcs-536"></a>Add code so that program flow <dfn>arcs</dfn> are instrumented.  During
361execution the program records how many times each branch and call is
362executed and how many times it is taken or returns.  When the compiled
363program exits it saves this data to a file called
364<samp><var>auxname</var><span class="file">.gcda</span></samp> for each source file.  The data may be used for
365profile-directed optimizations (<samp><span class="option">-fbranch-probabilities</span></samp>), or for
366test coverage analysis (<samp><span class="option">-ftest-coverage</span></samp>).  Each object file's
367<var>auxname</var> is generated from the name of the output file, if
368explicitly specified and it is not the final executable, otherwise it is
369the basename of the source file.  In both cases any suffix is removed
370(e.g. <samp><span class="file">foo.gcda</span></samp> for input file <samp><span class="file">dir/foo.c</span></samp>, or
371<samp><span class="file">dir/foo.gcda</span></samp> for output file specified as <samp><span class="option">-o dir/foo.o</span></samp>). 
372See <a href="Cross_002dprofiling.html#Cross_002dprofiling">Cross-profiling</a>.
373
374     <p><a name="index-g_t_0040command_007bgcov_007d-537"></a><br><dt><code>--coverage</code><dd><a name="index-coverage-538"></a>
375This option is used to compile and link code instrumented for coverage
376analysis.  The option is a synonym for <samp><span class="option">-fprofile-arcs</span></samp>
377<samp><span class="option">-ftest-coverage</span></samp> (when compiling) and <samp><span class="option">-lgcov</span></samp> (when
378linking).  See the documentation for those options for more details.
379
380          <ul>
381<li>Compile the source files with <samp><span class="option">-fprofile-arcs</span></samp> plus optimization
382and code generation options.  For test coverage analysis, use the
383additional <samp><span class="option">-ftest-coverage</span></samp> option.  You do not need to profile
384every source file in a program.
385
386          <li>Link your object files with <samp><span class="option">-lgcov</span></samp> or <samp><span class="option">-fprofile-arcs</span></samp>
387(the latter implies the former).
388
389          <li>Run the program on a representative workload to generate the arc profile
390information.  This may be repeated any number of times.  You can run
391concurrent instances of your program, and provided that the file system
392supports locking, the data files will be correctly updated.  Also
393<code>fork</code> calls are detected and correctly handled (double counting
394will not happen).
395
396          <li>For profile-directed optimizations, compile the source files again with
397the same optimization and code generation options plus
398<samp><span class="option">-fbranch-probabilities</span></samp> (see <a href="Optimize-Options.html#Optimize-Options">Options that Control Optimization</a>).
399
400          <li>For test coverage analysis, use <samp><span class="command">gcov</span></samp> to produce human readable
401information from the <samp><span class="file">.gcno</span></samp> and <samp><span class="file">.gcda</span></samp> files.  Refer to the
402<samp><span class="command">gcov</span></samp> documentation for further information.
403
404     </ul>
405
406     <p>With <samp><span class="option">-fprofile-arcs</span></samp>, for each function of your program GCC
407creates a program flow graph, then finds a spanning tree for the graph. 
408Only arcs that are not on the spanning tree have to be instrumented: the
409compiler adds code to count the number of times that these arcs are
410executed.  When an arc is the only exit or only entrance to a block, the
411instrumentation code can be added to the block; otherwise, a new basic
412block must be created to hold the instrumentation code.
413
414     <br><dt><code>-ftest-coverage</code><dd><a name="index-ftest_002dcoverage-539"></a>Produce a notes file that the <samp><span class="command">gcov</span></samp> code-coverage utility
415(see <a href="Gcov.html#Gcov"><samp><span class="command">gcov</span></samp>&mdash;a Test Coverage Program</a>) can use to
416show program coverage.  Each source file's note file is called
417<samp><var>auxname</var><span class="file">.gcno</span></samp>.  Refer to the <samp><span class="option">-fprofile-arcs</span></samp> option
418above for a description of <var>auxname</var> and instructions on how to
419generate test coverage data.  Coverage data will match the source files
420more closely, if you do not optimize.
421
422     <br><dt><code>-fdbg-cnt-list</code><dd><a name="index-fdbg_002dcnt_002dlist-540"></a>Print the name and the counter upper bound for all debug counters.
423
424     <br><dt><code>-fdbg-cnt=</code><var>counter-value-list</var><dd><a name="index-fdbg_002dcnt-541"></a>Set the internal debug counter upper bound.  <var>counter-value-list</var>
425is a comma-separated list of <var>name</var>:<var>value</var> pairs
426which sets the upper bound of each debug counter <var>name</var> to <var>value</var>. 
427All debug counters have the initial upper bound of <var>UINT_MAX</var>,
428thus dbg_cnt() returns true always unless the upper bound is set by this option. 
429e.g. With -fdbg-cnt=dce:10,tail_call:0
430dbg_cnt(dce) will return true only for first 10 invocations
431and dbg_cnt(tail_call) will return false always.
432
433     <br><dt><code>-d</code><var>letters</var><dt><code>-fdump-rtl-</code><var>pass</var><dd><a name="index-d-542"></a>Says to make debugging dumps during compilation at times specified by
434<var>letters</var>.  This is used for debugging the RTL-based passes of the
435compiler.  The file names for most of the dumps are made by appending
436a pass number and a word to the <var>dumpname</var>, and the files are
437created in the directory of the output file.  Note that the pass
438number is computed statically as passes get registered into the pass
439manager.  Thus the numbering is not related to the dynamic order of
440execution of passes.  In particular, a pass installed by a plugin
441could have a number over 200 even if it executed quite early. 
442<var>dumpname</var> is generated from the name of the output file, if
443explicitly specified and it is not an executable, otherwise it is the
444basename of the source file. These switches may have different effects
445when <samp><span class="option">-E</span></samp> is used for preprocessing.
446
447     <p>Debug dumps can be enabled with a <samp><span class="option">-fdump-rtl</span></samp> switch or some
448<samp><span class="option">-d</span></samp> option <var>letters</var>.  Here are the possible
449letters for use in <var>pass</var> and <var>letters</var>, and their meanings:
450
451          <dl>
452<dt><code>-fdump-rtl-alignments</code><dd><a name="index-fdump_002drtl_002dalignments-543"></a>Dump after branch alignments have been computed.
453
454          <br><dt><code>-fdump-rtl-asmcons</code><dd><a name="index-fdump_002drtl_002dasmcons-544"></a>Dump after fixing rtl statements that have unsatisfied in/out constraints.
455
456          <br><dt><code>-fdump-rtl-auto_inc_dec</code><dd><a name="index-fdump_002drtl_002dauto_005finc_005fdec-545"></a>Dump after auto-inc-dec discovery.  This pass is only run on
457architectures that have auto inc or auto dec instructions.
458
459          <br><dt><code>-fdump-rtl-barriers</code><dd><a name="index-fdump_002drtl_002dbarriers-546"></a>Dump after cleaning up the barrier instructions.
460
461          <br><dt><code>-fdump-rtl-bbpart</code><dd><a name="index-fdump_002drtl_002dbbpart-547"></a>Dump after partitioning hot and cold basic blocks.
462
463          <br><dt><code>-fdump-rtl-bbro</code><dd><a name="index-fdump_002drtl_002dbbro-548"></a>Dump after block reordering.
464
465          <br><dt><code>-fdump-rtl-btl1</code><dt><code>-fdump-rtl-btl2</code><dd><a name="index-fdump_002drtl_002dbtl2-549"></a><a name="index-fdump_002drtl_002dbtl2-550"></a><samp><span class="option">-fdump-rtl-btl1</span></samp> and <samp><span class="option">-fdump-rtl-btl2</span></samp> enable dumping
466after the two branch
467target load optimization passes.
468
469          <br><dt><code>-fdump-rtl-bypass</code><dd><a name="index-fdump_002drtl_002dbypass-551"></a>Dump after jump bypassing and control flow optimizations.
470
471          <br><dt><code>-fdump-rtl-combine</code><dd><a name="index-fdump_002drtl_002dcombine-552"></a>Dump after the RTL instruction combination pass.
472
473          <br><dt><code>-fdump-rtl-compgotos</code><dd><a name="index-fdump_002drtl_002dcompgotos-553"></a>Dump after duplicating the computed gotos.
474
475          <br><dt><code>-fdump-rtl-ce1</code><dt><code>-fdump-rtl-ce2</code><dt><code>-fdump-rtl-ce3</code><dd><a name="index-fdump_002drtl_002dce1-554"></a><a name="index-fdump_002drtl_002dce2-555"></a><a name="index-fdump_002drtl_002dce3-556"></a><samp><span class="option">-fdump-rtl-ce1</span></samp>, <samp><span class="option">-fdump-rtl-ce2</span></samp>, and
476<samp><span class="option">-fdump-rtl-ce3</span></samp> enable dumping after the three
477if conversion passes.
478
479          <dt><code>-fdump-rtl-cprop_hardreg</code><dd><a name="index-fdump_002drtl_002dcprop_005fhardreg-557"></a>Dump after hard register copy propagation.
480
481          <dt><code>-fdump-rtl-csa</code><dd><a name="index-fdump_002drtl_002dcsa-558"></a>Dump after combining stack adjustments.
482
483          <br><dt><code>-fdump-rtl-cse1</code><dt><code>-fdump-rtl-cse2</code><dd><a name="index-fdump_002drtl_002dcse1-559"></a><a name="index-fdump_002drtl_002dcse2-560"></a><samp><span class="option">-fdump-rtl-cse1</span></samp> and <samp><span class="option">-fdump-rtl-cse2</span></samp> enable dumping after
484the two common sub-expression elimination passes.
485
486          <dt><code>-fdump-rtl-dce</code><dd><a name="index-fdump_002drtl_002ddce-561"></a>Dump after the standalone dead code elimination passes.
487
488          <dt><code>-fdump-rtl-dbr</code><dd><a name="index-fdump_002drtl_002ddbr-562"></a>Dump after delayed branch scheduling.
489
490          <br><dt><code>-fdump-rtl-dce1</code><dt><code>-fdump-rtl-dce2</code><dd><a name="index-fdump_002drtl_002ddce1-563"></a><a name="index-fdump_002drtl_002ddce2-564"></a><samp><span class="option">-fdump-rtl-dce1</span></samp> and <samp><span class="option">-fdump-rtl-dce2</span></samp> enable dumping after
491the two dead store elimination passes.
492
493          <br><dt><code>-fdump-rtl-eh</code><dd><a name="index-fdump_002drtl_002deh-565"></a>Dump after finalization of EH handling code.
494
495          <br><dt><code>-fdump-rtl-eh_ranges</code><dd><a name="index-fdump_002drtl_002deh_005franges-566"></a>Dump after conversion of EH handling range regions.
496
497          <br><dt><code>-fdump-rtl-expand</code><dd><a name="index-fdump_002drtl_002dexpand-567"></a>Dump after RTL generation.
498
499          <br><dt><code>-fdump-rtl-fwprop1</code><dt><code>-fdump-rtl-fwprop2</code><dd><a name="index-fdump_002drtl_002dfwprop1-568"></a><a name="index-fdump_002drtl_002dfwprop2-569"></a><samp><span class="option">-fdump-rtl-fwprop1</span></samp> and <samp><span class="option">-fdump-rtl-fwprop2</span></samp> enable
500dumping after the two forward propagation passes.
501
502          <br><dt><code>-fdump-rtl-gcse1</code><dt><code>-fdump-rtl-gcse2</code><dd><a name="index-fdump_002drtl_002dgcse1-570"></a><a name="index-fdump_002drtl_002dgcse2-571"></a><samp><span class="option">-fdump-rtl-gcse1</span></samp> and <samp><span class="option">-fdump-rtl-gcse2</span></samp> enable dumping
503after global common subexpression elimination.
504
505          <br><dt><code>-fdump-rtl-init-regs</code><dd><a name="index-fdump_002drtl_002dinit_002dregs-572"></a>Dump after the initialization of the registers.
506
507          <br><dt><code>-fdump-rtl-initvals</code><dd><a name="index-fdump_002drtl_002dinitvals-573"></a>Dump after the computation of the initial value sets.
508
509          <dt><code>-fdump-rtl-into_cfglayout</code><dd><a name="index-fdump_002drtl_002dinto_005fcfglayout-574"></a>Dump after converting to cfglayout mode.
510
511          <br><dt><code>-fdump-rtl-ira</code><dd><a name="index-fdump_002drtl_002dira-575"></a>Dump after iterated register allocation.
512
513          <br><dt><code>-fdump-rtl-jump</code><dd><a name="index-fdump_002drtl_002djump-576"></a>Dump after the second jump optimization.
514
515          <br><dt><code>-fdump-rtl-loop2</code><dd><a name="index-fdump_002drtl_002dloop2-577"></a><samp><span class="option">-fdump-rtl-loop2</span></samp> enables dumping after the rtl
516loop optimization passes.
517
518          <br><dt><code>-fdump-rtl-mach</code><dd><a name="index-fdump_002drtl_002dmach-578"></a>Dump after performing the machine dependent reorganization pass, if that
519pass exists.
520
521          <br><dt><code>-fdump-rtl-mode_sw</code><dd><a name="index-fdump_002drtl_002dmode_005fsw-579"></a>Dump after removing redundant mode switches.
522
523          <br><dt><code>-fdump-rtl-rnreg</code><dd><a name="index-fdump_002drtl_002drnreg-580"></a>Dump after register renumbering.
524
525          <dt><code>-fdump-rtl-outof_cfglayout</code><dd><a name="index-fdump_002drtl_002doutof_005fcfglayout-581"></a>Dump after converting from cfglayout mode.
526
527          <br><dt><code>-fdump-rtl-peephole2</code><dd><a name="index-fdump_002drtl_002dpeephole2-582"></a>Dump after the peephole pass.
528
529          <br><dt><code>-fdump-rtl-postreload</code><dd><a name="index-fdump_002drtl_002dpostreload-583"></a>Dump after post-reload optimizations.
530
531          <dt><code>-fdump-rtl-pro_and_epilogue</code><dd><a name="index-fdump_002drtl_002dpro_005fand_005fepilogue-584"></a>Dump after generating the function pro and epilogues.
532
533          <br><dt><code>-fdump-rtl-regmove</code><dd><a name="index-fdump_002drtl_002dregmove-585"></a>Dump after the register move pass.
534
535          <br><dt><code>-fdump-rtl-sched1</code><dt><code>-fdump-rtl-sched2</code><dd><a name="index-fdump_002drtl_002dsched1-586"></a><a name="index-fdump_002drtl_002dsched2-587"></a><samp><span class="option">-fdump-rtl-sched1</span></samp> and <samp><span class="option">-fdump-rtl-sched2</span></samp> enable dumping
536after the basic block scheduling passes.
537
538          <br><dt><code>-fdump-rtl-see</code><dd><a name="index-fdump_002drtl_002dsee-588"></a>Dump after sign extension elimination.
539
540          <br><dt><code>-fdump-rtl-seqabstr</code><dd><a name="index-fdump_002drtl_002dseqabstr-589"></a>Dump after common sequence discovery.
541
542          <br><dt><code>-fdump-rtl-shorten</code><dd><a name="index-fdump_002drtl_002dshorten-590"></a>Dump after shortening branches.
543
544          <br><dt><code>-fdump-rtl-sibling</code><dd><a name="index-fdump_002drtl_002dsibling-591"></a>Dump after sibling call optimizations.
545
546          <br><dt><code>-fdump-rtl-split1</code><dt><code>-fdump-rtl-split2</code><dt><code>-fdump-rtl-split3</code><dt><code>-fdump-rtl-split4</code><dt><code>-fdump-rtl-split5</code><dd><a name="index-fdump_002drtl_002dsplit1-592"></a><a name="index-fdump_002drtl_002dsplit2-593"></a><a name="index-fdump_002drtl_002dsplit3-594"></a><a name="index-fdump_002drtl_002dsplit4-595"></a><a name="index-fdump_002drtl_002dsplit5-596"></a><samp><span class="option">-fdump-rtl-split1</span></samp>, <samp><span class="option">-fdump-rtl-split2</span></samp>,
547<samp><span class="option">-fdump-rtl-split3</span></samp>, <samp><span class="option">-fdump-rtl-split4</span></samp> and
548<samp><span class="option">-fdump-rtl-split5</span></samp> enable dumping after five rounds of
549instruction splitting.
550
551          <br><dt><code>-fdump-rtl-sms</code><dd><a name="index-fdump_002drtl_002dsms-597"></a>Dump after modulo scheduling.  This pass is only run on some
552architectures.
553
554          <br><dt><code>-fdump-rtl-stack</code><dd><a name="index-fdump_002drtl_002dstack-598"></a>Dump after conversion from GCC's "flat register file" registers to the
555x87's stack-like registers.  This pass is only run on x86 variants.
556
557          <br><dt><code>-fdump-rtl-subreg1</code><dt><code>-fdump-rtl-subreg2</code><dd><a name="index-fdump_002drtl_002dsubreg1-599"></a><a name="index-fdump_002drtl_002dsubreg2-600"></a><samp><span class="option">-fdump-rtl-subreg1</span></samp> and <samp><span class="option">-fdump-rtl-subreg2</span></samp> enable dumping after
558the two subreg expansion passes.
559
560          <br><dt><code>-fdump-rtl-unshare</code><dd><a name="index-fdump_002drtl_002dunshare-601"></a>Dump after all rtl has been unshared.
561
562          <br><dt><code>-fdump-rtl-vartrack</code><dd><a name="index-fdump_002drtl_002dvartrack-602"></a>Dump after variable tracking.
563
564          <br><dt><code>-fdump-rtl-vregs</code><dd><a name="index-fdump_002drtl_002dvregs-603"></a>Dump after converting virtual registers to hard registers.
565
566          <br><dt><code>-fdump-rtl-web</code><dd><a name="index-fdump_002drtl_002dweb-604"></a>Dump after live range splitting.
567
568          <br><dt><code>-fdump-rtl-regclass</code><dt><code>-fdump-rtl-subregs_of_mode_init</code><dt><code>-fdump-rtl-subregs_of_mode_finish</code><dt><code>-fdump-rtl-dfinit</code><dt><code>-fdump-rtl-dfinish</code><dd><a name="index-fdump_002drtl_002dregclass-605"></a><a name="index-fdump_002drtl_002dsubregs_005fof_005fmode_005finit-606"></a><a name="index-fdump_002drtl_002dsubregs_005fof_005fmode_005ffinish-607"></a><a name="index-fdump_002drtl_002ddfinit-608"></a><a name="index-fdump_002drtl_002ddfinish-609"></a>These dumps are defined but always produce empty files.
569
570          <br><dt><code>-fdump-rtl-all</code><dd><a name="index-fdump_002drtl_002dall-610"></a>Produce all the dumps listed above.
571
572          <br><dt><code>-dA</code><dd><a name="index-dA-611"></a>Annotate the assembler output with miscellaneous debugging information.
573
574          <br><dt><code>-dD</code><dd><a name="index-dD-612"></a>Dump all macro definitions, at the end of preprocessing, in addition to
575normal output.
576
577          <br><dt><code>-dH</code><dd><a name="index-dH-613"></a>Produce a core dump whenever an error occurs.
578
579          <br><dt><code>-dm</code><dd><a name="index-dm-614"></a>Print statistics on memory usage, at the end of the run, to
580standard error.
581
582          <br><dt><code>-dp</code><dd><a name="index-dp-615"></a>Annotate the assembler output with a comment indicating which
583pattern and alternative was used.  The length of each instruction is
584also printed.
585
586          <br><dt><code>-dP</code><dd><a name="index-dP-616"></a>Dump the RTL in the assembler output as a comment before each instruction. 
587Also turns on <samp><span class="option">-dp</span></samp> annotation.
588
589          <br><dt><code>-dv</code><dd><a name="index-dv-617"></a>For each of the other indicated dump files (<samp><span class="option">-fdump-rtl-</span><var>pass</var></samp>),
590dump a representation of the control flow graph suitable for viewing with VCG
591to <samp><var>file</var><span class="file">.</span><var>pass</var><span class="file">.vcg</span></samp>.
592
593          <br><dt><code>-dx</code><dd><a name="index-dx-618"></a>Just generate RTL for a function instead of compiling it.  Usually used
594with <samp><span class="option">-fdump-rtl-expand</span></samp>. 
595</dl>
596
597     <br><dt><code>-fdump-noaddr</code><dd><a name="index-fdump_002dnoaddr-619"></a>When doing debugging dumps, suppress address output.  This makes it more
598feasible to use diff on debugging dumps for compiler invocations with
599different compiler binaries and/or different
600text / bss / data / heap / stack / dso start locations.
601
602     <br><dt><code>-fdump-unnumbered</code><dd><a name="index-fdump_002dunnumbered-620"></a>When doing debugging dumps, suppress instruction numbers and address output. 
603This makes it more feasible to use diff on debugging dumps for compiler
604invocations with different options, in particular with and without
605<samp><span class="option">-g</span></samp>.
606
607     <br><dt><code>-fdump-unnumbered-links</code><dd><a name="index-fdump_002dunnumbered_002dlinks-621"></a>When doing debugging dumps (see <samp><span class="option">-d</span></samp> option above), suppress
608instruction numbers for the links to the previous and next instructions
609in a sequence.
610
611     <br><dt><code>-fdump-translation-unit </code><span class="roman">(C++ only)</span><dt><code>-fdump-translation-unit-</code><var>options</var> <span class="roman">(C++ only)</span><dd><a name="index-fdump_002dtranslation_002dunit-622"></a>Dump a representation of the tree structure for the entire translation
612unit to a file.  The file name is made by appending <samp><span class="file">.tu</span></samp> to the
613source file name, and the file is created in the same directory as the
614output file.  If the &lsquo;<samp><span class="samp">-</span><var>options</var></samp>&rsquo; form is used, <var>options</var>
615controls the details of the dump as described for the
616<samp><span class="option">-fdump-tree</span></samp> options.
617
618     <br><dt><code>-fdump-class-hierarchy </code><span class="roman">(C++ only)</span><dt><code>-fdump-class-hierarchy-</code><var>options</var> <span class="roman">(C++ only)</span><dd><a name="index-fdump_002dclass_002dhierarchy-623"></a>Dump a representation of each class's hierarchy and virtual function
619table layout to a file.  The file name is made by appending
620<samp><span class="file">.class</span></samp> to the source file name, and the file is created in the
621same directory as the output file.  If the &lsquo;<samp><span class="samp">-</span><var>options</var></samp>&rsquo; form
622is used, <var>options</var> controls the details of the dump as described
623for the <samp><span class="option">-fdump-tree</span></samp> options.
624
625     <br><dt><code>-fdump-ipa-</code><var>switch</var><dd><a name="index-fdump_002dipa-624"></a>Control the dumping at various stages of inter-procedural analysis
626language tree to a file.  The file name is generated by appending a
627switch specific suffix to the source file name, and the file is created
628in the same directory as the output file.  The following dumps are
629possible:
630
631          <dl>
632<dt>&lsquo;<samp><span class="samp">all</span></samp>&rsquo;<dd>Enables all inter-procedural analysis dumps.
633
634          <br><dt>&lsquo;<samp><span class="samp">cgraph</span></samp>&rsquo;<dd>Dumps information about call-graph optimization, unused function removal,
635and inlining decisions.
636
637          <br><dt>&lsquo;<samp><span class="samp">inline</span></samp>&rsquo;<dd>Dump after function inlining.
638
639     </dl>
640
641     <br><dt><code>-fdump-statistics-</code><var>option</var><dd><a name="index-fdump_002dstatistics-625"></a>Enable and control dumping of pass statistics in a separate file.  The
642file name is generated by appending a suffix ending in
643&lsquo;<samp><span class="samp">.statistics</span></samp>&rsquo; to the source file name, and the file is created in
644the same directory as the output file.  If the &lsquo;<samp><span class="samp">-</span><var>option</var></samp>&rsquo;
645form is used, &lsquo;<samp><span class="samp">-stats</span></samp>&rsquo; will cause counters to be summed over the
646whole compilation unit while &lsquo;<samp><span class="samp">-details</span></samp>&rsquo; will dump every event as
647the passes generate them.  The default with no option is to sum
648counters for each function compiled.
649
650     <br><dt><code>-fdump-tree-</code><var>switch</var><dt><code>-fdump-tree-</code><var>switch</var><code>-</code><var>options</var><dd><a name="index-fdump_002dtree-626"></a>Control the dumping at various stages of processing the intermediate
651language tree to a file.  The file name is generated by appending a
652switch specific suffix to the source file name, and the file is
653created in the same directory as the output file.  If the
654&lsquo;<samp><span class="samp">-</span><var>options</var></samp>&rsquo; form is used, <var>options</var> is a list of
655&lsquo;<samp><span class="samp">-</span></samp>&rsquo; separated options that control the details of the dump.  Not
656all options are applicable to all dumps, those which are not
657meaningful will be ignored.  The following options are available
658
659          <dl>
660<dt>&lsquo;<samp><span class="samp">address</span></samp>&rsquo;<dd>Print the address of each node.  Usually this is not meaningful as it
661changes according to the environment and source file.  Its primary use
662is for tying up a dump file with a debug environment. 
663<br><dt>&lsquo;<samp><span class="samp">asmname</span></samp>&rsquo;<dd>If <code>DECL_ASSEMBLER_NAME</code> has been set for a given decl, use that
664in the dump instead of <code>DECL_NAME</code>.  Its primary use is ease of
665use working backward from mangled names in the assembly file. 
666<br><dt>&lsquo;<samp><span class="samp">slim</span></samp>&rsquo;<dd>Inhibit dumping of members of a scope or body of a function merely
667because that scope has been reached.  Only dump such items when they
668are directly reachable by some other path.  When dumping pretty-printed
669trees, this option inhibits dumping the bodies of control structures. 
670<br><dt>&lsquo;<samp><span class="samp">raw</span></samp>&rsquo;<dd>Print a raw representation of the tree.  By default, trees are
671pretty-printed into a C-like representation. 
672<br><dt>&lsquo;<samp><span class="samp">details</span></samp>&rsquo;<dd>Enable more detailed dumps (not honored by every dump option). 
673<br><dt>&lsquo;<samp><span class="samp">stats</span></samp>&rsquo;<dd>Enable dumping various statistics about the pass (not honored by every dump
674option). 
675<br><dt>&lsquo;<samp><span class="samp">blocks</span></samp>&rsquo;<dd>Enable showing basic block boundaries (disabled in raw dumps). 
676<br><dt>&lsquo;<samp><span class="samp">vops</span></samp>&rsquo;<dd>Enable showing virtual operands for every statement. 
677<br><dt>&lsquo;<samp><span class="samp">lineno</span></samp>&rsquo;<dd>Enable showing line numbers for statements. 
678<br><dt>&lsquo;<samp><span class="samp">uid</span></samp>&rsquo;<dd>Enable showing the unique ID (<code>DECL_UID</code>) for each variable. 
679<br><dt>&lsquo;<samp><span class="samp">verbose</span></samp>&rsquo;<dd>Enable showing the tree dump for each statement. 
680<br><dt>&lsquo;<samp><span class="samp">eh</span></samp>&rsquo;<dd>Enable showing the EH region number holding each statement. 
681<br><dt>&lsquo;<samp><span class="samp">all</span></samp>&rsquo;<dd>Turn on all options, except <samp><span class="option">raw</span></samp>, <samp><span class="option">slim</span></samp>, <samp><span class="option">verbose</span></samp>
682and <samp><span class="option">lineno</span></samp>. 
683</dl>
684
685     <p>The following tree dumps are possible:
686          <dl>
687<dt>&lsquo;<samp><span class="samp">original</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002doriginal-627"></a>Dump before any tree based optimization, to <samp><var>file</var><span class="file">.original</span></samp>.
688
689          <br><dt>&lsquo;<samp><span class="samp">optimized</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002doptimized-628"></a>Dump after all tree based optimization, to <samp><var>file</var><span class="file">.optimized</span></samp>.
690
691          <br><dt>&lsquo;<samp><span class="samp">gimple</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dgimple-629"></a>Dump each function before and after the gimplification pass to a file.  The
692file name is made by appending <samp><span class="file">.gimple</span></samp> to the source file name.
693
694          <br><dt>&lsquo;<samp><span class="samp">cfg</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dcfg-630"></a>Dump the control flow graph of each function to a file.  The file name is
695made by appending <samp><span class="file">.cfg</span></samp> to the source file name.
696
697          <br><dt>&lsquo;<samp><span class="samp">vcg</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dvcg-631"></a>Dump the control flow graph of each function to a file in VCG format.  The
698file name is made by appending <samp><span class="file">.vcg</span></samp> to the source file name.  Note
699that if the file contains more than one function, the generated file cannot
700be used directly by VCG.  You will need to cut and paste each function's
701graph into its own separate file first.
702
703          <br><dt>&lsquo;<samp><span class="samp">ch</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dch-632"></a>Dump each function after copying loop headers.  The file name is made by
704appending <samp><span class="file">.ch</span></samp> to the source file name.
705
706          <br><dt>&lsquo;<samp><span class="samp">ssa</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dssa-633"></a>Dump SSA related information to a file.  The file name is made by appending
707<samp><span class="file">.ssa</span></samp> to the source file name.
708
709          <br><dt>&lsquo;<samp><span class="samp">alias</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dalias-634"></a>Dump aliasing information for each function.  The file name is made by
710appending <samp><span class="file">.alias</span></samp> to the source file name.
711
712          <br><dt>&lsquo;<samp><span class="samp">ccp</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dccp-635"></a>Dump each function after CCP.  The file name is made by appending
713<samp><span class="file">.ccp</span></samp> to the source file name.
714
715          <br><dt>&lsquo;<samp><span class="samp">storeccp</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dstoreccp-636"></a>Dump each function after STORE-CCP.  The file name is made by appending
716<samp><span class="file">.storeccp</span></samp> to the source file name.
717
718          <br><dt>&lsquo;<samp><span class="samp">pre</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dpre-637"></a>Dump trees after partial redundancy elimination.  The file name is made
719by appending <samp><span class="file">.pre</span></samp> to the source file name.
720
721          <br><dt>&lsquo;<samp><span class="samp">fre</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dfre-638"></a>Dump trees after full redundancy elimination.  The file name is made
722by appending <samp><span class="file">.fre</span></samp> to the source file name.
723
724          <br><dt>&lsquo;<samp><span class="samp">copyprop</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dcopyprop-639"></a>Dump trees after copy propagation.  The file name is made
725by appending <samp><span class="file">.copyprop</span></samp> to the source file name.
726
727          <br><dt>&lsquo;<samp><span class="samp">store_copyprop</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dstore_005fcopyprop-640"></a>Dump trees after store copy-propagation.  The file name is made
728by appending <samp><span class="file">.store_copyprop</span></samp> to the source file name.
729
730          <br><dt>&lsquo;<samp><span class="samp">dce</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002ddce-641"></a>Dump each function after dead code elimination.  The file name is made by
731appending <samp><span class="file">.dce</span></samp> to the source file name.
732
733          <br><dt>&lsquo;<samp><span class="samp">mudflap</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dmudflap-642"></a>Dump each function after adding mudflap instrumentation.  The file name is
734made by appending <samp><span class="file">.mudflap</span></samp> to the source file name.
735
736          <br><dt>&lsquo;<samp><span class="samp">sra</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dsra-643"></a>Dump each function after performing scalar replacement of aggregates.  The
737file name is made by appending <samp><span class="file">.sra</span></samp> to the source file name.
738
739          <br><dt>&lsquo;<samp><span class="samp">sink</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dsink-644"></a>Dump each function after performing code sinking.  The file name is made
740by appending <samp><span class="file">.sink</span></samp> to the source file name.
741
742          <br><dt>&lsquo;<samp><span class="samp">dom</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002ddom-645"></a>Dump each function after applying dominator tree optimizations.  The file
743name is made by appending <samp><span class="file">.dom</span></samp> to the source file name.
744
745          <br><dt>&lsquo;<samp><span class="samp">dse</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002ddse-646"></a>Dump each function after applying dead store elimination.  The file
746name is made by appending <samp><span class="file">.dse</span></samp> to the source file name.
747
748          <br><dt>&lsquo;<samp><span class="samp">phiopt</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dphiopt-647"></a>Dump each function after optimizing PHI nodes into straightline code.  The file
749name is made by appending <samp><span class="file">.phiopt</span></samp> to the source file name.
750
751          <br><dt>&lsquo;<samp><span class="samp">forwprop</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dforwprop-648"></a>Dump each function after forward propagating single use variables.  The file
752name is made by appending <samp><span class="file">.forwprop</span></samp> to the source file name.
753
754          <br><dt>&lsquo;<samp><span class="samp">copyrename</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dcopyrename-649"></a>Dump each function after applying the copy rename optimization.  The file
755name is made by appending <samp><span class="file">.copyrename</span></samp> to the source file name.
756
757          <br><dt>&lsquo;<samp><span class="samp">nrv</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dnrv-650"></a>Dump each function after applying the named return value optimization on
758generic trees.  The file name is made by appending <samp><span class="file">.nrv</span></samp> to the source
759file name.
760
761          <br><dt>&lsquo;<samp><span class="samp">vect</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dvect-651"></a>Dump each function after applying vectorization of loops.  The file name is
762made by appending <samp><span class="file">.vect</span></samp> to the source file name.
763
764          <br><dt>&lsquo;<samp><span class="samp">slp</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dslp-652"></a>Dump each function after applying vectorization of basic blocks.  The file name
765is made by appending <samp><span class="file">.slp</span></samp> to the source file name.
766
767          <br><dt>&lsquo;<samp><span class="samp">vrp</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dvrp-653"></a>Dump each function after Value Range Propagation (VRP).  The file name
768is made by appending <samp><span class="file">.vrp</span></samp> to the source file name.
769
770          <br><dt>&lsquo;<samp><span class="samp">all</span></samp>&rsquo;<dd><a name="index-fdump_002dtree_002dall-654"></a>Enable all the available tree dumps with the flags provided in this option. 
771</dl>
772
773     <br><dt><code>-ftree-vectorizer-verbose=</code><var>n</var><dd><a name="index-ftree_002dvectorizer_002dverbose-655"></a>This option controls the amount of debugging output the vectorizer prints. 
774This information is written to standard error, unless
775<samp><span class="option">-fdump-tree-all</span></samp> or <samp><span class="option">-fdump-tree-vect</span></samp> is specified,
776in which case it is output to the usual dump listing file, <samp><span class="file">.vect</span></samp>. 
777For <var>n</var>=0 no diagnostic information is reported. 
778If <var>n</var>=1 the vectorizer reports each loop that got vectorized,
779and the total number of loops that got vectorized. 
780If <var>n</var>=2 the vectorizer also reports non-vectorized loops that passed
781the first analysis phase (vect_analyze_loop_form) - i.e. countable,
782inner-most, single-bb, single-entry/exit loops.  This is the same verbosity
783level that <samp><span class="option">-fdump-tree-vect-stats</span></samp> uses. 
784Higher verbosity levels mean either more information dumped for each
785reported loop, or same amount of information reported for more loops:
786if <var>n</var>=3, vectorizer cost model information is reported. 
787If <var>n</var>=4, alignment related information is added to the reports. 
788If <var>n</var>=5, data-references related information (e.g. memory dependences,
789memory access-patterns) is added to the reports. 
790If <var>n</var>=6, the vectorizer reports also non-vectorized inner-most loops
791that did not pass the first analysis phase (i.e., may not be countable, or
792may have complicated control-flow). 
793If <var>n</var>=7, the vectorizer reports also non-vectorized nested loops. 
794If <var>n</var>=8, SLP related information is added to the reports. 
795For <var>n</var>=9, all the information the vectorizer generates during its
796analysis and transformation is reported.  This is the same verbosity level
797that <samp><span class="option">-fdump-tree-vect-details</span></samp> uses.
798
799     <br><dt><code>-frandom-seed=</code><var>string</var><dd><a name="index-frandom_002dseed-656"></a>This option provides a seed that GCC uses when it would otherwise use
800random numbers.  It is used to generate certain symbol names
801that have to be different in every compiled file.  It is also used to
802place unique stamps in coverage data files and the object files that
803produce them.  You can use the <samp><span class="option">-frandom-seed</span></samp> option to produce
804reproducibly identical object files.
805
806     <p>The <var>string</var> should be different for every file you compile.
807
808     <br><dt><code>-fsched-verbose=</code><var>n</var><dd><a name="index-fsched_002dverbose-657"></a>On targets that use instruction scheduling, this option controls the
809amount of debugging output the scheduler prints.  This information is
810written to standard error, unless <samp><span class="option">-fdump-rtl-sched1</span></samp> or
811<samp><span class="option">-fdump-rtl-sched2</span></samp> is specified, in which case it is output
812to the usual dump listing file, <samp><span class="file">.sched1</span></samp> or <samp><span class="file">.sched2</span></samp>
813respectively.  However for <var>n</var> greater than nine, the output is
814always printed to standard error.
815
816     <p>For <var>n</var> greater than zero, <samp><span class="option">-fsched-verbose</span></samp> outputs the
817same information as <samp><span class="option">-fdump-rtl-sched1</span></samp> and <samp><span class="option">-fdump-rtl-sched2</span></samp>. 
818For <var>n</var> greater than one, it also output basic block probabilities,
819detailed ready list information and unit/insn info.  For <var>n</var> greater
820than two, it includes RTL at abort point, control-flow and regions info. 
821And for <var>n</var> over four, <samp><span class="option">-fsched-verbose</span></samp> also includes
822dependence info.
823
824     <br><dt><code>-save-temps</code><dt><code>-save-temps=cwd</code><dd><a name="index-save_002dtemps-658"></a>Store the usual &ldquo;temporary&rdquo; intermediate files permanently; place them
825in the current directory and name them based on the source file.  Thus,
826compiling <samp><span class="file">foo.c</span></samp> with &lsquo;<samp><span class="samp">-c -save-temps</span></samp>&rsquo; would produce files
827<samp><span class="file">foo.i</span></samp> and <samp><span class="file">foo.s</span></samp>, as well as <samp><span class="file">foo.o</span></samp>.  This creates a
828preprocessed <samp><span class="file">foo.i</span></samp> output file even though the compiler now
829normally uses an integrated preprocessor.
830
831     <p>When used in combination with the <samp><span class="option">-x</span></samp> command line option,
832<samp><span class="option">-save-temps</span></samp> is sensible enough to avoid over writing an
833input source file with the same extension as an intermediate file. 
834The corresponding intermediate file may be obtained by renaming the
835source file before using <samp><span class="option">-save-temps</span></samp>.
836
837     <p>If you invoke GCC in parallel, compiling several different source
838files that share a common base name in different subdirectories or the
839same source file compiled for multiple output destinations, it is
840likely that the different parallel compilers will interfere with each
841other, and overwrite the temporary files.  For instance:
842
843     <pre class="smallexample">          gcc -save-temps -o outdir1/foo.o indir1/foo.c&amp;
844          gcc -save-temps -o outdir2/foo.o indir2/foo.c&amp;
845</pre>
846     <p>may result in <samp><span class="file">foo.i</span></samp> and <samp><span class="file">foo.o</span></samp> being written to
847simultaneously by both compilers.
848
849     <br><dt><code>-save-temps=obj</code><dd><a name="index-save_002dtemps_003dobj-659"></a>Store the usual &ldquo;temporary&rdquo; intermediate files permanently.  If the
850<samp><span class="option">-o</span></samp> option is used, the temporary files are based on the
851object file.  If the <samp><span class="option">-o</span></samp> option is not used, the
852<samp><span class="option">-save-temps=obj</span></samp> switch behaves like <samp><span class="option">-save-temps</span></samp>.
853
854     <p>For example:
855
856     <pre class="smallexample">          gcc -save-temps=obj -c foo.c
857          gcc -save-temps=obj -c bar.c -o dir/xbar.o
858          gcc -save-temps=obj foobar.c -o dir2/yfoobar
859</pre>
860     <p>would create <samp><span class="file">foo.i</span></samp>, <samp><span class="file">foo.s</span></samp>, <samp><span class="file">dir/xbar.i</span></samp>,
861<samp><span class="file">dir/xbar.s</span></samp>, <samp><span class="file">dir2/yfoobar.i</span></samp>, <samp><span class="file">dir2/yfoobar.s</span></samp>, and
862<samp><span class="file">dir2/yfoobar.o</span></samp>.
863
864     <br><dt><code>-time</code><span class="roman">[</span><code>=</code><var>file</var><span class="roman">]</span><dd><a name="index-time-660"></a>Report the CPU time taken by each subprocess in the compilation
865sequence.  For C source files, this is the compiler proper and assembler
866(plus the linker if linking is done).
867
868     <p>Without the specification of an output file, the output looks like this:
869
870     <pre class="smallexample">          # cc1 0.12 0.01
871          # as 0.00 0.01
872</pre>
873     <p>The first number on each line is the &ldquo;user time&rdquo;, that is time spent
874executing the program itself.  The second number is &ldquo;system time&rdquo;,
875time spent executing operating system routines on behalf of the program. 
876Both numbers are in seconds.
877
878     <p>With the specification of an output file, the output is appended to the
879named file, and it looks like this:
880
881     <pre class="smallexample">          0.12 0.01 cc1 <var>options</var>
882          0.00 0.01 as <var>options</var>
883</pre>
884     <p>The &ldquo;user time&rdquo; and the &ldquo;system time&rdquo; are moved before the program
885name, and the options passed to the program are displayed, so that one
886can later tell what file was being compiled, and with which options.
887
888     <br><dt><code>-fvar-tracking</code><dd><a name="index-fvar_002dtracking-661"></a>Run variable tracking pass.  It computes where variables are stored at each
889position in code.  Better debugging information is then generated
890(if the debugging information format supports this information).
891
892     <p>It is enabled by default when compiling with optimization (<samp><span class="option">-Os</span></samp>,
893<samp><span class="option">-O</span></samp>, <samp><span class="option">-O2</span></samp>, <small class="dots">...</small>), debugging information (<samp><span class="option">-g</span></samp>) and
894the debug info format supports it.
895
896     <br><dt><code>-fvar-tracking-assignments</code><dd><a name="index-fvar_002dtracking_002dassignments-662"></a><a name="index-fno_002dvar_002dtracking_002dassignments-663"></a>Annotate assignments to user variables early in the compilation and
897attempt to carry the annotations over throughout the compilation all the
898way to the end, in an attempt to improve debug information while
899optimizing.  Use of <samp><span class="option">-gdwarf-4</span></samp> is recommended along with it.
900
901     <p>It can be enabled even if var-tracking is disabled, in which case
902annotations will be created and maintained, but discarded at the end.
903
904     <br><dt><code>-fvar-tracking-assignments-toggle</code><dd><a name="index-fvar_002dtracking_002dassignments_002dtoggle-664"></a><a name="index-fno_002dvar_002dtracking_002dassignments_002dtoggle-665"></a>Toggle <samp><span class="option">-fvar-tracking-assignments</span></samp>, in the same way that
905<samp><span class="option">-gtoggle</span></samp> toggles <samp><span class="option">-g</span></samp>.
906
907     <br><dt><code>-print-file-name=</code><var>library</var><dd><a name="index-print_002dfile_002dname-666"></a>Print the full absolute name of the library file <var>library</var> that
908would be used when linking&mdash;and don't do anything else.  With this
909option, GCC does not compile or link anything; it just prints the
910file name.
911
912     <br><dt><code>-print-multi-directory</code><dd><a name="index-print_002dmulti_002ddirectory-667"></a>Print the directory name corresponding to the multilib selected by any
913other switches present in the command line.  This directory is supposed
914to exist in <samp><span class="env">GCC_EXEC_PREFIX</span></samp>.
915
916     <br><dt><code>-print-multi-lib</code><dd><a name="index-print_002dmulti_002dlib-668"></a>Print the mapping from multilib directory names to compiler switches
917that enable them.  The directory name is separated from the switches by
918&lsquo;<samp><span class="samp">;</span></samp>&rsquo;, and each switch starts with an &lsquo;<samp><span class="samp">@</span></samp>&rsquo; instead of the
919&lsquo;<samp><span class="samp">-</span></samp>&rsquo;, without spaces between multiple switches.  This is supposed to
920ease shell-processing.
921
922     <br><dt><code>-print-multi-os-directory</code><dd><a name="index-print_002dmulti_002dos_002ddirectory-669"></a>Print the path to OS libraries for the selected
923multilib, relative to some <samp><span class="file">lib</span></samp> subdirectory.  If OS libraries are
924present in the <samp><span class="file">lib</span></samp> subdirectory and no multilibs are used, this is
925usually just <samp><span class="file">.</span></samp>, if OS libraries are present in <samp><span class="file">lib</span><var>suffix</var></samp>
926sibling directories this prints e.g. <samp><span class="file">../lib64</span></samp>, <samp><span class="file">../lib</span></samp> or
927<samp><span class="file">../lib32</span></samp>, or if OS libraries are present in <samp><span class="file">lib/</span><var>subdir</var></samp>
928subdirectories it prints e.g. <samp><span class="file">amd64</span></samp>, <samp><span class="file">sparcv9</span></samp> or <samp><span class="file">ev6</span></samp>.
929
930     <br><dt><code>-print-prog-name=</code><var>program</var><dd><a name="index-print_002dprog_002dname-670"></a>Like <samp><span class="option">-print-file-name</span></samp>, but searches for a program such as &lsquo;<samp><span class="samp">cpp</span></samp>&rsquo;.
931
932     <br><dt><code>-print-libgcc-file-name</code><dd><a name="index-print_002dlibgcc_002dfile_002dname-671"></a>Same as <samp><span class="option">-print-file-name=libgcc.a</span></samp>.
933
934     <p>This is useful when you use <samp><span class="option">-nostdlib</span></samp> or <samp><span class="option">-nodefaultlibs</span></samp>
935but you do want to link with <samp><span class="file">libgcc.a</span></samp>.  You can do
936
937     <pre class="smallexample">          gcc -nostdlib <var>files</var>... `gcc -print-libgcc-file-name`
938</pre>
939     <br><dt><code>-print-search-dirs</code><dd><a name="index-print_002dsearch_002ddirs-672"></a>Print the name of the configured installation directory and a list of
940program and library directories <samp><span class="command">gcc</span></samp> will search&mdash;and don't do anything else.
941
942     <p>This is useful when <samp><span class="command">gcc</span></samp> prints the error message
943&lsquo;<samp><span class="samp">installation problem, cannot exec cpp0: No such file or directory</span></samp>&rsquo;. 
944To resolve this you either need to put <samp><span class="file">cpp0</span></samp> and the other compiler
945components where <samp><span class="command">gcc</span></samp> expects to find them, or you can set the environment
946variable <samp><span class="env">GCC_EXEC_PREFIX</span></samp> to the directory where you installed them. 
947Don't forget the trailing &lsquo;<samp><span class="samp">/</span></samp>&rsquo;. 
948See <a href="Environment-Variables.html#Environment-Variables">Environment Variables</a>.
949
950     <br><dt><code>-print-sysroot</code><dd><a name="index-print_002dsysroot-673"></a>Print the target sysroot directory that will be used during
951compilation.  This is the target sysroot specified either at configure
952time or using the <samp><span class="option">--sysroot</span></samp> option, possibly with an extra
953suffix that depends on compilation options.  If no target sysroot is
954specified, the option prints nothing.
955
956     <br><dt><code>-print-sysroot-headers-suffix</code><dd><a name="index-print_002dsysroot_002dheaders_002dsuffix-674"></a>Print the suffix added to the target sysroot when searching for
957headers, or give an error if the compiler is not configured with such
958a suffix&mdash;and don't do anything else.
959
960     <br><dt><code>-dumpmachine</code><dd><a name="index-dumpmachine-675"></a>Print the compiler's target machine (for example,
961&lsquo;<samp><span class="samp">i686-pc-linux-gnu</span></samp>&rsquo;)&mdash;and don't do anything else.
962
963     <br><dt><code>-dumpversion</code><dd><a name="index-dumpversion-676"></a>Print the compiler version (for example, &lsquo;<samp><span class="samp">3.0</span></samp>&rsquo;)&mdash;and don't do
964anything else.
965
966     <br><dt><code>-dumpspecs</code><dd><a name="index-dumpspecs-677"></a>Print the compiler's built-in specs&mdash;and don't do anything else.  (This
967is used when GCC itself is being built.)  See <a href="Spec-Files.html#Spec-Files">Spec Files</a>.
968
969     <br><dt><code>-feliminate-unused-debug-types</code><dd><a name="index-feliminate_002dunused_002ddebug_002dtypes-678"></a>Normally, when producing DWARF2 output, GCC will emit debugging
970information for all types declared in a compilation
971unit, regardless of whether or not they are actually used
972in that compilation unit.  Sometimes this is useful, such as
973if, in the debugger, you want to cast a value to a type that is
974not actually used in your program (but is declared).  More often,
975however, this results in a significant amount of wasted space. 
976With this option, GCC will avoid producing debug symbol output
977for types that are nowhere used in the source file being compiled. 
978</dl>
979
980 </body></html>
981
982