This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Some dwarf "nitpicks"


On Wed, 2011-03-09 at 09:51 -0800, Roland McGrath wrote:
> > > This produces a zero-length .debug_line section but a CU with a
> > > DW_AT_stmt_list attribute pointing to its start.  That is invalid
> > > DWARF and hence a GCC bug.  The place where DW_AT_stmt_list points
> > > must have a valid line information header, even if that says it's an
> > > empty table.  I think what would be most correct here is to omit the
> > > DW_AT_stmt_list attribute entirely from that CU DIE.
> > 
> > Actually, the header is there, but there are no tables.
> 
> That's not what I saw.
> 
> 	$ gcc -g -S -xc <(echo 'static int x;') -o - | grep debug_line
> 		.section	.debug_line,"",@progbits
> 	.Ldebug_line0:
> 		.long	.Ldebug_line0
> 
> The only entrance into the section is that one:
> 
> 	.section	.debug_line,"",@progbits
> .Ldebug_line0:
> 	.text
> 
> So the section is indeed empty.

Ah, yes. That is what I thought first too. But gcc is sneaky :)
If gcc detects gas has support for the .loc directive, it will not
output the section itself, but let gas generate it (because the
assembler has exact info on instruction sizes).
See gcc/dwarf2out.c DWARF2_ASM_LINE_DEBUG_INFO as described in
http://gcc.gnu.org/onlinedocs/gccint/SDB-and-DWARF.html
and the gas manual
http://sourceware.org/binutils/docs/as/Loc.html

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]