From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17106 invoked by alias); 15 Oct 2006 20:00:45 -0000 Received: (qmail 17097 invoked by uid 22791); 15 Oct 2006 20:00:44 -0000 X-Spam-Check-By: sourceware.org Received: from yosemite.airs.com (HELO yosemite.airs.com) (205.217.158.180) by sourceware.org (qpsmtpd/0.31) with SMTP; Sun, 15 Oct 2006 20:00:42 +0000 Received: (qmail 744 invoked from network); 15 Oct 2006 18:14:01 -0000 Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by yosemite.airs.com with SMTP; 15 Oct 2006 18:14:01 -0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by brahms.sibelius.xs4all.nl (8.13.8/8.13.6) with ESMTP id k9FIC8pO007250; Sun, 15 Oct 2006 20:12:08 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.8/8.13.6) with ESMTP id k9FIC8oZ014518; Sun, 15 Oct 2006 20:12:08 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.8/8.13.8/Submit) id k9FIC8pt022139; Sun, 15 Oct 2006 20:12:08 +0200 (CEST) Date: Sun, 15 Oct 2006 20:00:00 -0000 Message-Id: <200610151812.k9FIC8pt022139@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: Michael.Snyder@palmsource.com CC: andrew.stubbs@st.com, gdb@sourceware.org In-reply-to: <1160764729.14535.242.camel@localhost.localdomain> (message from Michael Snyder on Fri, 13 Oct 2006 11:38:49 -0700) Subject: Re: Problem with breakpoint addresses References: <452E8150.5090209@st.com> <1160682611.14535.191.camel@localhost.localdomain> <452F4C03.2010608@st.com> <1160764729.14535.242.camel@localhost.localdomain> 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/msg00104.txt.bz2 > From: Michael Snyder > Date: Fri, 13 Oct 2006 11:38:49 -0700 > > 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). Actually, in many cases it isn't. If you're on a 32-bit host and configure for a purely 32-bit target, CORE_ADDR will be a 32-bit type. > 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. Indeed. This is basically what I suggested to Jan to solve his problem. Mark