From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Blandy To: Stephane Carrez Cc: Andrew Cagney , gdb-patches@sourceware.cygnus.com Subject: Re: path for gdb/dwarf2read.c, support 16-bit targets in dwarf-2 Date: Mon, 27 Mar 2000 12:23:00 -0000 Message-id: References: <38D4DCB0.88313CB2@worldnet.fr> <38D5B6E0.50FF6A5E@cygnus.com> <38D68C56.856CB00C@worldnet.fr> <38D74A9E.A85ED8EC@cygnus.com> <38D7E6BC.79543EBA@worldnet.fr> X-SW-Source: 2000-03/msg00627.html 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 * 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.