From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20360 invoked by alias); 13 Oct 2006 18:39:01 -0000 Received: (qmail 20348 invoked by uid 22791); 13 Oct 2006 18:39:01 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.palmsource.com (HELO mx2.palmsource.com) (12.7.175.14) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 13 Oct 2006 18:38:56 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost.domain.tld (Postfix) with ESMTP id 93A3B277FE; Fri, 13 Oct 2006 11:38:54 -0700 (PDT) Received: from mx2.palmsource.com ([127.0.0.1]) by localhost (mx2.palmsource.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14537-05-93; Fri, 13 Oct 2006 11:38:51 -0700 (PDT) Received: from ussunex01.palmsource.com (unknown [192.168.101.9]) by mx2.palmsource.com (Postfix) with ESMTP id 0573B277AC; Fri, 13 Oct 2006 11:38:51 -0700 (PDT) Received: from 192.168.92.75 ([192.168.92.75]) by ussunex01.palmsource.com ([192.168.101.9]) via Exchange Front-End Server owa.palmsource.com ([10.0.20.17]) with Microsoft Exchange Server HTTP-DAV ; Fri, 13 Oct 2006 18:38:50 +0000 Received: from svmsnyderlnx by owa.palmsource.com; 13 Oct 2006 11:38:49 -0700 Subject: Re: Problem with breakpoint addresses From: Michael Snyder To: Andrew STUBBS Cc: GDB List In-Reply-To: <452F4C03.2010608@st.com> References: <452E8150.5090209@st.com> <1160682611.14535.191.camel@localhost.localdomain> <452F4C03.2010608@st.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 13 Oct 2006 18:39:00 -0000 Message-Id: <1160764729.14535.242.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00090.txt.bz2 On Fri, 2006-10-13 at 09:19 +0100, Andrew STUBBS wrote: > Michael Snyder wrote: > > What's the size of $r1, and what's the size of an address? > > By converting $r1 to an address, you're applying an implied cast. > > If that doesn't give the expected result (eg. because $r1 is signed), > > then you need to use an explicit cast. > > Registers are 32 bit, addresses are 32 bit. It's just something in GDB > that uses 64 bit. It might be because sh-elf also supports sh64. > > In any case, it is successfully setting the breakpoint and then failing > to recognise it when it is hit. That isn't the behaviour I would like. > If it totally failed to set it then giving the cast might be fair > enough, if the user thought addresses were 64 bit. Hmmm. Well, gdb's internal representation of a target address is a typedef COREADDR, and usually it equates to a long long (64 bits). Seems like, if we know that for a given architecture, an actual target address is only 32 bits, we should always make sure to save only 32 bits into a COREADDR. Maybe its time we made COREADDR into a first class object, with accessor methods. I know, I know, we can only pretend to do it in C, but we already do treat a number of things like objects.