From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10604 invoked by alias); 12 Oct 2006 17:54:42 -0000 Received: (qmail 10594 invoked by uid 22791); 12 Oct 2006 17:54:40 -0000 X-Spam-Check-By: sourceware.org Received: from fra-del-03.spheriq.net (HELO fra-del-03.spheriq.net) (195.46.51.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 12 Oct 2006 17:54:31 +0000 Received: from fra-out-03.spheriq.net (fra-out-03.spheriq.net [195.46.51.131]) by fra-del-03.spheriq.net with ESMTP id k9CHsRf9031441 for ; Thu, 12 Oct 2006 17:54:27 GMT Received: from fra-cus-01.spheriq.net (fra-cus-01.spheriq.net [195.46.51.37]) by fra-out-03.spheriq.net with ESMTP id k9CHsRsf001032 for ; Thu, 12 Oct 2006 17:54:27 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by fra-cus-01.spheriq.net with ESMTP id k9CHsQqf018434 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Thu, 12 Oct 2006 17:54:27 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 47D6EDA44 for ; Thu, 12 Oct 2006 17:54:26 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 04F9C4740A for ; Thu, 12 Oct 2006 17:54:25 +0000 (GMT) Received: from [164.129.15.13] (bri1043.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CIC35844 (AUTH stubbsa); Thu, 12 Oct 2006 18:54:25 +0100 (BST) Message-ID: <452E8150.5090209@st.com> Date: Thu, 12 Oct 2006 17:54:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: GDB List Subject: Problem with breakpoint addresses Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg00080.txt.bz2 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'. The effect of this is that the breakpoint is placed correctly, but, once hit, the program cannot continue or step any further. The problem appears to be that the 32 bit address is used to set the breakpoint (i.e. the 64 bit address is truncated somewhere in the system), but when it is hit GDB does the address comparison and the addresses are not the same so the breakpoint is not recognised. My question is: what is the _correct_ fix for this issue? Should it never do sign extension? Should it always do sign extension? Is there some way to identify when it is intended and when not? Or perhaps the true problem is elsewhere entirely? Andrew Stubbs