This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Missing debug information for decls in empty blocks
Hello,
> > In the context of examining the state of debug information generation with GCC
> > 3.4 and GCC 3.5, we found that nothing is generated for "foo" and "my_struct"
> > in a construct like:
>
> I'd call it a bug.
>
> We have new options -fno-eliminate-unused-debug-types and
> -fno-eliminate-unused-debug-symbols. The default is to not emit
> type/symbol info for unused types and symbols, and these options can be
> used to turn this off. However, this makes no difference for this
> testcase with gcc-3.5. I would expect to get debug info with the
> options, and without the options, it may or may not be there.
>
> Using dwarf2 debug output, I get no info for the type my_struct and the
> symbol foo. Using stabs debug output, I get no info for the symbol foo,
> but I do get info for the type my_struct.
Thanks for looking into this.
My understanding of the problem is that "reemit_insn_block_notes" (in
cfglayout.c) has the unwanted effect to remove blocks that contain no
instructions.
This is due to the fact that, internally, reemit_insn_block_notes only
emits BLOCK_BEG and BLOCK_END notes only for blocks that contain active
instructions.
I have written a tentative solution that fixes the problem by emitting
those notes not only for active instructions, but also for line number
notes.
I am ready to submit a patch if it is useful, or to follow instructions
on a more proper way to fix this.
Nico