選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

581 行
27KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Debugging Options (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="Debugging Options (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="Debugging Options (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Invoking-GCC.html#Invoking-GCC" rel="up" title="Invoking GCC">
  30. <link href="Optimize-Options.html#Optimize-Options" rel="next" title="Optimize Options">
  31. <link href="Static-Analyzer-Options.html#Static-Analyzer-Options" rel="prev" title="Static Analyzer Options">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Debugging-Options"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Optimize-Options.html#Optimize-Options" accesskey="n" rel="next">Optimize Options</a>, Previous: <a href="Static-Analyzer-Options.html#Static-Analyzer-Options" accesskey="p" rel="prev">Static Analyzer Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Options-for-Debugging-Your-Program"></a>
  68. <h3 class="section">3.10 Options for Debugging Your Program</h3>
  69. <a name="index-options_002c-debugging"></a>
  70. <a name="index-debugging-information-options"></a>
  71. <p>To tell GCC to emit extra information for use by a debugger, in almost
  72. all cases you need only to add <samp>-g</samp> to your other options.
  73. </p>
  74. <p>GCC allows you to use <samp>-g</samp> with
  75. <samp>-O</samp>. The shortcuts taken by optimized code may occasionally
  76. be surprising: some variables you declared may not exist
  77. at all; flow of control may briefly move where you did not expect it;
  78. some statements may not be executed because they compute constant
  79. results or their values are already at hand; some statements may
  80. execute in different places because they have been moved out of loops.
  81. Nevertheless it is possible to debug optimized output. This makes
  82. it reasonable to use the optimizer for programs that might have bugs.
  83. </p>
  84. <p>If you are not using some other optimization option, consider
  85. using <samp>-Og</samp> (see <a href="Optimize-Options.html#Optimize-Options">Optimize Options</a>) with <samp>-g</samp>.
  86. With no <samp>-O</samp> option at all, some compiler passes that collect
  87. information useful for debugging do not run at all, so that
  88. <samp>-Og</samp> may result in a better debugging experience.
  89. </p>
  90. <dl compact="compact">
  91. <dt><code>-g</code></dt>
  92. <dd><a name="index-g"></a>
  93. <p>Produce debugging information in the operating system&rsquo;s native format
  94. (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging
  95. information.
  96. </p>
  97. <p>On most systems that use stabs format, <samp>-g</samp> enables use of extra
  98. debugging information that only GDB can use; this extra information
  99. makes debugging work better in GDB but probably makes other debuggers
  100. crash or
  101. refuse to read the program. If you want to control for certain whether
  102. to generate the extra information, use <samp>-gstabs+</samp>, <samp>-gstabs</samp>,
  103. <samp>-gxcoff+</samp>, <samp>-gxcoff</samp>, or <samp>-gvms</samp> (see below).
  104. </p>
  105. </dd>
  106. <dt><code>-ggdb</code></dt>
  107. <dd><a name="index-ggdb"></a>
  108. <p>Produce debugging information for use by GDB. This means to use the
  109. most expressive format available (DWARF, stabs, or the native format
  110. if neither of those are supported), including GDB extensions if at all
  111. possible.
  112. </p>
  113. </dd>
  114. <dt><code>-gdwarf</code></dt>
  115. <dt><code>-gdwarf-<var>version</var></code></dt>
  116. <dd><a name="index-gdwarf"></a>
  117. <p>Produce debugging information in DWARF format (if that is supported).
  118. The value of <var>version</var> may be either 2, 3, 4 or 5; the default version
  119. for most targets is 4. DWARF Version 5 is only experimental.
  120. </p>
  121. <p>Note that with DWARF Version 2, some ports require and always
  122. use some non-conflicting DWARF 3 extensions in the unwind tables.
  123. </p>
  124. <p>Version 4 may require GDB 7.0 and <samp>-fvar-tracking-assignments</samp>
  125. for maximum benefit.
  126. </p>
  127. <p>GCC no longer supports DWARF Version 1, which is substantially
  128. different than Version 2 and later. For historical reasons, some
  129. other DWARF-related options such as
  130. <samp>-fno-dwarf2-cfi-asm</samp>) retain a reference to DWARF Version 2
  131. in their names, but apply to all currently-supported versions of DWARF.
  132. </p>
  133. </dd>
  134. <dt><code>-gstabs</code></dt>
  135. <dd><a name="index-gstabs"></a>
  136. <p>Produce debugging information in stabs format (if that is supported),
  137. without GDB extensions. This is the format used by DBX on most BSD
  138. systems. On MIPS, Alpha and System V Release 4 systems this option
  139. produces stabs debugging output that is not understood by DBX.
  140. On System V Release 4 systems this option requires the GNU assembler.
  141. </p>
  142. </dd>
  143. <dt><code>-gstabs+</code></dt>
  144. <dd><a name="index-gstabs_002b"></a>
  145. <p>Produce debugging information in stabs format (if that is supported),
  146. using GNU extensions understood only by the GNU debugger (GDB). The
  147. use of these extensions is likely to make other debuggers crash or
  148. refuse to read the program.
  149. </p>
  150. </dd>
  151. <dt><code>-gxcoff</code></dt>
  152. <dd><a name="index-gxcoff"></a>
  153. <p>Produce debugging information in XCOFF format (if that is supported).
  154. This is the format used by the DBX debugger on IBM RS/6000 systems.
  155. </p>
  156. </dd>
  157. <dt><code>-gxcoff+</code></dt>
  158. <dd><a name="index-gxcoff_002b"></a>
  159. <p>Produce debugging information in XCOFF format (if that is supported),
  160. using GNU extensions understood only by the GNU debugger (GDB). The
  161. use of these extensions is likely to make other debuggers crash or
  162. refuse to read the program, and may cause assemblers other than the GNU
  163. assembler (GAS) to fail with an error.
  164. </p>
  165. </dd>
  166. <dt><code>-gvms</code></dt>
  167. <dd><a name="index-gvms"></a>
  168. <p>Produce debugging information in Alpha/VMS debug format (if that is
  169. supported). This is the format used by DEBUG on Alpha/VMS systems.
  170. </p>
  171. </dd>
  172. <dt><code>-g<var>level</var></code></dt>
  173. <dt><code>-ggdb<var>level</var></code></dt>
  174. <dt><code>-gstabs<var>level</var></code></dt>
  175. <dt><code>-gxcoff<var>level</var></code></dt>
  176. <dt><code>-gvms<var>level</var></code></dt>
  177. <dd><p>Request debugging information and also use <var>level</var> to specify how
  178. much information. The default level is 2.
  179. </p>
  180. <p>Level 0 produces no debug information at all. Thus, <samp>-g0</samp> negates
  181. <samp>-g</samp>.
  182. </p>
  183. <p>Level 1 produces minimal information, enough for making backtraces in
  184. parts of the program that you don&rsquo;t plan to debug. This includes
  185. descriptions of functions and external variables, and line number
  186. tables, but no information about local variables.
  187. </p>
  188. <p>Level 3 includes extra information, such as all the macro definitions
  189. present in the program. Some debuggers support macro expansion when
  190. you use <samp>-g3</samp>.
  191. </p>
  192. <p>If you use multiple <samp>-g</samp> options, with or without level numbers,
  193. the last such option is the one that is effective.
  194. </p>
  195. <p><samp>-gdwarf</samp> does not accept a concatenated debug level, to avoid
  196. confusion with <samp>-gdwarf-<var>level</var></samp>.
  197. Instead use an additional <samp>-g<var>level</var></samp> option to change the
  198. debug level for DWARF.
  199. </p>
  200. </dd>
  201. <dt><code>-fno-eliminate-unused-debug-symbols</code></dt>
  202. <dd><a name="index-feliminate_002dunused_002ddebug_002dsymbols"></a>
  203. <a name="index-fno_002deliminate_002dunused_002ddebug_002dsymbols"></a>
  204. <p>By default, no debug information is produced for symbols that are not actually
  205. used. Use this option if you want debug information for all symbols.
  206. </p>
  207. </dd>
  208. <dt><code>-femit-class-debug-always</code></dt>
  209. <dd><a name="index-femit_002dclass_002ddebug_002dalways"></a>
  210. <p>Instead of emitting debugging information for a C++ class in only one
  211. object file, emit it in all object files using the class. This option
  212. should be used only with debuggers that are unable to handle the way GCC
  213. normally emits debugging information for classes because using this
  214. option increases the size of debugging information by as much as a
  215. factor of two.
  216. </p>
  217. </dd>
  218. <dt><code>-fno-merge-debug-strings</code></dt>
  219. <dd><a name="index-fmerge_002ddebug_002dstrings"></a>
  220. <a name="index-fno_002dmerge_002ddebug_002dstrings"></a>
  221. <p>Direct the linker to not merge together strings in the debugging
  222. information that are identical in different object files. Merging is
  223. not supported by all assemblers or linkers. Merging decreases the size
  224. of the debug information in the output file at the cost of increasing
  225. link processing time. Merging is enabled by default.
  226. </p>
  227. </dd>
  228. <dt><code>-fdebug-prefix-map=<var>old</var>=<var>new</var></code></dt>
  229. <dd><a name="index-fdebug_002dprefix_002dmap"></a>
  230. <p>When compiling files residing in directory <samp><var>old</var></samp>, record
  231. debugging information describing them as if the files resided in
  232. directory <samp><var>new</var></samp> instead. This can be used to replace a
  233. build-time path with an install-time path in the debug info. It can
  234. also be used to change an absolute path to a relative path by using
  235. <samp>.</samp> for <var>new</var>. This can give more reproducible builds, which
  236. are location independent, but may require an extra command to tell GDB
  237. where to find the source files. See also <samp>-ffile-prefix-map</samp>.
  238. </p>
  239. </dd>
  240. <dt><code>-fvar-tracking</code></dt>
  241. <dd><a name="index-fvar_002dtracking"></a>
  242. <p>Run variable tracking pass. It computes where variables are stored at each
  243. position in code. Better debugging information is then generated
  244. (if the debugging information format supports this information).
  245. </p>
  246. <p>It is enabled by default when compiling with optimization (<samp>-Os</samp>,
  247. <samp>-O</samp>, <samp>-O2</samp>, &hellip;), debugging information (<samp>-g</samp>) and
  248. the debug info format supports it.
  249. </p>
  250. </dd>
  251. <dt><code>-fvar-tracking-assignments</code></dt>
  252. <dd><a name="index-fvar_002dtracking_002dassignments"></a>
  253. <a name="index-fno_002dvar_002dtracking_002dassignments"></a>
  254. <p>Annotate assignments to user variables early in the compilation and
  255. attempt to carry the annotations over throughout the compilation all the
  256. way to the end, in an attempt to improve debug information while
  257. optimizing. Use of <samp>-gdwarf-4</samp> is recommended along with it.
  258. </p>
  259. <p>It can be enabled even if var-tracking is disabled, in which case
  260. annotations are created and maintained, but discarded at the end.
  261. By default, this flag is enabled together with <samp>-fvar-tracking</samp>,
  262. except when selective scheduling is enabled.
  263. </p>
  264. </dd>
  265. <dt><code>-gsplit-dwarf</code></dt>
  266. <dd><a name="index-gsplit_002ddwarf"></a>
  267. <p>Separate as much DWARF debugging information as possible into a
  268. separate output file with the extension <samp>.dwo</samp>. This option allows
  269. the build system to avoid linking files with debug information. To
  270. be useful, this option requires a debugger capable of reading <samp>.dwo</samp>
  271. files.
  272. </p>
  273. </dd>
  274. <dt><code>-gdescribe-dies</code></dt>
  275. <dd><a name="index-gdescribe_002ddies"></a>
  276. <p>Add description attributes to some DWARF DIEs that have no name attribute,
  277. such as artificial variables, external references and call site
  278. parameter DIEs.
  279. </p>
  280. </dd>
  281. <dt><code>-gpubnames</code></dt>
  282. <dd><a name="index-gpubnames"></a>
  283. <p>Generate DWARF <code>.debug_pubnames</code> and <code>.debug_pubtypes</code> sections.
  284. </p>
  285. </dd>
  286. <dt><code>-ggnu-pubnames</code></dt>
  287. <dd><a name="index-ggnu_002dpubnames"></a>
  288. <p>Generate <code>.debug_pubnames</code> and <code>.debug_pubtypes</code> sections in a format
  289. suitable for conversion into a GDB&nbsp;index. This option is only useful
  290. with a linker that can produce GDB&nbsp;index version 7.
  291. </p>
  292. </dd>
  293. <dt><code>-fdebug-types-section</code></dt>
  294. <dd><a name="index-fdebug_002dtypes_002dsection"></a>
  295. <a name="index-fno_002ddebug_002dtypes_002dsection"></a>
  296. <p>When using DWARF Version 4 or higher, type DIEs can be put into
  297. their own <code>.debug_types</code> section instead of making them part of the
  298. <code>.debug_info</code> section. It is more efficient to put them in a separate
  299. comdat section since the linker can then remove duplicates.
  300. But not all DWARF consumers support <code>.debug_types</code> sections yet
  301. and on some objects <code>.debug_types</code> produces larger instead of smaller
  302. debugging information.
  303. </p>
  304. </dd>
  305. <dt><code>-grecord-gcc-switches</code></dt>
  306. <dt><code>-gno-record-gcc-switches</code></dt>
  307. <dd><a name="index-grecord_002dgcc_002dswitches"></a>
  308. <a name="index-gno_002drecord_002dgcc_002dswitches"></a>
  309. <p>This switch causes the command-line options used to invoke the
  310. compiler that may affect code generation to be appended to the
  311. DW_AT_producer attribute in DWARF debugging information. The options
  312. are concatenated with spaces separating them from each other and from
  313. the compiler version.
  314. It is enabled by default.
  315. See also <samp>-frecord-gcc-switches</samp> for another
  316. way of storing compiler options into the object file.
  317. </p>
  318. </dd>
  319. <dt><code>-gstrict-dwarf</code></dt>
  320. <dd><a name="index-gstrict_002ddwarf"></a>
  321. <p>Disallow using extensions of later DWARF standard version than selected
  322. with <samp>-gdwarf-<var>version</var></samp>. On most targets using non-conflicting
  323. DWARF extensions from later standard versions is allowed.
  324. </p>
  325. </dd>
  326. <dt><code>-gno-strict-dwarf</code></dt>
  327. <dd><a name="index-gno_002dstrict_002ddwarf"></a>
  328. <p>Allow using extensions of later DWARF standard version than selected with
  329. <samp>-gdwarf-<var>version</var></samp>.
  330. </p>
  331. </dd>
  332. <dt><code>-gas-loc-support</code></dt>
  333. <dd><a name="index-gas_002dloc_002dsupport"></a>
  334. <p>Inform the compiler that the assembler supports <code>.loc</code> directives.
  335. It may then use them for the assembler to generate DWARF2+ line number
  336. tables.
  337. </p>
  338. <p>This is generally desirable, because assembler-generated line-number
  339. tables are a lot more compact than those the compiler can generate
  340. itself.
  341. </p>
  342. <p>This option will be enabled by default if, at GCC configure time, the
  343. assembler was found to support such directives.
  344. </p>
  345. </dd>
  346. <dt><code>-gno-as-loc-support</code></dt>
  347. <dd><a name="index-gno_002das_002dloc_002dsupport"></a>
  348. <p>Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
  349. line number tables are to be generated.
  350. </p>
  351. </dd>
  352. <dt><code>-gas-locview-support</code></dt>
  353. <dd><a name="index-gas_002dlocview_002dsupport"></a>
  354. <p>Inform the compiler that the assembler supports <code>view</code> assignment
  355. and reset assertion checking in <code>.loc</code> directives.
  356. </p>
  357. <p>This option will be enabled by default if, at GCC configure time, the
  358. assembler was found to support them.
  359. </p>
  360. </dd>
  361. <dt><code>-gno-as-locview-support</code></dt>
  362. <dd><p>Force GCC to assign view numbers internally, if
  363. <samp>-gvariable-location-views</samp> are explicitly requested.
  364. </p>
  365. </dd>
  366. <dt><code>-gcolumn-info</code></dt>
  367. <dt><code>-gno-column-info</code></dt>
  368. <dd><a name="index-gcolumn_002dinfo"></a>
  369. <a name="index-gno_002dcolumn_002dinfo"></a>
  370. <p>Emit location column information into DWARF debugging information, rather
  371. than just file and line.
  372. This option is enabled by default.
  373. </p>
  374. </dd>
  375. <dt><code>-gstatement-frontiers</code></dt>
  376. <dt><code>-gno-statement-frontiers</code></dt>
  377. <dd><a name="index-gstatement_002dfrontiers"></a>
  378. <a name="index-gno_002dstatement_002dfrontiers"></a>
  379. <p>This option causes GCC to create markers in the internal representation
  380. at the beginning of statements, and to keep them roughly in place
  381. throughout compilation, using them to guide the output of <code>is_stmt</code>
  382. markers in the line number table. This is enabled by default when
  383. compiling with optimization (<samp>-Os</samp>, <samp>-O</samp>, <samp>-O2</samp>,
  384. &hellip;), and outputting DWARF 2 debug information at the normal level.
  385. </p>
  386. </dd>
  387. <dt><code>-gvariable-location-views</code></dt>
  388. <dt><code>-gvariable-location-views=incompat5</code></dt>
  389. <dt><code>-gno-variable-location-views</code></dt>
  390. <dd><a name="index-gvariable_002dlocation_002dviews"></a>
  391. <a name="index-gvariable_002dlocation_002dviews_003dincompat5"></a>
  392. <a name="index-gno_002dvariable_002dlocation_002dviews"></a>
  393. <p>Augment variable location lists with progressive view numbers implied
  394. from the line number table. This enables debug information consumers to
  395. inspect state at certain points of the program, even if no instructions
  396. associated with the corresponding source locations are present at that
  397. point. If the assembler lacks support for view numbers in line number
  398. tables, this will cause the compiler to emit the line number table,
  399. which generally makes them somewhat less compact. The augmented line
  400. number tables and location lists are fully backward-compatible, so they
  401. can be consumed by debug information consumers that are not aware of
  402. these augmentations, but they won&rsquo;t derive any benefit from them either.
  403. </p>
  404. <p>This is enabled by default when outputting DWARF 2 debug information at
  405. the normal level, as long as there is assembler support,
  406. <samp>-fvar-tracking-assignments</samp> is enabled and
  407. <samp>-gstrict-dwarf</samp> is not. When assembler support is not
  408. available, this may still be enabled, but it will force GCC to output
  409. internal line number tables, and if
  410. <samp>-ginternal-reset-location-views</samp> is not enabled, that will most
  411. certainly lead to silently mismatching location views.
  412. </p>
  413. <p>There is a proposed representation for view numbers that is not backward
  414. compatible with the location list format introduced in DWARF 5, that can
  415. be enabled with <samp>-gvariable-location-views=incompat5</samp>. This
  416. option may be removed in the future, is only provided as a reference
  417. implementation of the proposed representation. Debug information
  418. consumers are not expected to support this extended format, and they
  419. would be rendered unable to decode location lists using it.
  420. </p>
  421. </dd>
  422. <dt><code>-ginternal-reset-location-views</code></dt>
  423. <dt><code>-gno-internal-reset-location-views</code></dt>
  424. <dd><a name="index-ginternal_002dreset_002dlocation_002dviews"></a>
  425. <a name="index-gno_002dinternal_002dreset_002dlocation_002dviews"></a>
  426. <p>Attempt to determine location views that can be omitted from location
  427. view lists. This requires the compiler to have very accurate insn
  428. length estimates, which isn&rsquo;t always the case, and it may cause
  429. incorrect view lists to be generated silently when using an assembler
  430. that does not support location view lists. The GNU assembler will flag
  431. any such error as a <code>view number mismatch</code>. This is only enabled
  432. on ports that define a reliable estimation function.
  433. </p>
  434. </dd>
  435. <dt><code>-ginline-points</code></dt>
  436. <dt><code>-gno-inline-points</code></dt>
  437. <dd><a name="index-ginline_002dpoints"></a>
  438. <a name="index-gno_002dinline_002dpoints"></a>
  439. <p>Generate extended debug information for inlined functions. Location
  440. view tracking markers are inserted at inlined entry points, so that
  441. address and view numbers can be computed and output in debug
  442. information. This can be enabled independently of location views, in
  443. which case the view numbers won&rsquo;t be output, but it can only be enabled
  444. along with statement frontiers, and it is only enabled by default if
  445. location views are enabled.
  446. </p>
  447. </dd>
  448. <dt><code>-gz<span class="roman">[</span>=<var>type</var><span class="roman">]</span></code></dt>
  449. <dd><a name="index-gz"></a>
  450. <p>Produce compressed debug sections in DWARF format, if that is supported.
  451. If <var>type</var> is not given, the default type depends on the capabilities
  452. of the assembler and linker used. <var>type</var> may be one of
  453. &lsquo;<samp>none</samp>&rsquo; (don&rsquo;t compress debug sections), &lsquo;<samp>zlib</samp>&rsquo; (use zlib
  454. compression in ELF gABI format), or &lsquo;<samp>zlib-gnu</samp>&rsquo; (use zlib
  455. compression in traditional GNU format). If the linker doesn&rsquo;t support
  456. writing compressed debug sections, the option is rejected. Otherwise,
  457. if the assembler does not support them, <samp>-gz</samp> is silently ignored
  458. when producing object files.
  459. </p>
  460. </dd>
  461. <dt><code>-femit-struct-debug-baseonly</code></dt>
  462. <dd><a name="index-femit_002dstruct_002ddebug_002dbaseonly"></a>
  463. <p>Emit debug information for struct-like types
  464. only when the base name of the compilation source file
  465. matches the base name of file in which the struct is defined.
  466. </p>
  467. <p>This option substantially reduces the size of debugging information,
  468. but at significant potential loss in type information to the debugger.
  469. See <samp>-femit-struct-debug-reduced</samp> for a less aggressive option.
  470. See <samp>-femit-struct-debug-detailed</samp> for more detailed control.
  471. </p>
  472. <p>This option works only with DWARF debug output.
  473. </p>
  474. </dd>
  475. <dt><code>-femit-struct-debug-reduced</code></dt>
  476. <dd><a name="index-femit_002dstruct_002ddebug_002dreduced"></a>
  477. <p>Emit debug information for struct-like types
  478. only when the base name of the compilation source file
  479. matches the base name of file in which the type is defined,
  480. unless the struct is a template or defined in a system header.
  481. </p>
  482. <p>This option significantly reduces the size of debugging information,
  483. with some potential loss in type information to the debugger.
  484. See <samp>-femit-struct-debug-baseonly</samp> for a more aggressive option.
  485. See <samp>-femit-struct-debug-detailed</samp> for more detailed control.
  486. </p>
  487. <p>This option works only with DWARF debug output.
  488. </p>
  489. </dd>
  490. <dt><code>-femit-struct-debug-detailed<span class="roman">[</span>=<var>spec-list</var><span class="roman">]</span></code></dt>
  491. <dd><a name="index-femit_002dstruct_002ddebug_002ddetailed"></a>
  492. <p>Specify the struct-like types
  493. for which the compiler generates debug information.
  494. The intent is to reduce duplicate struct debug information
  495. between different object files within the same program.
  496. </p>
  497. <p>This option is a detailed version of
  498. <samp>-femit-struct-debug-reduced</samp> and <samp>-femit-struct-debug-baseonly</samp>,
  499. which serves for most needs.
  500. </p>
  501. <p>A specification has the syntax<br>
  502. [&lsquo;<samp>dir:</samp>&rsquo;|&lsquo;<samp>ind:</samp>&rsquo;][&lsquo;<samp>ord:</samp>&rsquo;|&lsquo;<samp>gen:</samp>&rsquo;](&lsquo;<samp>any</samp>&rsquo;|&lsquo;<samp>sys</samp>&rsquo;|&lsquo;<samp>base</samp>&rsquo;|&lsquo;<samp>none</samp>&rsquo;)
  503. </p>
  504. <p>The optional first word limits the specification to
  505. structs that are used directly (&lsquo;<samp>dir:</samp>&rsquo;) or used indirectly (&lsquo;<samp>ind:</samp>&rsquo;).
  506. A struct type is used directly when it is the type of a variable, member.
  507. Indirect uses arise through pointers to structs.
  508. That is, when use of an incomplete struct is valid, the use is indirect.
  509. An example is
  510. &lsquo;<samp>struct one direct; struct two * indirect;</samp>&rsquo;.
  511. </p>
  512. <p>The optional second word limits the specification to
  513. ordinary structs (&lsquo;<samp>ord:</samp>&rsquo;) or generic structs (&lsquo;<samp>gen:</samp>&rsquo;).
  514. Generic structs are a bit complicated to explain.
  515. For C++, these are non-explicit specializations of template classes,
  516. or non-template classes within the above.
  517. Other programming languages have generics,
  518. but <samp>-femit-struct-debug-detailed</samp> does not yet implement them.
  519. </p>
  520. <p>The third word specifies the source files for those
  521. structs for which the compiler should emit debug information.
  522. The values &lsquo;<samp>none</samp>&rsquo; and &lsquo;<samp>any</samp>&rsquo; have the normal meaning.
  523. The value &lsquo;<samp>base</samp>&rsquo; means that
  524. the base of name of the file in which the type declaration appears
  525. must match the base of the name of the main compilation file.
  526. In practice, this means that when compiling <samp>foo.c</samp>, debug information
  527. is generated for types declared in that file and <samp>foo.h</samp>,
  528. but not other header files.
  529. The value &lsquo;<samp>sys</samp>&rsquo; means those types satisfying &lsquo;<samp>base</samp>&rsquo;
  530. or declared in system or compiler headers.
  531. </p>
  532. <p>You may need to experiment to determine the best settings for your application.
  533. </p>
  534. <p>The default is <samp>-femit-struct-debug-detailed=all</samp>.
  535. </p>
  536. <p>This option works only with DWARF debug output.
  537. </p>
  538. </dd>
  539. <dt><code>-fno-dwarf2-cfi-asm</code></dt>
  540. <dd><a name="index-fdwarf2_002dcfi_002dasm"></a>
  541. <a name="index-fno_002ddwarf2_002dcfi_002dasm"></a>
  542. <p>Emit DWARF unwind info as compiler generated <code>.eh_frame</code> section
  543. instead of using GAS <code>.cfi_*</code> directives.
  544. </p>
  545. </dd>
  546. <dt><code>-fno-eliminate-unused-debug-types</code></dt>
  547. <dd><a name="index-feliminate_002dunused_002ddebug_002dtypes"></a>
  548. <a name="index-fno_002deliminate_002dunused_002ddebug_002dtypes"></a>
  549. <p>Normally, when producing DWARF output, GCC avoids producing debug symbol
  550. output for types that are nowhere used in the source file being compiled.
  551. Sometimes it is useful to have GCC emit debugging
  552. information for all types declared in a compilation
  553. unit, regardless of whether or not they are actually used
  554. in that compilation unit, for example
  555. if, in the debugger, you want to cast a value to a type that is
  556. not actually used in your program (but is declared). More often,
  557. however, this results in a significant amount of wasted space.
  558. </p></dd>
  559. </dl>
  560. <hr>
  561. <div class="header">
  562. <p>
  563. Next: <a href="Optimize-Options.html#Optimize-Options" accesskey="n" rel="next">Optimize Options</a>, Previous: <a href="Static-Analyzer-Options.html#Static-Analyzer-Options" accesskey="p" rel="prev">Static Analyzer Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  564. </div>
  565. </body>
  566. </html>