From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 028363830B39 for ; Thu, 24 Nov 2022 16:43:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 028363830B39 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com Received: from ubuntu.lan (unknown [IPv6:2a02:390:9086::635]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id DF7BE802E4; Thu, 24 Nov 2022 16:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lancelotsix.com; s=2021; t=1669308186; bh=OpxEKfqk+4HNrooex+5zzCcsdQP73ShOQR5hwV0PKE4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fBLJhPkMfhwZlLRqP/9tSqmA8UQzpdkKRxL4vkMF0oyU4c3E8aNuMgFF6RS79MlDk ySZZo76OsTRKQNyKAfcjvaBDuh10TCo5MNsaHYOJOY6hNeZt1nl4IKlku9Mba4Bm5M z4XlKZQnf3iDJUF9E6YYypCgK1YHrlkZmhIS3CyqsMFFlHBDhqpz/8ncEhpZmfgcGE 2crzipQXkcI2jkmTm3kdVK9v9w3QmU84Xhyb0QbLGigv1hJdqPI5u9+kz72EkI38/1 EuXPoaahDYkiLpZm5tso5Jkpya7tMBP9svhJIz84IZ7b6m8YuLB5KZheY8jXOU5TtL 5Tekos/IPB8Xg== Date: Thu, 24 Nov 2022 16:42:44 +0000 From: Lancelot SIX To: Simon Marchi Cc: gdb-patches@sourceware.org, Simon Marchi Subject: Re: [PATCH 2/5] gdb: add inferior parameter to set_target_gdbarch, rename to set_inferior_gdbarch Message-ID: <20221124164154.sp7zrcpdfkzodjy4@ubuntu.lan> References: <20221124160428.83804-1-simon.marchi@efficios.com> <20221124160428.83804-3-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221124160428.83804-3-simon.marchi@efficios.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Thu, 24 Nov 2022 16:43:06 +0000 (UTC) X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Nov 24, 2022 at 11:04:25AM -0500, Simon Marchi via Gdb-patches wrote: > From: Simon Marchi > > Add an inferior parameter, so it doesn't depend on the current > inferior. While at it, rename to set_inferior_gdbarch, I think that's a > better name than "target". > > The sole observer of the architecture_changed observable, > pyuw_on_new_gdbarch, doesn't seem to depend on the current inferior. > Neither does registers_changed. Hi, I kind of feel that it would make sense to also change the type of the architecture_changed observable so the observers receive the inferior * and the gdbarch *. It will not be used at the moment, but makes it clearer that this observable gets triggerd for a given inferior. WDYT? Best, Lancelot. > > Update callers to pass the current inferior, no change in behavior is > expected. > > Change-Id: I276e28eafd4740c94bc5233c81a86c01b4a6ae90 > --- > gdb/arch-utils.c | 16 ++++++++-------- > gdb/gdbarch.h | 4 ++-- > 2 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c > index dc67c632155..92caa5c3c4a 100644 > --- a/gdb/arch-utils.c > +++ b/gdb/arch-utils.c > @@ -617,7 +617,7 @@ gdbarch_update_p (struct gdbarch_info info) > "New architecture %s (%s) selected\n", > host_address_to_string (new_gdbarch), > gdbarch_bfd_arch_info (new_gdbarch)->printable_name); > - set_target_gdbarch (new_gdbarch); > + set_inferior_gdbarch (current_inferior (), new_gdbarch); > > return 1; > } > @@ -649,7 +649,7 @@ set_gdbarch_from_file (bfd *abfd) > > if (gdbarch == NULL) > error (_("Architecture of file not recognized.")); > - set_target_gdbarch (gdbarch); > + set_inferior_gdbarch (current_inferior (), gdbarch); > } > > /* Initialize the current architecture. Update the ``set > @@ -1427,15 +1427,15 @@ gdbarch_find_by_info (struct gdbarch_info info) > return new_gdbarch; > } > > -/* Make the specified architecture current. */ > +/* See gdbarch.h. */ > > void > -set_target_gdbarch (struct gdbarch *new_gdbarch) > +set_inferior_gdbarch (inferior *inf, gdbarch *gdbarch) > { > - gdb_assert (new_gdbarch != NULL); > - gdb_assert (new_gdbarch->initialized_p); > - current_inferior ()->gdbarch = new_gdbarch; > - gdb::observers::architecture_changed.notify (new_gdbarch); > + gdb_assert (gdbarch != nullptr); > + gdb_assert (gdbarch->initialized_p); > + inf->gdbarch = gdbarch; > + gdb::observers::architecture_changed.notify (gdbarch); > registers_changed (); > } > > diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h > index f2ba5f97765..76ffddfe0ff 100644 > --- a/gdb/gdbarch.h > +++ b/gdb/gdbarch.h > @@ -342,9 +342,9 @@ extern int gdbarch_update_p (struct gdbarch_info info); > extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info); > > > -/* Helper function. Set the target gdbarch to "gdbarch". */ > +/* Set INF's the target gdbarch to "gdbarch". */ > > -extern void set_target_gdbarch (struct gdbarch *gdbarch); > +extern void set_inferior_gdbarch (inferior *inf, gdbarch *gdbarch); > > > /* A registry adaptor for gdbarch. This arranges to store the > -- > 2.37.3 >