This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Support unordered .debug_info references to .debug_ranges
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- Cc: binutils at sourceware dot org, Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Date: Mon, 13 Jul 2009 13:44:56 +0200
- Subject: Re: [patch] Support unordered .debug_info references to .debug_ranges
- References: <20090713095453.GA21747@host0.dyn.jankratochvil.net> <4A5B1C8B.5080603@gmail.com>
On Mon, 13 Jul 2009 13:37:47 +0200, Dave Korn wrote:
> Jan Kratochvil wrote:
> > Hi,
> >
> > readelf sometimes complains on valid DWARF already produced by g++-4.3+:
> >
> > readelf: Error: Range lists in .debug_info section aren't in ascending order!
> > readelf: Warning: Range lists in .debug_ranges section start at 0x60
> > [...]
> >
> > A Googled bugreport:
> > http://gcc.gnu.org/ml/gcc/2009-01/msg00540.html
>
> Just FYI and FTR: a fix was posted at
>
> http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00649.html
>
> and see also
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713
This Bug was submitted by me but it is a different problem:
The most normal valid case is:
.debug_info:
DIE 0x0: DW_AT_ranges 0x0
DIE 0x28: DW_AT_ranges 0x10
.debug_ranges:
@ 0x0: 0x60..0x70 0x80.. 0x90 0,0
@0x10: 0x70..0x80 0x100..0x110 0,0
This mail thread is about:
.debug_info:
DIE 0x0: DW_AT_ranges 0x10 (exchanged order)
DIE 0x28: DW_AT_ranges 0x0 (exchanged order)
.debug_ranges:
@ 0x0: 0x60..0x70 0x80.. 0x90 0,0 (the same as in the normal case)
@0x10: 0x70..0x80 0x100..0x110 0,0 (the same as in the normal case)
While the GCC Bug was about:
.debug_info:
DIE 0x0: DW_AT_ranges 0x0 (the same as in the normal case)
DIE 0x28: DW_AT_ranges 0x10 (the same as in the normal case)
.debug_ranges:
@ 0x0: 0x60..0x70 0x80.. 0x90 0,0 (the same as in the normal case)
@0x10: 0x70..0x80 0x100..0x110 0x70..0x110 0,0 (overlap inside
the same range list)
> > Not sure if it would be worth the performance to have a no-copy optimization
> > for already sorted references.
>
> I think quite likely, since hopefully GCC will stop emitting debug info like
> this.
GCC could be changed (to also insert into ranges_by_label/ranges_table instead
of just appending as being done now). But such GCC change would have no
meaning other than workarounding this bug in readelf. DWARF has no such
ordering requirements. So I think it is better to fix readelf.
Thanks,
Jan