diff options
author | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2024-02-04 16:16:35 +0800 |
commit | abdaadbcae30fe0c9a66c7516798279fdfd97750 (patch) | |
tree | 00a54a6e25601e43876d03c1a4a12a749d4a914c /share/doc/gcc/Debugging-Options.html |
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
Change-Id: I7303388733328cd98ab9aa3c30236db67f2e9e9c
Diffstat (limited to 'share/doc/gcc/Debugging-Options.html')
-rw-r--r-- | share/doc/gcc/Debugging-Options.html | 594 |
1 files changed, 594 insertions, 0 deletions
diff --git a/share/doc/gcc/Debugging-Options.html b/share/doc/gcc/Debugging-Options.html new file mode 100644 index 0000000..baced88 --- /dev/null +++ b/share/doc/gcc/Debugging-Options.html @@ -0,0 +1,594 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This file documents the use of the GNU compilers. + +Copyright (C) 1988-2023 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with the +Invariant Sections being "Funding Free Software", the Front-Cover +Texts being (a) (see below), and with the Back-Cover Texts being (b) +(see below). A copy of the license is included in the section entitled +"GNU Free Documentation License". + +(a) The FSF's Front-Cover Text is: + +A GNU Manual + +(b) The FSF's Back-Cover Text is: + +You have freedom to copy and modify this GNU Manual, like GNU + software. Copies published by the Free Software Foundation raise + funds for GNU development. --> +<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> +<head> +<title>Using the GNU Compiler Collection (GCC): Debugging Options</title> + +<meta name="description" content="Using the GNU Compiler Collection (GCC): Debugging Options"> +<meta name="keywords" content="Using the GNU Compiler Collection (GCC): Debugging Options"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Indices.html#Indices" rel="index" title="Indices"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="Invoking-GCC.html#Invoking-GCC" rel="up" title="Invoking GCC"> +<link href="Optimize-Options.html#Optimize-Options" rel="next" title="Optimize Options"> +<link href="Static-Analyzer-Options.html#Static-Analyzer-Options" rel="previous" title="Static Analyzer Options"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +div.smalllisp {margin-left: 3.2em} +kbd {font-style:oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en_US" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<a name="Debugging-Options"></a> +<div class="header"> +<p> +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="previous">Static Analyzer Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> +<hr> +<a name="Options-for-Debugging-Your-Program"></a> +<h3 class="section">3.10 Options for Debugging Your Program</h3> +<a name="index-options_002c-debugging"></a> +<a name="index-debugging-information-options"></a> + +<p>To tell GCC to emit extra information for use by a debugger, in almost +all cases you need only to add <samp>-g</samp> to your other options. Some debug +formats can co-exist (like DWARF with CTF) when each of them is enabled +explicitly by adding the respective command line option to your other options. +</p> +<p>GCC allows you to use <samp>-g</samp> with +<samp>-O</samp>. The shortcuts taken by optimized code may occasionally +be surprising: some variables you declared may not exist +at all; flow of control may briefly move where you did not expect it; +some statements may not be executed because they compute constant +results or their values are already at hand; some statements may +execute in different places because they have been moved out of loops. +Nevertheless it is possible to debug optimized output. This makes +it reasonable to use the optimizer for programs that might have bugs. +</p> +<p>If you are not using some other optimization option, consider +using <samp>-Og</samp> (see <a href="Optimize-Options.html#Optimize-Options">Optimize Options</a>) with <samp>-g</samp>. +With no <samp>-O</samp> option at all, some compiler passes that collect +information useful for debugging do not run at all, so that +<samp>-Og</samp> may result in a better debugging experience. +</p> +<dl compact="compact"> +<dd><a name="index-g"></a> +</dd> +<dt><code>-g</code></dt> +<dd><p>Produce debugging information in the operating system’s native format +(stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging +information. +</p> +<p>On most systems that use stabs format, <samp>-g</samp> enables use of extra +debugging information that only GDB can use; this extra information +makes debugging work better in GDB but probably makes other debuggers +crash or refuse to read the program. If you want to control for certain whether +to generate the extra information, use <samp>-gvms</samp> (see below). +</p> +<a name="index-ggdb"></a> +</dd> +<dt><code>-ggdb</code></dt> +<dd><p>Produce debugging information for use by GDB. This means to use the +most expressive format available (DWARF, stabs, or the native format +if neither of those are supported), including GDB extensions if at all +possible. +</p> +<a name="index-gdwarf"></a> +</dd> +<dt><code>-gdwarf</code></dt> +<dt><code>-gdwarf-<var>version</var></code></dt> +<dd><p>Produce debugging information in DWARF format (if that is supported). +The value of <var>version</var> may be either 2, 3, 4 or 5; the default +version for most targets is 5 (with the exception of VxWorks, TPF and +Darwin/Mac OS X, which default to version 2, and AIX, which defaults +to version 4). +</p> +<p>Note that with DWARF Version 2, some ports require and always +use some non-conflicting DWARF 3 extensions in the unwind tables. +</p> +<p>Version 4 may require GDB 7.0 and <samp>-fvar-tracking-assignments</samp> +for maximum benefit. Version 5 requires GDB 8.0 or higher. +</p> +<p>GCC no longer supports DWARF Version 1, which is substantially +different than Version 2 and later. For historical reasons, some +other DWARF-related options such as +<samp>-fno-dwarf2-cfi-asm</samp>) retain a reference to DWARF Version 2 +in their names, but apply to all currently-supported versions of DWARF. +</p> +<a name="index-gbtf"></a> +</dd> +<dt><code>-gbtf</code></dt> +<dd><p>Request BTF debug information. BTF is the default debugging format for the +eBPF target. On other targets, like x86, BTF debug information can be +generated along with DWARF debug information when both of the debug formats are +enabled explicitly via their respective command line options. +</p> +<a name="index-gctf"></a> +</dd> +<dt><code>-gctf</code></dt> +<dt><code>-gctf<var>level</var></code></dt> +<dd><p>Request CTF debug information and use level to specify how much CTF debug +information should be produced. If <samp>-gctf</samp> is specified +without a value for level, the default level of CTF debug information is 2. +</p> +<p>CTF debug information can be generated along with DWARF debug information when +both of the debug formats are enabled explicitly via their respective command +line options. +</p> +<p>Level 0 produces no CTF debug information at all. Thus, <samp>-gctf0</samp> +negates <samp>-gctf</samp>. +</p> +<p>Level 1 produces CTF information for tracebacks only. This includes callsite +information, but does not include type information. +</p> +<p>Level 2 produces type information for entities (functions, data objects etc.) +at file-scope or global-scope only. +</p> +<a name="index-gvms"></a> +</dd> +<dt><code>-gvms</code></dt> +<dd><p>Produce debugging information in Alpha/VMS debug format (if that is +supported). This is the format used by DEBUG on Alpha/VMS systems. +</p> +</dd> +<dt><code>-g<var>level</var></code></dt> +<dt><code>-ggdb<var>level</var></code></dt> +<dt><code>-gvms<var>level</var></code></dt> +<dd><p>Request debugging information and also use <var>level</var> to specify how +much information. The default level is 2. +</p> +<p>Level 0 produces no debug information at all. Thus, <samp>-g0</samp> negates +<samp>-g</samp>. +</p> +<p>Level 1 produces minimal information, enough for making backtraces in +parts of the program that you don’t plan to debug. This includes +descriptions of functions and external variables, and line number +tables, but no information about local variables. +</p> +<p>Level 3 includes extra information, such as all the macro definitions +present in the program. Some debuggers support macro expansion when +you use <samp>-g3</samp>. +</p> +<p>If you use multiple <samp>-g</samp> options, with or without level numbers, +the last such option is the one that is effective. +</p> +<p><samp>-gdwarf</samp> does not accept a concatenated debug level, to avoid +confusion with <samp>-gdwarf-<var>level</var></samp>. +Instead use an additional <samp>-g<var>level</var></samp> option to change the +debug level for DWARF. +</p> +<a name="index-feliminate_002dunused_002ddebug_002dsymbols"></a> +<a name="index-fno_002deliminate_002dunused_002ddebug_002dsymbols"></a> +</dd> +<dt><code>-fno-eliminate-unused-debug-symbols</code></dt> +<dd><p>By default, no debug information is produced for symbols that are not actually +used. Use this option if you want debug information for all symbols. +</p> +<a name="index-femit_002dclass_002ddebug_002dalways"></a> +</dd> +<dt><code>-femit-class-debug-always</code></dt> +<dd><p>Instead of emitting debugging information for a C++ class in only one +object file, emit it in all object files using the class. This option +should be used only with debuggers that are unable to handle the way GCC +normally emits debugging information for classes because using this +option increases the size of debugging information by as much as a +factor of two. +</p> +<a name="index-fmerge_002ddebug_002dstrings"></a> +<a name="index-fno_002dmerge_002ddebug_002dstrings"></a> +</dd> +<dt><code>-fno-merge-debug-strings</code></dt> +<dd><p>Direct the linker to not merge together strings in the debugging +information that are identical in different object files. Merging is +not supported by all assemblers or linkers. Merging decreases the size +of the debug information in the output file at the cost of increasing +link processing time. Merging is enabled by default. +</p> +<a name="index-fdebug_002dprefix_002dmap"></a> +</dd> +<dt><code>-fdebug-prefix-map=<var>old</var>=<var>new</var></code></dt> +<dd><p>When compiling files residing in directory <samp><var>old</var></samp>, record +debugging information describing them as if the files resided in +directory <samp><var>new</var></samp> instead. This can be used to replace a +build-time path with an install-time path in the debug info. It can +also be used to change an absolute path to a relative path by using +<samp>.</samp> for <var>new</var>. This can give more reproducible builds, which +are location independent, but may require an extra command to tell GDB +where to find the source files. See also <samp>-ffile-prefix-map</samp> +and <samp>-fcanon-prefix-map</samp>. +</p> +<a name="index-fvar_002dtracking"></a> +</dd> +<dt><code>-fvar-tracking</code></dt> +<dd><p>Run variable tracking pass. It computes where variables are stored at each +position in code. Better debugging information is then generated +(if the debugging information format supports this information). +</p> +<p>It is enabled by default when compiling with optimization (<samp>-Os</samp>, +<samp>-O</samp>, <samp>-O2</samp>, …), debugging information (<samp>-g</samp>) and +the debug info format supports it. +</p> +<a name="index-fvar_002dtracking_002dassignments"></a> +<a name="index-fno_002dvar_002dtracking_002dassignments"></a> +</dd> +<dt><code>-fvar-tracking-assignments</code></dt> +<dd><p>Annotate assignments to user variables early in the compilation and +attempt to carry the annotations over throughout the compilation all the +way to the end, in an attempt to improve debug information while +optimizing. Use of <samp>-gdwarf-4</samp> is recommended along with it. +</p> +<p>It can be enabled even if var-tracking is disabled, in which case +annotations are created and maintained, but discarded at the end. +By default, this flag is enabled together with <samp>-fvar-tracking</samp>, +except when selective scheduling is enabled. +</p> +<a name="index-gsplit_002ddwarf"></a> +</dd> +<dt><code>-gsplit-dwarf</code></dt> +<dd><p>If DWARF debugging information is enabled, separate as much debugging +information as possible into a separate output file with the extension +<samp>.dwo</samp>. This option allows the build system to avoid linking files with +debug information. To be useful, this option requires a debugger capable of +reading <samp>.dwo</samp> files. +</p> +<a name="index-gdwarf32"></a> +<a name="index-gdwarf64"></a> +</dd> +<dt><code>-gdwarf32</code></dt> +<dt><code>-gdwarf64</code></dt> +<dd><p>If DWARF debugging information is enabled, the <samp>-gdwarf32</samp> selects +the 32-bit DWARF format and the <samp>-gdwarf64</samp> selects the 64-bit +DWARF format. The default is target specific, on most targets it is +<samp>-gdwarf32</samp> though. The 32-bit DWARF format is smaller, but +can’t support more than 2GiB of debug information in any of the DWARF +debug information sections. The 64-bit DWARF format allows larger debug +information and might not be well supported by all consumers yet. +</p> +<a name="index-gdescribe_002ddies"></a> +</dd> +<dt><code>-gdescribe-dies</code></dt> +<dd><p>Add description attributes to some DWARF DIEs that have no name attribute, +such as artificial variables, external references and call site +parameter DIEs. +</p> +<a name="index-gpubnames"></a> +</dd> +<dt><code>-gpubnames</code></dt> +<dd><p>Generate DWARF <code>.debug_pubnames</code> and <code>.debug_pubtypes</code> sections. +</p> +<a name="index-ggnu_002dpubnames"></a> +</dd> +<dt><code>-ggnu-pubnames</code></dt> +<dd><p>Generate <code>.debug_pubnames</code> and <code>.debug_pubtypes</code> sections in a format +suitable for conversion into a GDB index. This option is only useful +with a linker that can produce GDB index version 7. +</p> +<a name="index-fdebug_002dtypes_002dsection"></a> +<a name="index-fno_002ddebug_002dtypes_002dsection"></a> +</dd> +<dt><code>-fdebug-types-section</code></dt> +<dd><p>When using DWARF Version 4 or higher, type DIEs can be put into +their own <code>.debug_types</code> section instead of making them part of the +<code>.debug_info</code> section. It is more efficient to put them in a separate +comdat section since the linker can then remove duplicates. +But not all DWARF consumers support <code>.debug_types</code> sections yet +and on some objects <code>.debug_types</code> produces larger instead of smaller +debugging information. +</p> +<a name="index-grecord_002dgcc_002dswitches"></a> +<a name="index-gno_002drecord_002dgcc_002dswitches"></a> +</dd> +<dt><code>-grecord-gcc-switches</code></dt> +<dt><code>-gno-record-gcc-switches</code></dt> +<dd><p>This switch causes the command-line options used to invoke the +compiler that may affect code generation to be appended to the +DW_AT_producer attribute in DWARF debugging information. The options +are concatenated with spaces separating them from each other and from +the compiler version. +It is enabled by default. +See also <samp>-frecord-gcc-switches</samp> for another +way of storing compiler options into the object file. +</p> +<a name="index-gstrict_002ddwarf"></a> +</dd> +<dt><code>-gstrict-dwarf</code></dt> +<dd><p>Disallow using extensions of later DWARF standard version than selected +with <samp>-gdwarf-<var>version</var></samp>. On most targets using non-conflicting +DWARF extensions from later standard versions is allowed. +</p> +<a name="index-gno_002dstrict_002ddwarf"></a> +</dd> +<dt><code>-gno-strict-dwarf</code></dt> +<dd><p>Allow using extensions of later DWARF standard version than selected with +<samp>-gdwarf-<var>version</var></samp>. +</p> +<a name="index-gas_002dloc_002dsupport"></a> +</dd> +<dt><code>-gas-loc-support</code></dt> +<dd><p>Inform the compiler that the assembler supports <code>.loc</code> directives. +It may then use them for the assembler to generate DWARF2+ line number +tables. +</p> +<p>This is generally desirable, because assembler-generated line-number +tables are a lot more compact than those the compiler can generate +itself. +</p> +<p>This option will be enabled by default if, at GCC configure time, the +assembler was found to support such directives. +</p> +<a name="index-gno_002das_002dloc_002dsupport"></a> +</dd> +<dt><code>-gno-as-loc-support</code></dt> +<dd><p>Force GCC to generate DWARF2+ line number tables internally, if DWARF2+ +line number tables are to be generated. +</p> +<a name="index-gas_002dlocview_002dsupport"></a> +</dd> +<dt><code>-gas-locview-support</code></dt> +<dd><p>Inform the compiler that the assembler supports <code>view</code> assignment +and reset assertion checking in <code>.loc</code> directives. +</p> +<p>This option will be enabled by default if, at GCC configure time, the +assembler was found to support them. +</p> +</dd> +<dt><code>-gno-as-locview-support</code></dt> +<dd><p>Force GCC to assign view numbers internally, if +<samp>-gvariable-location-views</samp> are explicitly requested. +</p> +<a name="index-gcolumn_002dinfo"></a> +<a name="index-gno_002dcolumn_002dinfo"></a> +</dd> +<dt><code>-gcolumn-info</code></dt> +<dt><code>-gno-column-info</code></dt> +<dd><p>Emit location column information into DWARF debugging information, rather +than just file and line. +This option is enabled by default. +</p> +<a name="index-gstatement_002dfrontiers"></a> +<a name="index-gno_002dstatement_002dfrontiers"></a> +</dd> +<dt><code>-gstatement-frontiers</code></dt> +<dt><code>-gno-statement-frontiers</code></dt> +<dd><p>This option causes GCC to create markers in the internal representation +at the beginning of statements, and to keep them roughly in place +throughout compilation, using them to guide the output of <code>is_stmt</code> +markers in the line number table. This is enabled by default when +compiling with optimization (<samp>-Os</samp>, <samp>-O1</samp>, <samp>-O2</samp>, +…), and outputting DWARF 2 debug information at the normal level. +</p> +<a name="index-gvariable_002dlocation_002dviews"></a> +<a name="index-gvariable_002dlocation_002dviews_003dincompat5"></a> +<a name="index-gno_002dvariable_002dlocation_002dviews"></a> +</dd> +<dt><code>-gvariable-location-views</code></dt> +<dt><code>-gvariable-location-views=incompat5</code></dt> +<dt><code>-gno-variable-location-views</code></dt> +<dd><p>Augment variable location lists with progressive view numbers implied +from the line number table. This enables debug information consumers to +inspect state at certain points of the program, even if no instructions +associated with the corresponding source locations are present at that +point. If the assembler lacks support for view numbers in line number +tables, this will cause the compiler to emit the line number table, +which generally makes them somewhat less compact. The augmented line +number tables and location lists are fully backward-compatible, so they +can be consumed by debug information consumers that are not aware of +these augmentations, but they won’t derive any benefit from them either. +</p> +<p>This is enabled by default when outputting DWARF 2 debug information at +the normal level, as long as there is assembler support, +<samp>-fvar-tracking-assignments</samp> is enabled and +<samp>-gstrict-dwarf</samp> is not. When assembler support is not +available, this may still be enabled, but it will force GCC to output +internal line number tables, and if +<samp>-ginternal-reset-location-views</samp> is not enabled, that will most +certainly lead to silently mismatching location views. +</p> +<p>There is a proposed representation for view numbers that is not backward +compatible with the location list format introduced in DWARF 5, that can +be enabled with <samp>-gvariable-location-views=incompat5</samp>. This +option may be removed in the future, is only provided as a reference +implementation of the proposed representation. Debug information +consumers are not expected to support this extended format, and they +would be rendered unable to decode location lists using it. +</p> +<a name="index-ginternal_002dreset_002dlocation_002dviews"></a> +<a name="index-gno_002dinternal_002dreset_002dlocation_002dviews"></a> +</dd> +<dt><code>-ginternal-reset-location-views</code></dt> +<dt><code>-gno-internal-reset-location-views</code></dt> +<dd><p>Attempt to determine location views that can be omitted from location +view lists. This requires the compiler to have very accurate insn +length estimates, which isn’t always the case, and it may cause +incorrect view lists to be generated silently when using an assembler +that does not support location view lists. The GNU assembler will flag +any such error as a <code>view number mismatch</code>. This is only enabled +on ports that define a reliable estimation function. +</p> +<a name="index-ginline_002dpoints"></a> +<a name="index-gno_002dinline_002dpoints"></a> +</dd> +<dt><code>-ginline-points</code></dt> +<dt><code>-gno-inline-points</code></dt> +<dd><p>Generate extended debug information for inlined functions. Location +view tracking markers are inserted at inlined entry points, so that +address and view numbers can be computed and output in debug +information. This can be enabled independently of location views, in +which case the view numbers won’t be output, but it can only be enabled +along with statement frontiers, and it is only enabled by default if +location views are enabled. +</p> +<a name="index-gz"></a> +</dd> +<dt><code>-gz<span class="roman">[</span>=<var>type</var><span class="roman">]</span></code></dt> +<dd><p>Produce compressed debug sections in DWARF format, if that is supported. +If <var>type</var> is not given, the default type depends on the capabilities +of the assembler and linker used. <var>type</var> may be one of +‘<samp>none</samp>’ (don’t compress debug sections), or ‘<samp>zlib</samp>’ (use zlib +compression in ELF gABI format). If the linker doesn’t support writing +compressed debug sections, the option is rejected. Otherwise, if the +assembler does not support them, <samp>-gz</samp> is silently ignored when +producing object files. +</p> +<a name="index-femit_002dstruct_002ddebug_002dbaseonly"></a> +</dd> +<dt><code>-femit-struct-debug-baseonly</code></dt> +<dd><p>Emit debug information for struct-like types +only when the base name of the compilation source file +matches the base name of file in which the struct is defined. +</p> +<p>This option substantially reduces the size of debugging information, +but at significant potential loss in type information to the debugger. +See <samp>-femit-struct-debug-reduced</samp> for a less aggressive option. +See <samp>-femit-struct-debug-detailed</samp> for more detailed control. +</p> +<p>This option works only with DWARF debug output. +</p> +<a name="index-femit_002dstruct_002ddebug_002dreduced"></a> +</dd> +<dt><code>-femit-struct-debug-reduced</code></dt> +<dd><p>Emit debug information for struct-like types +only when the base name of the compilation source file +matches the base name of file in which the type is defined, +unless the struct is a template or defined in a system header. +</p> +<p>This option significantly reduces the size of debugging information, +with some potential loss in type information to the debugger. +See <samp>-femit-struct-debug-baseonly</samp> for a more aggressive option. +See <samp>-femit-struct-debug-detailed</samp> for more detailed control. +</p> +<p>This option works only with DWARF debug output. +</p> +<a name="index-femit_002dstruct_002ddebug_002ddetailed"></a> +</dd> +<dt><code>-femit-struct-debug-detailed<span class="roman">[</span>=<var>spec-list</var><span class="roman">]</span></code></dt> +<dd><p>Specify the struct-like types +for which the compiler generates debug information. +The intent is to reduce duplicate struct debug information +between different object files within the same program. +</p> +<p>This option is a detailed version of +<samp>-femit-struct-debug-reduced</samp> and <samp>-femit-struct-debug-baseonly</samp>, +which serves for most needs. +</p> +<p>A specification has the syntax<br> +[‘<samp>dir:</samp>’|‘<samp>ind:</samp>’][‘<samp>ord:</samp>’|‘<samp>gen:</samp>’](‘<samp>any</samp>’|‘<samp>sys</samp>’|‘<samp>base</samp>’|‘<samp>none</samp>’) +</p> +<p>The optional first word limits the specification to +structs that are used directly (‘<samp>dir:</samp>’) or used indirectly (‘<samp>ind:</samp>’). +A struct type is used directly when it is the type of a variable, member. +Indirect uses arise through pointers to structs. +That is, when use of an incomplete struct is valid, the use is indirect. +An example is +‘<samp>struct one direct; struct two * indirect;</samp>’. +</p> +<p>The optional second word limits the specification to +ordinary structs (‘<samp>ord:</samp>’) or generic structs (‘<samp>gen:</samp>’). +Generic structs are a bit complicated to explain. +For C++, these are non-explicit specializations of template classes, +or non-template classes within the above. +Other programming languages have generics, +but <samp>-femit-struct-debug-detailed</samp> does not yet implement them. +</p> +<p>The third word specifies the source files for those +structs for which the compiler should emit debug information. +The values ‘<samp>none</samp>’ and ‘<samp>any</samp>’ have the normal meaning. +The value ‘<samp>base</samp>’ means that +the base of name of the file in which the type declaration appears +must match the base of the name of the main compilation file. +In practice, this means that when compiling <samp>foo.c</samp>, debug information +is generated for types declared in that file and <samp>foo.h</samp>, +but not other header files. +The value ‘<samp>sys</samp>’ means those types satisfying ‘<samp>base</samp>’ +or declared in system or compiler headers. +</p> +<p>You may need to experiment to determine the best settings for your application. +</p> +<p>The default is <samp>-femit-struct-debug-detailed=all</samp>. +</p> +<p>This option works only with DWARF debug output. +</p> +<a name="index-fdwarf2_002dcfi_002dasm"></a> +<a name="index-fno_002ddwarf2_002dcfi_002dasm"></a> +</dd> +<dt><code>-fno-dwarf2-cfi-asm</code></dt> +<dd><p>Emit DWARF unwind info as compiler generated <code>.eh_frame</code> section +instead of using GAS <code>.cfi_*</code> directives. +</p> +<a name="index-feliminate_002dunused_002ddebug_002dtypes"></a> +<a name="index-fno_002deliminate_002dunused_002ddebug_002dtypes"></a> +</dd> +<dt><code>-fno-eliminate-unused-debug-types</code></dt> +<dd><p>Normally, when producing DWARF output, GCC avoids producing debug symbol +output for types that are nowhere used in the source file being compiled. +Sometimes it is useful to have GCC emit debugging +information for all types declared in a compilation +unit, regardless of whether or not they are actually used +in that compilation unit, for example +if, in the debugger, you want to cast a value to a type that is +not actually used in your program (but is declared). More often, +however, this results in a significant amount of wasted space. +</p></dd> +</dl> + +<hr> +<div class="header"> +<p> +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="previous">Static Analyzer Options</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html#Indices" title="Index" rel="index">Index</a>]</p> +</div> + + + +</body> +</html> |