CORE_ADDR representation

Jan Kratochvil
Thu Feb 18 10:34:00 GMT 2010

On Thu, 18 Feb 2010 05:44:19 +0100, Daniel Jacobowitz wrote:
> struct section_addr_info *
> build_section_addr_info_from_objfile (const struct objfile *objfile)
> {
> ...
>   if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
>     mask = ((CORE_ADDR) 1 << addr_bit) - 1;
> ...
>       sap->other[i].addr = (bfd_get_section_vma (objfile->obfd, sec)
>                             + objfile->section_offsets->offsets[i]) & mask;
> This truncates the high bits.  MIPS sign-extends pointers, even
> internally in CORE_ADDR, and this results in separate debug info files
> for MIPS executables being relocated off to la-la land.

If we follow Mark Kettenis's suggestion on 64bit arithmetics for 32bit
	Re: [patch] bfd/: bfd_elf_bfd_from_remote_memory 32bit &= 0xffffffff
which should work now with checked-in
	[patch] Fix PIE for 64bit gdb -> 32bit inferior
(+ a similar fix may be needed even elsewhere)

these "& mask" parts can be removed.  This masking was there already before
start of the PIE(+OSX) patches.

I thought about their removal only just as a simplification in future but it
looks to be required for mips*.  Downloading some mips .iso if it will run in
qemu to test it.


More information about the Gdb mailing list