The filenumbers in the .debug_macinfo is wrong. They jump from 0xf to 0x11,
skipping 0x10, so the last filename has a number which isn't in the filename
table. This causes gdb to crash in the lookup table (see
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=2009 )
It's easy to see if you compile the following program with "gcc -o helloworld
-g3 -gdwarf-2 -fverbose-asm -dA -save-temps helloworld.c" on x86-64:
#include <stdio.h>
int
main ()
{
printf ("hello world\n");
return 0;
}
And then do an "egrep '(\.file|just\ star)' helloworld.s" I see:
...
.file 15 "/usr/lib/gcc/x86_64-linux-gnu/4.0.2/include/stdarg.h"
.uleb128 0xf # Filename we just started
.file 16 "/usr/include/bits/stdio_lim.h"
.uleb128 0x11 # Filename we just started
...
If I compile the same thing with -m32, the output is correct:
...
.file 15 "/usr/lib/gcc/x86_64-linux-gnu/4.0.2/include/stdarg.h"
.uleb128 0xf # Filename we just started
.file 16 "/usr/include/bits/stdio_lim.h"
.uleb128 0x10 # Filename we just started
....
The version string of my gcc is:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt
--enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm
--enable-java-awt=gtk-default --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr
--disable-werror --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.0.2 (Debian 4.0.2-2)
--
Summary: x86_64 has incorrect file numbers in dwarf2
.debug_macinfo section
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: debug
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jeroen at dekkers dot cx
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24400