From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8682 invoked by alias); 13 Oct 2006 13:19:10 -0000 Received: (qmail 8673 invoked by uid 22791); 13 Oct 2006 13:19:09 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Fri, 13 Oct 2006 13:19:04 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GYMwG-0002Nb-6p; Fri, 13 Oct 2006 09:19:00 -0400 Date: Fri, 13 Oct 2006 13:19:00 -0000 From: Daniel Jacobowitz To: Andrew STUBBS Cc: Michael Snyder , GDB List Subject: Re: Problem with breakpoint addresses Message-ID: <20061013131900.GA9025@nevyn.them.org> Mail-Followup-To: Andrew STUBBS , Michael Snyder , GDB List References: <452E8150.5090209@st.com> <1160682611.14535.191.camel@localhost.localdomain> <452F4C03.2010608@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <452F4C03.2010608@st.com> User-Agent: Mutt/1.5.13 (2006-08-11) 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/msg00088.txt.bz2 On Fri, Oct 13, 2006 at 09:19:15AM +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. This sounds an awful lot like the discussion just recently on gdb-patches about paddress and target_read_memory (started by Jan). First of all, should addresses be considered sign extended on SH? Since BFD says that elf32-sh64 uses address sign extension, I suspect it should, but really it doesn't much matter if you're connected to a 32-bit target. So we can assume not for now. Secondly, this is just our use of CORE_ADDR as a native arithmetic type coming home to byte us. We knew it would someday. I think you should figure out where the sign extended CORE_ADDR was created, and why. I hope it was in value_as_address. This isn't a right final fix, but could you see if setting gdbarch_integer_to_address to a function that always uses extract_unsigned_integer helps? -- Daniel Jacobowitz CodeSourcery