From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12808 invoked by alias); 21 Jun 2013 09:07:41 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12741 invoked by uid 48); 21 Jun 2013 09:07:38 -0000 From: "evgeny.gavrin at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/57667] -femit-struct-debug-detailed Date: Fri, 21 Jun 2013 09:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 4.7.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: evgeny.gavrin at hotmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg01148.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57667 --- Comment #2 from Evgeny Gavrin --- Hi! >>From the documentation to -femit-struct-debug-detailed: "The value `base' 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." I've created two files test.c and test-nonbase.h. (attached) 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. But I can get all debug info on structs declared in test-nonbase.h using gdb: Starting program: ./gcc-tests/a.out Breakpoint 1, main () at test.c:18 18 free(indir_ord); (gdb) p a $1 = 5 (gdb) p b $2 = 98 (gdb) p dir_ord $3 = {a = 5, b = 97 'a'} (gdb) p *indir_ord $4 = {a = 10, b = 98 'b'} Meanwhile, compiling with "-femit-struct-debug-detailed=ord:base" gdb can't find the debug info: Starting program: ./gcc-tests/a.out Breakpoint 1, main () at test.c:18 18 free(indir_ord); (gdb) p dir_ord $1 = (gdb) p *inddir_ord No symbol "inddir_ord" in current context. (gdb) p *indir_ord $2 = Let's see the code: ./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:], but only for base files. 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; The following "-femit-struct-debug-detailed=ind:ord:base" means that debug info should be emitted for structs used indirectly and declared in file that matches the base name of the compilation file (test.c/test.h). So, in the particular case, when struct is used indirectly in test.c and declared in test-nonbase.h - info on structs shouldn't be emitted. In case of, "-femit-struct-debug-detailed=ord:base" - it works correctly and emits nothing.