From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 99E4B3858D1E for ; Tue, 29 Nov 2022 19:16:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 99E4B3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4NMBrf2qFJz3t1F; Tue, 29 Nov 2022 19:16:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NMBrf22Bvz3GYW; Tue, 29 Nov 2022 19:16:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669749362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jspoBAD3o6mOprY0MlCa5iz4yKu9mP9G6rDGwe/bUdE=; b=UR6dCh5FvjtfUG6dwsR31M7UnweYgJv5sd1cjdO/j9dBZni3sQMTa62pnRWmihUMII5aIQ ukT12ssLaUIi2ldk0EQ/n8fbTgPqJTISzyEQrlB7hWkJtoIeVT4/G67onO0ZJ+CMtlScQj 0skjglw1AsSmKLOCJ+qODbzb14besrw7qcKfW4MCC3Aw+swiQyhrWZqY/9aAerbaKJ1YIF cXwQsR+IPPgAgSRABMKGKdKYpu9vQ5IuFnR214C4jlXcFec4Y8O1woK73V39/ZgHJG0RaS Mit6+Vtnns3JMgK1aZxQNto6894JH+nCo13MpcDPrjDSx9PzuOf4ixCix25ejA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669749362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jspoBAD3o6mOprY0MlCa5iz4yKu9mP9G6rDGwe/bUdE=; b=RE+A+mTyL3qfnkUdrIhXJW45ACA112xqFQwf2VOQ6PVdU5ss7JN0PnZzFcGKrldlc7qAno ORSsqs3Wfog/MmyY9KU9v/cLo78lv5cMGZaL0GW8oI8ll4x1vfkALv7rYZeo0XjiLAFvpk egYRYRn5fh0eEFKGaGlONDg8WbUTWshdRjwS1UP6eG7wIOHe6uwJVrgf11KMXTowBJ/gcg NVfxAr3/M4f4Q1I0tox5Z7HGSSqol0DyCs53gD2O7W/ZxaL0iLmXjYjs/aSIie8HEhVW7g a0/LuLGANkTO0FvWwnkGgv55wEnxpmXMxbssnAuCIy+Nd2eRLq29r7Q9z2n1yw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669749362; a=rsa-sha256; cv=none; b=LLNxUI3o7CLVTaTPjtQd4sU2H51O1Ea+r6jWwMNmfRpIs/7Vu2lGxEqm+J3aWeJCxgxYS9 jFdhu6Bm86T44aMr/FGxH/UV6JvdsAgj6vdVbWSejXQ5hVZ1n291c2oDwqId1AG7i9af+G nix9oPe5I12bKHrTpRLt3MmX0bzqcgCostjlDZIOp85Buz4tr3nbIJ9x53nug+3ubhLFNQ vcUiMTTVIxRuNgV37FTDrx9tkzTxs3wzTSF0x/Jpz1DdkwZvBvgWXh85wwJ6PoB8sbzH5j sCESgA0uVM+f9odYVTltOf67Vhtr//DKWhkXrle9hceMYVAjta/gRKLQaq+4HQ== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4NMBrd66Q1zdHc; Tue, 29 Nov 2022 19:16:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <1c3f0845-634d-9d6a-4cc1-d75e136d099b@FreeBSD.org> Date: Tue, 29 Nov 2022 11:16:00 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Content-Language: en-US To: Simon Marchi , gdb-patches@sourceware.org References: <20221129025048.44490-1-simon.marchi@polymtl.ca> <20221129025048.44490-3-simon.marchi@polymtl.ca> From: John Baldwin Subject: Re: [PATCH 3/3] gdb: remove target_ops parameter from gdbarch_core_read_description In-Reply-To: <20221129025048.44490-3-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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 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; -- John Baldwin