From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16833 invoked by alias); 16 Jan 2004 14:26:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16822 invoked from network); 16 Jan 2004 14:26:08 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 16 Jan 2004 14:26:08 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1AhUvD-0003r2-Ux; Fri, 16 Jan 2004 09:26:03 -0500 Date: Fri, 16 Jan 2004 14:26:00 -0000 From: Daniel Jacobowitz To: Richard.Earnshaw@arm.com Cc: Andrew Cagney , gdb-patches@sources.redhat.com, rearnsha@arm.com Subject: Re: RFA/ARM: Switch mode when setting PC Message-ID: <20040116142603.GA12836@nevyn.them.org> Mail-Followup-To: Richard.Earnshaw@arm.com, Andrew Cagney , gdb-patches@sources.redhat.com, rearnsha@arm.com References: <20040116141040.GA8134@nevyn.them.org> <200401161414.i0GEEud05631@pc960.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200401161414.i0GEEud05631@pc960.cambridge.arm.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-01/txt/msg00410.txt.bz2 On Fri, Jan 16, 2004 at 02:14:56PM +0000, Richard Earnshaw wrote: > Unless the "Thumb bit" is being stripped out by GDB, then I suspect that > this is a bug in the gdb/simulator binding layer. Any attempt to force > the PC value by the debugger should be taken as a potential state change. > If that is not happening, then all sorts of things may not work. > > I've suspected that there is a problem in the way that gdb drives the > simulator for a while now. My understanding of the ARM architecture is of somewhat recent vintage, so the following may be a load of crap. For unrelated reasons I can't test this in hardware yet. The bx instruction sets the PC register to reg & 0xfffffffe. It uses reg & 0x1 to set the T bit. So the value that gets written into the PC register has its low bit clear, and the CPSR gets updated. The low bit of the actual PC register is ignored. Isn't that correct? If so, I think the interface is fine. Certainly it corresponds to how ptrace behaves on Linux; the value specified for the PC is written directly to the PC, not parsed for the T bit. If you want to change the T bit, write to the CPSR. Right now the address of a Thumb function is marked in the symbol table by the msymbol "special" flag, not in the low bit of the address. The address points at the actual beginning of the instruction, so that's what GDB writes into $pc. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer