From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7348 invoked by alias); 12 Oct 2006 19:50:19 -0000 Received: (qmail 7329 invoked by uid 22791); 12 Oct 2006 19:50:18 -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; Thu, 12 Oct 2006 19:50:15 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost.domain.tld (Postfix) with ESMTP id E2774276BA; Thu, 12 Oct 2006 12:50:13 -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 08232-18-78; Thu, 12 Oct 2006 12:50:12 -0700 (PDT) Received: from ussunex01.palmsource.com (unknown [192.168.101.9]) by mx2.palmsource.com (Postfix) with ESMTP id AECD427708; Thu, 12 Oct 2006 12:50:12 -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 ; Thu, 12 Oct 2006 19:50:13 +0000 Received: from svmsnyderlnx by owa.palmsource.com; 12 Oct 2006 12:50:11 -0700 Subject: Re: Problem with breakpoint addresses From: Michael Snyder To: Andrew STUBBS Cc: GDB List In-Reply-To: <452E8150.5090209@st.com> References: <452E8150.5090209@st.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 12 Oct 2006 19:50:00 -0000 Message-Id: <1160682611.14535.191.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/msg00082.txt.bz2 On Thu, 2006-10-12 at 18:54 +0100, Andrew STUBBS wrote: > Hi, > > I have a problem setting breakpoints from addresses stored in registers. > > Here's an example: > > (gdb) set $r1 = 0x80000000 > (gdb) b *$r1 > Breakpoint 2 at 0x80000000 > > The breakpoint looks like it is set correctly, but actually, if it is to > work, I have to set it like this: > > (gdb) b *($r1 & ~0U) > Breakpoint 3 at 0x80000000 > > This shows the difference: > > (gdb) info breakpoints > Num Type Disp Enb Address What > 2 breakpoint keep y 0xffffffff80000000 > 3 breakpoint keep y 0x80000000 > > The address has been sign extended. Note that there is no problem with > registers of unsigned type. This is with an sh-elf target hosted on > i686-pc-linux-gnu and using 'target sim'. 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.