Message ID | m3d1y8f0yl.fsf@sspiff.org |
---|---|
State | New, archived |
Headers |
Received: (qmail 102607 invoked by alias); 28 Aug 2015 05:16:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 102598 invoked by uid 89); 28 Aug 2015 05:16:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 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-pa0-f42.google.com Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 28 Aug 2015 05:16:16 +0000 Received: by pacgr6 with SMTP id gr6so13264409pac.3 for <gdb-patches@sourceware.org>; Thu, 27 Aug 2015 22:16:14 -0700 (PDT) X-Received: by 10.68.250.5 with SMTP id yy5mr12806429pbc.34.1440738974361; Thu, 27 Aug 2015 22:16:14 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by smtp.gmail.com with ESMTPSA id xo14sm4259594pac.24.2015.08.27.22.16.13 for <gdb-patches@sourceware.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Aug 2015 22:16:13 -0700 (PDT) From: Doug Evans <xdje42@gmail.com> To: gdb-patches@sourceware.org Subject: [PATCH] Remove only use of current_inferior ()->gdbarch outside of gdbarch.* Date: Thu, 27 Aug 2015 22:15:14 -0700 Message-ID: <m3d1y8f0yl.fsf@sspiff.org> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes |
Commit Message
Doug Evans
Aug. 28, 2015, 5:15 a.m. UTC
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 <xdje42@gmail.com> * ravenscar-thread.c (ravenscar_inferior_created): Replace current_inferior ()->gdbarch with its wrapper target_gdbarch.
Comments
On Thu, Aug 27, 2015 at 10:15 PM, Doug Evans <xdje42@gmail.com> 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 <xdje42@gmail.com> > > * 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.
On Fri, Aug 28, 2015 at 10:21 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote: > Doug Evans wrote: >> On Thu, Aug 27, 2015 at 10:15 PM, Doug Evans <xdje42@gmail.com> wrote: >> > 2015-08-27 Doug Evans <xdje42@gmail.com> >> > >> > * ravenscar-thread.c (ravenscar_inferior_created): Replace >> > current_inferior ()->gdbarch with its wrapper target_gdbarch. > > Just as a quick comment: this goes exactly into the opposite direction > from what we discussed in the other thread. I think we should replace > target_gdbarch () with current_inferior ()->gdbarch *everywhere*, > instead of reverting that here ... This does nothing to fix the underlying problem, which is the referencing of global state instead obtaining the needed state (inferior, gdbarch, or whatever) from the passed in context. That's what I was talking about in the other thread at any rate. *In the mean time*, let's be consistent, and this patch is simpler. When we do go to properly fix this (or at least take the next step to properly fixing this), *then* we can go through and remove all the target_gdbarch calls.
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;