This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: -femit-struct-debug-reduced/baseonly debug info
- From: Evgeny Gavrin <evgeny dot gavrin at hotmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>, "slava dot garbuzov at gmail dot com" <slava dot garbuzov at gmail dot com>
- Date: Wed, 19 Jun 2013 16:29:35 +0000
- Subject: RE: -femit-struct-debug-reduced/baseonly debug info
- References: <SNT138-W101227728C29F752BE4608E28C0 at phx dot gbl>,<CAKOQZ8yEqQuOX2rUgDS+R3STe=sJSzb+AShnbxfVJeG5cnFDdw at mail dot gmail dot com>,<SNT138-W34826D6A50104453A32AE3E28C0 at phx dot gbl>,<CAKOQZ8wugm5-ecSdWa=Prw+RXohPGovuRiPYZGFfUjkdB_ivwQ at mail dot gmail dot com>,<SNT138-W39BAC072B763D75EAC66B1E28D0 at phx dot gbl>,<CAKOQZ8yY-fUD40izOWoTYbzxUXsAe6u9Ljnh5_KOcvQQUMqCKQ at mail dot gmail dot com>
Ok, it's understandable, but the logic of implementation tells the following:
./gcc/opts.c
51 void
52 set_struct_debug_option (struct gcc_options *opts, location_t loc,
53 const char *spec)
54 {
*************
62 /* Default is to apply to as much as possible. */
63 enum debug_info_usage usage = DINFO_USAGE_NUM_ENUMS;
64 int ord = 1, gen = 1;
*************
96 if (usage == DINFO_USAGE_NUM_ENUMS)
97 {
98 if (ord)
99 {
100 opts->x_debug_struct_ordinary[DINFO_USAGE_DFN] = files;
101 opts->x_debug_struct_ordinary[DINFO_USAGE_DIR_USE] = files;
102 opts->x_debug_struct_ordinary[DINFO_USAGE_IND_USE] = files;
103 }
104 if (gen)
105 {
106 opts->x_debug_struct_generic[DINFO_USAGE_DFN] = files;
107 opts->x_debug_struct_generic[DINFO_USAGE_DIR_USE] = files;
108 opts->x_debug_struct_generic[DINFO_USAGE_IND_USE] = files;
109 }
110 }
111 else
112 {
113 if (ord)
114 opts->x_debug_struct_ordinary[usage] = files;
115 if (gen)
116 opts->x_debug_struct_generic[usage] = files;
117 }
This means that first optional parameter shouldn't affect so much. In case it's omitted debug info should be emitted both for [dir:] and [ind:].
Two cases:
1) test.c -O0 -g2 -femit-struct-debug-detailed=ind:ord:base
opts->x_debug_struct_ordinary[usage] = files;
2) test.c -O0 -g2 -femit-struct-debug-detailed=ord:base
opts->x_debug_struct_ordinary[DINFO_USAGE_DFN] = files;
opts->x_debug_struct_ordinary[DINFO_USAGE_DIR_USE] = files;
opts->x_debug_struct_ordinary[DINFO_USAGE_IND_USE] = files;
What am I missing? On my view, there is smth wrong, or processing of this option has some additional shadow logic, that I failed to find.
/*
With optimism,
Evgeny Gavrin
email : evgeny.gavrin@hotmail.com
*/
----------------------------------------
> Date: Wed, 19 Jun 2013 08:51:17 -0700
> Subject: Re: -femit-struct-debug-reduced/baseonly debug info
> From: iant@google.com
> To: evgeny.gavrin@hotmail.com
> CC: gcc-help@gcc.gnu.org
>
> On Wed, Jun 19, 2013 at 8:38 AM, Evgeny Gavrin
> <evgeny.gavrin@hotmail.com> wrote:
>>
>> So, as I understand, when compiling like "gcc-4.7 test.c -O0 -g2 -femit-struct-debug-detailed=ind:ord:base" info about structs declared in test-nonbase.h shouldn't be emitted.
>
> Because you used "ind", the compiler generates debug info for
> essentially every struct that is explicitly named in your source code.
>
> Ian