From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10281 invoked by alias); 21 Feb 2006 11:06:00 -0000 Received: (qmail 10271 invoked by uid 22791); 21 Feb 2006 11:05:59 -0000 X-Spam-Check-By: sourceware.org Received: from cam-admin0.cambridge.arm.com (HELO cam-admin0.cambridge.arm.com) (193.131.176.58) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 21 Feb 2006 11:05:52 +0000 Received: from cam-owa1.Emea.Arm.com (cam-owa1.emea.arm.com [10.1.255.62]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id k1LB5F6s003071; Tue, 21 Feb 2006 11:05:15 GMT Received: from pc960.cambridge.arm.com ([10.1.255.211]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 21 Feb 2006 11:05:14 +0000 Subject: Re: RFC: Use the ARM CPSR as a fallback to determine ARM/Thumb From: Richard Earnshaw To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org, Shaun Jackman In-Reply-To: <20060220214918.GA28798@nevyn.them.org> References: <20060220214918.GA28798@nevyn.them.org> Content-Type: text/plain Message-Id: <1140519913.27380.29.camel@pc960.cambridge.arm.com> Mime-Version: 1.0 Date: Tue, 21 Feb 2006 15:36:00 -0000 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00392.txt.bz2 On Mon, 2006-02-20 at 21:49, Daniel Jacobowitz wrote: > I'm fishing for comments on this change. In arm_pc_is_thumb, if we can not > find a symbol covering the supplied PC, we assume ARM mode; it seems that it > would be strictly more useful to assume the current mode. > > This patch _should not be used_ as is! Paul Brook cleverly noticed that > this will mess up breakpoint_from_pc when removing breakpoints, causing us > to insert 2-byte breakpoints and remove 4-byte ones across a mode switch. > I'm going to have to mess with the target_remove_breakpoint interface > to fix that, so I wanted to get opinions on this patch first before I dig > in. > > This is still a somewhat creepy thing to do. You can find quotes of me in > the gdb@ list archives saying that this is "the way to madness". However, > I've been debugging some code which jumps to Thumb-mode routines in ROM > today, and my GDB doesn't yet have symbol information for the ROM code; so > I'm well down the way to madness without this patch, and it's somewhat > better with. > I can sympathise... :-) Also note that for a lot of ARM users, defaulting to ARM is exactly the wrong choice, since all their code is Thumb (with the possible exception of some start-up code and other small trampolines). I think that guessing based on the current CPSR is a better guess than just ARM, if you can sort out the 'what we guessed last time we looked at this address problem...'. > Maybe there should be a "set" option for the default when no symbol is > found, allowing the user to throttle this back to ARM-only if that works > better for them? I certainly think we need a set option, but it's more complex than that, since I think it needs probably four states: arm - force to ARM mode even if things look otherwise. thumb - force to Thumb mode even if things look otherwise. auto-arm - Try to work it out, but guess ARM if unknown auto-thumb - Try to work it out, but guess Thumb if unknown Another approach would be some augmentation to a memory-region type command, something like add code-region [arm|thumb|auto-arm|auto-thumb] [+|] R.