This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
gas (or maybe gdb/gcc) problem with o64 Mips and DWARF
- From: "Martin M. Hunt" <hunt at redhat dot com>
- To: bug-binutils at gnu dot org
- Cc: gdb at sources dot redhat dot com
- Date: 11 Mar 2003 17:22:45 -0800
- Subject: gas (or maybe gdb/gcc) problem with o64 Mips and DWARF
I don't understand how to fix this, but here's what I'm seeing.
Configuring and building for mips64-elf. The default abi is o64 which
has 32-bit pointers. I cannot debug anything because GDB cannot
correctly read the linetable. readelf can read it but dwarfdump cannot.
Looking more carefully, I see that
DW_LNE_set_address has a 64-bit address, but the compilation units all
set the address size to 32 bits. This causes a problem for GDB's dwarf
reader.
To reproduce the problem, compile any small program with mips64-elf-gcc
then attempt to debug with gdb or insight. Line numbers will either be
nonexistent or incorrect.
The problem appears to be in gas/dwarf2dbg.c in function dwarf2_finish()
which has the following:
/* Calculate the size of an address for the target machine. */
sizeof_address = bfd_arch_bits_per_address (stdoutput) / 8;
So gas is not getting address size from the compilation unit header, but
from the architecture, which for mips64-elf is "mips:4000". So how
should this work? I cannot see how to grab info from the CU header. And
I don't know how else to find out from GCC what size a pointer is.
(What happens if I add "-mlong64" to the compile line? Now gcc
generates CUs with 64-bit addresses and gas agrees and all works well.)
Martin