From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9587 invoked by alias); 18 Feb 2010 10:34:24 -0000 Received: (qmail 9577 invoked by uid 22791); 18 Feb 2010 10:34:24 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Feb 2010 10:34:19 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1IAYIbc031148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Feb 2010 05:34:18 -0500 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1IAYBpu021996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 18 Feb 2010 05:34:18 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o1IAY6mt003382 for ; Thu, 18 Feb 2010 11:34:06 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o1IAY4f3003378 for gdb@sourceware.org; Thu, 18 Feb 2010 11:34:04 +0100 Date: Thu, 18 Feb 2010 10:34:00 -0000 From: Jan Kratochvil To: gdb@sourceware.org Subject: Re: CORE_ADDR representation Message-ID: <20100218103404.GA1597@host0.dyn.jankratochvil.net> References: <20100218044416.GA19485@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100218044416.GA19485@caradoc.them.org> User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00122.txt.bz2 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) > { > ... > CORE_ADDR mask = CORE_ADDR_MAX; > > 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 inferiors. Re: [patch] bfd/: bfd_elf_bfd_from_remote_memory 32bit &= 0xffffffff http://sourceware.org/ml/gdb-patches/2010-02/msg00286.html which should work now with checked-in [patch] Fix PIE for 64bit gdb -> 32bit inferior http://sourceware.org/ml/gdb-patches/2010-02/msg00289.html (+ 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. Thanks, Jan