From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1904 invoked by alias); 12 Sep 2002 15:19:46 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 1890 invoked from network); 12 Sep 2002 15:19:45 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 12 Sep 2002 15:19:45 -0000 Received: from ges.redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id CDF2D3C44; Thu, 12 Sep 2002 11:19:42 -0400 (EDT) Message-ID: <3D80B08E.6050001@ges.redhat.com> Date: Thu, 12 Sep 2002 08:19:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Fred Fish Cc: "Maciej W. Rozycki" , binutils@sources.redhat.com, gdb@sources.redhat.com Subject: Re: MIPS sign extension of addresses References: <200209121449.g8CEnmL09055@beeville.vert.intrinsity.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-09/txt/msg00113.txt.bz2 >> Well, that seems the reason of the trouble -- for MIPS addresses in >> object and executable files should be treated as signed and bfd_vma should >> be a signed type since that's how MIPS works. > > > So does that mean that it would be more desirable if the MIPS ports used > signed long long for bfd_vma/CORE_ADDR instead of unsigned long long? > > I'm willing to work on making that happen if that is the consensus for > making MIPS support more consistent with how the hardware works. > > I've not yet checked, but are there fundamental reasons why bfd_vma > or CORE_ADDR have to be unsigned? I don't think it will help. I think it will also hinder the situtation where BFD/GDB are supporting multiple architectures - one signed and one unsigned. ``signed long long'' and ``unsigned long long'' would only show their true colours if there was a ``signed/unsigned long long long'' type. Anyway, several problems occure: - code extracts a small value and gets its sign extension wrong Here, I think all we can do is continue tracking down cases. - code does boundary arrithmetic (0x7fffffff+1 == 0xffffffff80000000) Here, it happens so rarely that it isn't worth worrying about. Eventually someone will implement a CORE_ADDR object and that will really fix the problem. - code doesn't use CORE_ADDR and {U]LONGEST correctly (occures when sizeof (CORE_ADDR) < sizeof ([U]LONGEST) --- i386. A CORE_ADDR object would fix this to. However, being more careful wouldn't hurt. Andrew