From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113925 invoked by alias); 16 Mar 2018 03:29:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 113899 invoked by uid 89); 16 Mar 2018 03:29:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1370 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Mar 2018 03:29:22 +0000 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 w2G3TFil013354 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 15 Mar 2018 23:29:20 -0400 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 452D91E4B2; Thu, 15 Mar 2018 23:29:15 -0400 (EDT) Subject: Re: [RFA] Remove make_cleanup_free_section_addr_info To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20180313165529.23237-1-tom@tromey.com> <87605wspqx.fsf@tromey.com> From: Simon Marchi Message-ID: <4fe276e4-d179-a515-be12-a9e6899bbca2@polymtl.ca> Date: Fri, 16 Mar 2018 03:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <87605wspqx.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 16 Mar 2018 03:29:15 +0000 X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00319.txt.bz2 On 2018-03-15 10:44 PM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> Did you consider changing the section_addr_info struct to use entirely > Simon> by an std::vector? Functions that return a > Simon> section_addr_info could return a vector directly (by value? is that > Simon> how we say it?), so we shouldn't need any custom unique pointer. > Simon> Then, other_sections::name can be made into a string, removing the > Simon> need to free it by hand. > > I didn't really consider it, but thanks for the idea. It turned out to > be more invasive, but it did remove one weirdness from > syms_from_objfile_1. Previously that function did: > > local_addr = alloc_section_addr_info (1); > > ... however, it doesn't actually need 1 entry -- the way this is set up, > the minimum that can be requested is 1, but the returned > section_addr_info actually has num_sections set to 0. Obscure! > > In the new code this is replaced by an empty vector. > > Let me know what you think. I did re-run this through the buildbot. > > One idea I had is that maybe other_sections should have a constructor. > That would simplify some of the code. Hi Tom, I took a quick look, it LGTM, but indeed having a constructor in other_sections would make it nicer IMO. Simon