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 6FF553857010 for ; Mon, 24 Aug 2020 20:34:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6FF553857010 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 07OKYnFB017910 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Aug 2020 16:34:54 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 07OKYnFB017910 Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (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 B17251E599; Mon, 24 Aug 2020 16:34:49 -0400 (EDT) Subject: Re: [PATCH] gdb: add gdb_bfd_all_sections for range-based iteration To: Tom Tromey , Simon Marchi via Gdb-patches References: <20200824194333.196744-1-simon.marchi@polymtl.ca> <87a6yjbxbf.fsf@tromey.com> From: Simon Marchi Message-ID: Date: Mon, 24 Aug 2020 16:34:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <87a6yjbxbf.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Mon, 24 Aug 2020 20:34:49 +0000 X-Spam-Status: No, score=-4.9 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-DCC: : antispam2020.polymtl.ca 1102; Body=1 Fuz1=1 Fuz2=1 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: Mon, 24 Aug 2020 20:34:58 -0000 On 2020-08-24 4:31 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> I wanted to make a nicer / type-safe interface for > Simon> bfd_map_over_sections, avoiding the `void *` data parameter. > > Simon> My first shot was to make a wrapper for bfd_map_over_sections, > Simon> gdb_bfd_map_over_sections that took a gdb::function_view. > > Simon> However, I think that a range adapter gives nicer and simpler code, as a > Simon> simple for loop is easier to read than a callback / lambda function. So > Simon> here it is, it uses next_iterator and next_adapter, so it's not much > Simon> code. > > Simon> As an example, I ported maintenance_info_sections and friends to use it. > Simon> The maint_print_section_data type could probably be removed now, but I > Simon> didn't want to do too much in one patch. > > I also did this kind of thing -- I have some patches to remove many uses > of bfd_map_over_sections, though not all of them, since some seem hard > to test. What approach did you take? Simon