From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10500 invoked by alias); 25 Mar 2011 16:23:37 -0000 Received: (qmail 10479 invoked by uid 22791); 25 Mar 2011 16:23:34 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate3.uk.ibm.com (HELO mtagate3.uk.ibm.com) (194.196.100.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Mar 2011 16:23:29 +0000 Received: from d06nrmr1307.portsmouth.uk.ibm.com (d06nrmr1307.portsmouth.uk.ibm.com [9.149.38.129]) by mtagate3.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p2PGNRuq028230 for ; Fri, 25 Mar 2011 16:23:27 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1307.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2PGNuEC1814678 for ; Fri, 25 Mar 2011 16:23:56 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2PGNQLL007821 for ; Fri, 25 Mar 2011 10:23:26 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p2PGNOEu007805; Fri, 25 Mar 2011 10:23:25 -0600 Message-Id: <201103251623.p2PGNOEu007805@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 25 Mar 2011 17:23:24 +0100 Subject: Re: [rfc, arm] Always use correct execution state for single-step breakpoints To: tromey@redhat.com (Tom Tromey) Date: Fri, 25 Mar 2011 17:12:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org, matthew.gretton-dann@arm.com, patches@linaro.org In-Reply-To: from "Tom Tromey" at Mar 25, 2011 09:59:10 AM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg01101.txt.bz2 Tom Tromey wrote: > >>>>> "Ulrich" == Ulrich Weigand writes: > > Ulrich> This is done by means of a new global "arm_override_mode" which > Ulrich> is respected in arm_pc_is_thumb unconditionally (similar to > Ulrich> arm_force_mode_string), > > Ulrich> (The global is a bit ugly, but the concept still seems right to me: > Ulrich> if at some point in the future, we actually do use two different > Ulrich> gdbarch's to represent Thumb vs. ARM, the single-step routines would > Ulrich> determine the proper gdbarch to set the breakpoint in and simply > Ulrich> use insert_single_step_breakpoint with that arch.) > > I wonder whether such globals should actually be per-inferior? > I really don't know whether it would be possible to get in trouble with > this. Well, the way the patch is using the global, there is no possibility of any trouble (as long as GDB itself it not multi-threaded): + struct cleanup *old_chain + = make_cleanup_restore_integer (&arm_override_mode); + + arm_override_mode = IS_THUMB_ADDR (pc); + pc = gdbarch_addr_bits_remove (gdbarch, pc); + + insert_single_step_breakpoint (gdbarch, aspace, pc); + + do_cleanups (old_chain); Note how the setting only remains in effect across the one call to insert_single_step_breakpoint. The intent is basically to pass an extra argument through to a routine called within the call chain of that one function invocation. Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com