From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125400 invoked by alias); 28 Aug 2015 15:04:07 -0000 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 Received: (qmail 125389 invoked by uid 89); 28 Aug 2015 15:04:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f177.google.com Received: from mail-yk0-f177.google.com (HELO mail-yk0-f177.google.com) (209.85.160.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 28 Aug 2015 15:03:56 +0000 Received: by ykek5 with SMTP id k5so4088894yke.3 for ; Fri, 28 Aug 2015 08:03:54 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.129.111.11 with SMTP id k11mr9388452ywc.114.1440774233993; Fri, 28 Aug 2015 08:03:53 -0700 (PDT) Received: by 10.13.254.195 with HTTP; Fri, 28 Aug 2015 08:03:53 -0700 (PDT) In-Reply-To: References: Date: Fri, 28 Aug 2015 15:04:00 -0000 Message-ID: Subject: Re: [PATCH] Remove only use of current_inferior ()->gdbarch outside of gdbarch.* From: Doug Evans To: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00815.txt.bz2 On Thu, Aug 27, 2015 at 10:15 PM, Doug Evans wrote: > Hi. > > target_gdbarch is a magical thing, there are different kinds of arches: > for multiarch systems (e.g., call) which arch you use for certain > struct gdbarch API calls is important. > > E.g., > https://sourceware.org/ml/gdb-patches/2015-08/msg00789.html > > Until this is cleaned up it'd be best to only use target_gdbarch > and not its underlying implementation. > Fortunately there is only one place that needed changing > (further reinforcing my sense that only target_gdbarch should be > used and never current_inferior ()->gdbarch). > > Alas, short of an API reorg (which I think is reasonable), I can't think > of a way to prevent this from recurring. > > > 2015-08-27 Doug Evans > > * ravenscar-thread.c (ravenscar_inferior_created): Replace > current_inferior ()->gdbarch with its wrapper target_gdbarch. > > diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c > index ef82507..fe36c96 100644 > --- a/gdb/ravenscar-thread.c > +++ b/gdb/ravenscar-thread.c > @@ -341,7 +341,7 @@ ravenscar_inferior_created (struct target_ops *target, int from_tty) > struct ravenscar_arch_ops *ops; > > if (!ravenscar_task_support > - || gdbarch_ravenscar_ops (current_inferior ()->gdbarch) == NULL > + || gdbarch_ravenscar_ops (target_gdbarch ()) == NULL > || !has_ravenscar_runtime ()) > return; > Hmmm, forgot about ARI, bleah. We could use that to at least catch recurrences.