From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2084.outbound.protection.outlook.com [40.107.223.84]) by sourceware.org (Postfix) with ESMTPS id A0D5A385828D for ; Thu, 19 Oct 2023 11:08:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0D5A385828D Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A0D5A385828D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.223.84 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697713718; cv=pass; b=ATcM/cvJ2t33QGnARYoSIO6FH/GX6uBuIxwByNZPULfz5/IvLMZZbloODlImGrtVP39VnnGY43Gb2bzb/3sybxBA8qGhFqjGYAKGv+ynlrSBDNpL1p/ICYS67TkCryxgSPxEMS8gyoLXjlKmrqhcixJyelaaPZHT7+7VgggesOo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1697713718; c=relaxed/simple; bh=1m5ykOakFq2Na3H/8o1WITKoIm0zrFqv5SzafYhwF0Q=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Gzjt1hM1LguKan1kKfSxGkaT6b2JN+6g8sk2cbk1FawRo2Em2hKKkuMsiCl8WNvyO42m8G2n9U3PrLvs7m7BVj6x3dOJJfOkHOr7kgyI6C6EyXSJ8e0phIvINW0avgGtDghWicYuusPP6BascGDwuKBuCxWqGe69SKNmLzT96KY= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cv5A/SoMLszcLSvN6YiK2OP+MsEG3dEVbbDMIQEVSUtf4+s8tk0C4eeARquHifJMoSRfwzp16WdDkuBJs2ncXDvAv+kxTwl9hQ/LeL8LzvLilYXX9cWxvCDwLZ5cD4hVZpKCmMPRUf2sQ3ZY7jkcn7rsryjj9tEXfFWbJBmMfKfaJEEtskipA7SwYQwQsAD4mUSAqm9SnVFmrGzVkB8HhZ8JRenv2YamKCREcQ0WhKfOdDsr8Gh13TQjpnS9yBluJ/Zu47c+9lHCKT731QHvpL0QWblcwx0quTDR8WxuOqr54i0r2yl66Jnkz8LlACnrhwmmCO7vwc1yXl3owOGVGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L8MhwCOZ+T2z5QExUs6kePiygnH6g4YWBlr8FPjLjB4=; b=XbobUKt61uU5iScmEk59Tgb+yEGBClTdjSW5HW/dzSIyI8/Isu/0bXvGEWI3GEhFofyeARj+E7tAP06Tgb22iJAeAKdfqYaLWAMZZwNW2izupwVW5WkcPkeZrGkFLophw2ViNRoI7HpYdT0Nc0vyOTEjT8APem4dGr/QRmbXkQLVhpFqNIkhhe8jxM6S6WQXRNpolTiTAgxnmsAMDatRDdXRfSvPCN1gW13Jsjpf5t5Ff6Uo61vw83U0N6a/w7s/I6C25jik7nxIG+7UOxyZtJV84fG0p9D7X89JId/d701OK8VRPyk6bD/Vfca8iMesAck+hApIn5aQwPrtwFZ9jA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=efficios.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L8MhwCOZ+T2z5QExUs6kePiygnH6g4YWBlr8FPjLjB4=; b=G7a0wq0dodidLB4dFUzqnEdHPp/RmAlFevg2jeGDWmPAlXpMQ0ZDehgQ39V3kCA8ejpuCL1ARtybrU4oCpzvEUrVrf27+SfRhEvu2bHMdQHUatQOPJN8K2s4PJc22pL7ENbUxtQeztfwhey4yA23eWZVHL12Y3SJmL3bVmkRkAQ= Received: from DS7PR05CA0035.namprd05.prod.outlook.com (2603:10b6:8:2f::18) by MN0PR12MB6053.namprd12.prod.outlook.com (2603:10b6:208:3cf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Thu, 19 Oct 2023 11:08:33 +0000 Received: from DS2PEPF00003442.namprd04.prod.outlook.com (2603:10b6:8:2f:cafe::29) by DS7PR05CA0035.outlook.office365.com (2603:10b6:8:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23 via Frontend Transport; Thu, 19 Oct 2023 11:08:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS2PEPF00003442.mail.protection.outlook.com (10.167.17.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6907.21 via Frontend Transport; Thu, 19 Oct 2023 11:08:32 +0000 Received: from khazad-dum (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 19 Oct 2023 06:08:31 -0500 Date: Thu, 19 Oct 2023 12:08:24 +0100 From: Lancelot SIX To: Simon Marchi CC: Subject: Re: [PATCH 16/24] gdb: make clear_so a method of struct so_list Message-ID: <20231019110824.vjuiao3wddrewpv6@khazad-dum> References: <20231010204213.111285-1-simon.marchi@efficios.com> <20231010204213.111285-17-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231010204213.111285-17-simon.marchi@efficios.com> X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF00003442:EE_|MN0PR12MB6053:EE_ X-MS-Office365-Filtering-Correlation-Id: f87734e9-af65-4182-491d-08dbd093bb96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dghuhzYb+BsU81aBMrPU3qbCA2e/pI7BEwDEuNqmJ78Dzn0g7wRRfIu/wKuC4OlF6E169tGjmg5qPih1S30CebPeOBVg2VwlhtBw/ZThZViNjvBVG74AwLOcNo3Ln2EA+LFQhHa9wdcy615765+MG17ZzzzNAG6ghG+SORdD4bPEytKB93poUDtLlb/ond/HOY4nI9hi/nmgRd2rnb9xwKhcC760N4dqSj+IafzeOiljHWP6f79oaLu8xuaymR5Bq264rYUVSfPX8yqND+09s5c735j/dDKyx/zTw7r62tF995Zmv/+ATUKCDQQRq4SSSDuJZlm/C6UE35bP4nYw4eNfvpPWlveYQ94vaSaxI/APyj1S+cAvZ+hgBPEz0fhrPbKsMlmB7chQQDu0SD7xqzvurJ7oAoLLPXy/Iz2tsGhpV3WYvpczf6+ORtbm+C4wH5agZ55/PYwMFP8QuI0oXVx4fqi1Io/bYdWhSGd8+v/C9YwIU6b7Z5urMhp3uJCvpXjTZD7vL3qdxSnt/zKoRBABtVZYw8N6TruuX2W5uhk/w/tXALojN+w2TM6vkFxA8n74TIzl0W9DuTIvDT6WGdrPmJtvkpe4tBnGL+ne7KEppc1hb7EJ8EgLjTyxIcDb8rlGq0kTJQUna9mFmtP2ihGIX6L7pZ6EP1pwc1+eLJlmtMyqNZZ/Tk6CbT1kqFenMJ2bVjF1xDtlo5Vime4WbcWGD1jIyXBNfsMMa3E8Nk8guahPipplCd/WvruyFjko57WRSj91YjNLJ+LuaBLt9w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(346002)(39860400002)(136003)(396003)(230922051799003)(82310400011)(64100799003)(451199024)(186009)(1800799009)(36840700001)(46966006)(40470700004)(478600001)(70586007)(70206006)(82740400003)(47076005)(55016003)(6666004)(86362001)(6916009)(316002)(9686003)(5660300002)(8676002)(1076003)(426003)(336012)(26005)(8936002)(16526019)(4326008)(40460700003)(40480700001)(2906002)(83380400001)(36860700001)(81166007)(356005)(33716001)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 11:08:32.8078 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f87734e9-af65-4182-491d-08dbd093bb96 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF00003442.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6053 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,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: Hi Simon, On Tue, Oct 10, 2023 at 04:40:11PM -0400, Simon Marchi wrote: > ... just because it seems to make sense to do so. > > Change-Id: Ie283c92d9b90c54e3deee96a43c6a942d8b5910b > --- > gdb/solib.c | 35 ++++++++++++++--------------------- > gdb/solist.h | 10 ++++++++++ > 2 files changed, 24 insertions(+), 21 deletions(-) > > diff --git a/gdb/solib.c b/gdb/solib.c > index 5ed223b8dfca..8f5b6e02e71c 100644 > --- a/gdb/solib.c > +++ b/gdb/solib.c > @@ -623,39 +623,32 @@ solib_map_sections (so_list &so) > return 1; > } > > -/* Free symbol-file related contents of SO and reset for possible reloading > - of SO. If we have opened a BFD for SO, close it. If we have placed SO's > - sections in some target's section table, the caller is responsible for > - removing them. > +/* See solist.h. */ > > - This function doesn't mess with objfiles at all. If there is an > - objfile associated with SO that needs to be removed, the caller is > - responsible for taking care of that. */ > - > -static void > -clear_so (so_list &so) > +void > +so_list::clear () > { > const target_so_ops *ops = gdbarch_so_ops (current_inferior ()->arch ()); > > - delete so.sections; > - so.sections = NULL; > + delete this->sections; > + this->sections = NULL; That's just a nit, but while at touching those lines, the NULL could be changed to nullptr. Best, Lancelot. > > - gdb_bfd_unref (so.abfd); > - so.abfd = NULL; > + gdb_bfd_unref (this->abfd); > + this->abfd = NULL; > > /* Our caller closed the objfile, possibly via objfile_purge_solibs. */ > - so.symbols_loaded = 0; > - so.objfile = NULL; > + this->symbols_loaded = 0; > + this->objfile = NULL; > > - so.addr_low = so.addr_high = 0; > + this->addr_low = this->addr_high = 0; > > /* Restore the target-supplied file name. SO_NAME may be the path > of the symbol file. */ > - strcpy (so.so_name, so.so_original_name); > + strcpy (this->so_name, this->so_original_name); > > /* Do the same for target-specific data. */ > if (ops->clear_so != NULL) > - ops->clear_so (so); > + ops->clear_so (*this); > } > > lm_info::~lm_info () = default; > @@ -674,7 +667,7 @@ lm_info::~lm_info () = default; > void > free_so (so_list &so) > { > - clear_so (so); > + so.clear (); > delete &so; > } > > @@ -1358,7 +1351,7 @@ reload_shared_libraries_1 (int from_tty) > && !solib_used (so)) > so->objfile->unlink (); > current_program_space->remove_target_sections (so); > - clear_so (*so); > + so->clear (); > } > > /* If this shared library is now associated with a new symbol > diff --git a/gdb/solist.h b/gdb/solist.h > index 5f9090a07c72..75e8e8ad0182 100644 > --- a/gdb/solist.h > +++ b/gdb/solist.h > @@ -38,6 +38,16 @@ using lm_info_up = std::unique_ptr; > > struct so_list > { > + /* Free symbol-file related contents of SO and reset for possible reloading > + of SO. If we have opened a BFD for SO, close it. If we have placed SO's > + sections in some target's section table, the caller is responsible for > + removing them. > + > + This function doesn't mess with objfiles at all. If there is an > + objfile associated with SO that needs to be removed, the caller is > + responsible for taking care of that. */ > + void clear () ; > + > /* The following fields of the structure come directly from the > dynamic linker's tables in the inferior, and are initialized by > current_sos. */ > > -- > 2.42.0 >