public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/57667] New: -femit-struct-debug-detailed
@ 2013-06-21 9:01 evgeny.gavrin at hotmail dot com
2013-06-21 9:02 ` [Bug debug/57667] -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: evgeny.gavrin at hotmail dot com @ 2013-06-21 9:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57667
Bug ID: 57667
Summary: -femit-struct-debug-detailed
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: evgeny.gavrin at hotmail dot com
Created attachment 30331
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30331&action=edit
file with direct and indirect calls of structs
-femit-struct-debug-detailed
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug debug/57667] -femit-struct-debug-detailed
2013-06-21 9:01 [Bug debug/57667] New: -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
@ 2013-06-21 9:02 ` evgeny.gavrin at hotmail dot com
2013-06-21 9:07 ` evgeny.gavrin at hotmail dot com
2013-06-21 13:38 ` evgeny.gavrin at hotmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: evgeny.gavrin at hotmail dot com @ 2013-06-21 9:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57667
--- Comment #1 from Evgeny Gavrin <evgeny.gavrin at hotmail dot com> ---
Created attachment 30332
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30332&action=edit
structs declaration
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug debug/57667] -femit-struct-debug-detailed
2013-06-21 9:01 [Bug debug/57667] New: -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
2013-06-21 9:02 ` [Bug debug/57667] -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
@ 2013-06-21 9:07 ` evgeny.gavrin at hotmail dot com
2013-06-21 13:38 ` evgeny.gavrin at hotmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: evgeny.gavrin at hotmail dot com @ 2013-06-21 9:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57667
--- Comment #2 from Evgeny Gavrin <evgeny.gavrin at hotmail dot com> ---
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 = <incomplete type>
(gdb) p *inddir_ord
No symbol "inddir_ord" in current context.
(gdb) p *indir_ord
$2 = <incomplete type>
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug debug/57667] -femit-struct-debug-detailed
2013-06-21 9:01 [Bug debug/57667] New: -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
2013-06-21 9:02 ` [Bug debug/57667] -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
2013-06-21 9:07 ` evgeny.gavrin at hotmail dot com
@ 2013-06-21 13:38 ` evgeny.gavrin at hotmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: evgeny.gavrin at hotmail dot com @ 2013-06-21 13:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57667
--- Comment #3 from Evgeny Gavrin <evgeny.gavrin at hotmail dot com> ---
Command to run:
egavrin@debian:~/dev/vd-issues/ld-memory-consumption/gcc-tests$ gcc-4.7 test.c
-O0 -g2 -gdwarf-2 -femit-struct-debug-detailed=ind:ord:base
egavrin@debian:~/dev/vd-issues/ld-memory-consumption/gcc-tests$ gdb ./a.out
*********
(gdb) b 18
Breakpoint 1 at 0x400593: file test.c, line 18.
(gdb) run
Starting program:
/home/egavrin/dev/vd-issues/ld-memory-consumption/gcc-tests/a.out
Breakpoint 1, main () at test.c:18
18 free(indir_ord);
(gdb) p dir_ord
$1 = {a = 5, b = 97 'a'}
(gdb) p indir_ord
$2 = (struct IND_ORD *) 0x601010
(gdb) p *indir_ord
$3 = {a = 10, b = 98 'b'}
(gdb)
egavrin@debian:~/dev/vd-issues/ld-memory-consumption/gcc-tests$ gcc-4.7 test.c
-O0 -g2 -gdwarf-2 -femit-struct-debug-detailed=ord:base
egavrin@debian:~/dev/vd-issues/ld-memory-consumption/gcc-tests$ gdb ./a.out
GNU gdb (GDB) 7.4.1-debian
This GDB was configured as "x86_64-linux-gnu".
Reading symbols from
/home/egavrin/dev/vd-issues/ld-memory-consumption/gcc-tests/a.out...done.
(gdb) b 18
Breakpoint 1 at 0x400593: file test.c, line 18.
(gdb) run
Starting program:
/home/egavrin/dev/vd-issues/ld-memory-consumption/gcc-tests/a.out
Breakpoint 1, main () at test.c:18
18 free(indir_ord);
(gdb) p dir_ord
$1 = <incomplete type>
(gdb) p indir_ord
$2 = (struct IND_ORD *) 0x601010
(gdb) p *indir_ord
$3 = <incomplete type>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-21 13:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-21 9:01 [Bug debug/57667] New: -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
2013-06-21 9:02 ` [Bug debug/57667] -femit-struct-debug-detailed evgeny.gavrin at hotmail dot com
2013-06-21 9:07 ` evgeny.gavrin at hotmail dot com
2013-06-21 13:38 ` evgeny.gavrin at hotmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).