From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 0B15B3858D3C for ; Tue, 29 Nov 2022 21:45:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B15B3858D3C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ATLjmT3028479 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Nov 2022 16:45:53 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ATLjmT3028479 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1669758353; bh=HTpU6YvCogyrAe8FKKYUUk/Lg7CvwUMjiwd0AdHxdt0=; h=Date:Subject:To:References:From:In-Reply-To:From; b=RagYyahBTKrNc8SIdfiRFHYZO2UZTqgoAu26O/IfBQVQXbfj70ks+EMijdOdVf0ld Nc5+Ad1lmXzOWg+mu7qk8peOPrO8jACKHwCCI83XEqE49XSPOgO+vm9Zwh6WOsGtV7 5kv8pW3ca/HCWBkFf/KeSfBI5MmNdWDdNuW/d92A= Received: from [172.16.0.64] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 052631E0CB; Tue, 29 Nov 2022 16:45:47 -0500 (EST) Message-ID: Date: Tue, 29 Nov 2022 16:45:47 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH 3/3] gdb: remove target_ops parameter from gdbarch_core_read_description Content-Language: fr To: John Baldwin , gdb-patches@sourceware.org References: <20221129025048.44490-1-simon.marchi@polymtl.ca> <20221129025048.44490-3-simon.marchi@polymtl.ca> <1c3f0845-634d-9d6a-4cc1-d75e136d099b@FreeBSD.org> From: Simon Marchi In-Reply-To: <1c3f0845-634d-9d6a-4cc1-d75e136d099b@FreeBSD.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 29 Nov 2022 21:45:48 +0000 X-Spam-Status: No, score=-3036.9 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 11/29/22 14:16, John Baldwin wrote: > On 11/28/22 6:50 PM, Simon Marchi via Gdb-patches wrote: >> Following the previous patch ("gdb: change order of core_target >> initialization"), it is no longer necessary for the core target to pass >> a pointer to itself to gdbarch_core_read_description.  Implementations >> of this method can just do regular calls to target_read_auxv, through >> the inferior target stack. >> >> This allows removing the target_ops parameter in >> gdbarch_core_read_description and a bunch of functions called >> downstream.  Some auxv-related functions received the auxv data as a >> parameter, since they could not assume it could be read from the current >> inferior, that is also no longer needed. >> >> Regression tested.  I also tested manually against an AArch64 MTE test >> case that Luis Machado sent me a while ago when we were working on this >> auxv caching issue, the desired behavior of reporting the MTE tags when >> opening the code still worked. >> >> Change-Id: I1e00361209028e9b65dde085d383cf950a7b5e3a >> --- >>   gdb/aarch64-fbsd-tdep.c   |  3 +-- >>   gdb/aarch64-linux-tdep.c  |  8 +++----- >>   gdb/amd64-fbsd-tdep.c     |  4 +--- >>   gdb/amd64-linux-tdep.c    |  4 +--- >>   gdb/arc-linux-tdep.c      |  4 +--- >>   gdb/arm-fbsd-tdep.c       | 24 +++++------------------- >>   gdb/arm-fbsd-tdep.h       | 15 +++++---------- >>   gdb/arm-linux-tdep.c      |  7 ++----- >>   gdb/auxv.c                | 11 ++--------- >>   gdb/auxv.h                |  4 ---- >>   gdb/corelow.c             |  2 +- >>   gdb/gdbarch-components.py |  2 +- >>   gdb/gdbarch-gen.h         |  4 ++-- >>   gdb/gdbarch.c             |  4 ++-- >>   gdb/i386-fbsd-tdep.c      |  4 +--- >>   gdb/i386-linux-tdep.c     |  4 +--- >>   gdb/linux-tdep.c          | 24 ++++++++++-------------- >>   gdb/linux-tdep.h          | 14 ++++++-------- >>   gdb/mips-linux-tdep.c     |  4 +--- >>   gdb/ppc-linux-tdep.c      |  7 ++----- >>   gdb/s390-linux-tdep.c     |  6 ++---- >>   21 files changed, 50 insertions(+), 109 deletions(-) >> >> diff --git a/gdb/arm-fbsd-tdep.c b/gdb/arm-fbsd-tdep.c >> index 75ee08eba506..4ea238de7c7f 100644 >> --- a/gdb/arm-fbsd-tdep.c >> +++ b/gdb/arm-fbsd-tdep.c >> @@ -215,10 +215,11 @@ arm_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, >>   /* See arm-fbsd-tdep.h.  */ >>     const struct target_desc * >> -arm_fbsd_read_description_auxv (const gdb::optional &auxv, >> -                target_ops *target, gdbarch *gdbarch, bool tls) >> +arm_fbsd_read_description_auxv (gdbarch *gdbarch, bool tls) >>   { >>     CORE_ADDR arm_hwcap = 0; >> +  gdb::optional auxv = target_read_auxv (); >> +  target_ops *target = current_inferior ()->top_target (); >>       if (!auxv.has_value () >>         || target_auxv_search (*auxv, target, gdbarch, AT_FREEBSD_HWCAP, >> @@ -239,29 +240,14 @@ arm_fbsd_read_description_auxv (const gdb::optional &auxv, >>     return arm_read_description (ARM_FP_TYPE_NONE, tls); >>   } >>   -/* See arm-fbsd-tdep.h.  */ >> - >> -const struct target_desc * >> -arm_fbsd_read_description_auxv (bool tls) >> -{ >> -  gdb::optional auxv = target_read_auxv (); >> -  return arm_fbsd_read_description_auxv (auxv, >> -                     current_inferior ()->top_target (), >> -                     current_inferior ()->gdbarch, >> -                     tls); >> -} >> - > > This function is used by arm-fbsd-nat.c in the read_description target > method.  Probably that function just needs to be updated to pass in the > gdbarch explicitly rather than keeping this wrapper method though: > > diff --git a/gdb/arm-fbsd-nat.c b/gdb/arm-fbsd-nat.c > index 340b8e0d710..0ed3104d12d 100644 > --- a/gdb/arm-fbsd-nat.c > +++ b/gdb/arm-fbsd-nat.c > @@ -96,7 +96,7 @@ arm_fbsd_nat_target::read_description () >  #ifdef PT_GETREGSET >    tls = have_regset (inferior_ptid, NT_ARM_TLS) != 0; >  #endif > -  desc = arm_fbsd_read_description_auxv (tls); > +  desc = arm_fbsd_read_description_auxv (current_inferior ()->gdbarch, tls); >    if (desc == NULL) >      desc = this->beneath ()->read_description (); >    return desc; Woops, thanks for pointing it out. Actually, I'll leave the one-parameter version there and adapt it, so no change should be needed in the nat file. Thanks, Simon