Re: path for gdb/dwarf2read.c, support 16-bit targets in dwarf-2

Jim Blandy
2000-03-27T12:23:00Z

Hmm.

The only actual use of address_significant_size is in
dwarf2read.c:read_address. That function extracts an address from the
Dwarf 2 data, using the address size given in the Dwarf 2 compilation
unit header. Then, it masks off any bits beyond the size given by
address_significant_size.

According to the comment for address_significant_size, this is
necessary for handling Dwarf 2 data with 64-bit addresses carried in
ELF32 files --- code for a 64-bit processor, linked to run in a 32-bit
address space.

But I don't understand why we're masking those bits off at all.
Suppose we do have 64-bit addresses in the debug info --- shouldn't
all 64 bits be correct? Why should GDB mask them off and make them
zero --- why doesn't GCC or GAS just emit the address correctly in the
first place?

In the absence of further explanation, it looks to me like this code
is an incorrect attempt to compensate for a bug elsewhere in the
toolchain, and address_significant_size should be removed altogether.

Or maybe I'm misunderstanding things. Andrew, as the committer of
this change, can you comment?

Mon Dec 15 11:38:52 1997 Andrew Cagney <cagney@b1.cygnus.com>

* dwarf2read.c: From change proposed by Gavin Koch.
(address_significant_size): New static variable.
(dwarf2_build_psymtabs_hard): Check consistency between
`address_size' and `address_significant_size'.
(read_address): MASK out all but the significant bits, as
determined by `address_significant_size', of any addresses.
(elf-bfd.h): Include.
(dwarf2_build_psymtabs_hard): Set `address_significant_size'
according to the arch_size of the elf object file.