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 3ECCF3858D33 for ; Fri, 2 Apr 2021 15:52:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3ECCF3858D33 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 132FqRTV003950 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Apr 2021 11:52:32 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 132FqRTV003950 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (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 9C6321E789; Fri, 2 Apr 2021 11:52:27 -0400 (EDT) Subject: Re: [PATCH 4/4] gdb: remove objfile parameter from get_objfile_bfd_data To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20210322193417.2376788-1-simon.marchi@efficios.com> <20210322193417.2376788-5-simon.marchi@efficios.com> <875z15q4dq.fsf@tromey.com> From: Simon Marchi Message-ID: <1549f8ab-92e7-120a-cc02-9748e2bcdd98@polymtl.ca> Date: Fri, 2 Apr 2021 11:52:27 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <875z15q4dq.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 2 Apr 2021 15:52:27 +0000 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2021 15:52:36 -0000 On 2021-04-01 1:52 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> But if the BFD requires relocation, get_objfile_bfd_data returns a newly > Simon> allocated object that isn't kept anywhere else (and isn't shared). So > Simon> the objfile becomes the owner of the objfile_per_bfd_storage object. In > Simon> objfile::~objfile, we have this: > > Simon> if (obfd) > Simon> gdb_bfd_unref (obfd); > Simon> else > Simon> delete per_bfd; > > Simon> I'm thinking that obfd could be non-nullptr, and it could require > Simon> relocation. In that case, it would never be freed. Anyway, that's not > Simon> really connected to this patch. > > Yes, this seems like a bug. Probably objfile should just have an > explicit "owns_per_bfd" boolean somewhere. > > Simon> gdb/ChangeLog: > > Simon> * objfiles.c (get_objfile_bfd_data): Remove objfile parameter, > Simon> adjust callers. > > This looks good to me. Thank you. Thanks, all pushed now. I removed the last sentence of the get_objfile_bfd_data comment, it didn't seem appropriate anymore. Simon