From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cYitItio9GnRGwkAWB0awg (envelope-from ) for ; Fri, 01 May 2026 09:21:28 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ID2Lqml9; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=sbLR433r; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=LtyXxyCn; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=NNR9CmEz; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 864161E0BA; Fri, 01 May 2026 09:21:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3E9AB1E067 for ; Fri, 01 May 2026 09:21:27 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 4CD0A44115CC for ; Fri, 1 May 2026 13:21:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CD0A44115CC Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ID2Lqml9; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=sbLR433r; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=LtyXxyCn; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=NNR9CmEz Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 4681E44115C1 for ; Fri, 1 May 2026 13:21:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4681E44115C1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4681E44115C1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777641660; cv=none; b=H/UELuP2IjdLtHdo1McYhiJEHyI1otzGBV9Y/MmP5NZj0Deu//Dr5yQddn1vY2IEk008PM0twl3XXuQ0MTQVQn9KsqxAZmssOpzz1D02qKf+1k8w9sqPoXwTuae8cXtqesEMXMPSEW0ejtWzcurFAfdDT7hKXIssIlJCE1Zd34M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777641660; c=relaxed/simple; bh=+H+iprzdL5h/8uvArUUwgtsyy1//Wqgl+KH0XGZeejA=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=elB7K7LXR5mFYOniziSG3vZ8sMxa5Jx3czAWEICeLeLxCCnH5++SsMXME/YgUZ0CcuJ6gbWAzIf9oFxCJasc+oKg/uGQtqRcB9JJLteKaKKU0M7V2lP5/PkVHAdVBOp9bhVpTilZi8J/1yqJOpKckPf9IynXc2SEcC2RaQh9oEY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4681E44115C1 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id ECA036A88F; Fri, 1 May 2026 13:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777641659; h=from:from:reply-to: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=dfMLeXR4grJcXmZ2HStDN0lNhqZopbn7ZAqchtoGLBE=; b=ID2Lqml9HzhCZrKWM/qJgLg3xYFoC3JqySrN9D4ErAEK8GB447F1z4OOoedgV8wbP1oE/u MFcb6jH9Mo3RDuQadYCsaQOdRVEAX4LEHAHwMTmyvPJMJlvxS087xSR9OtSjZAFuZ/Ne+m BrdvE3wJqKB7nK2bfe6YE913/pHdXeo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777641659; h=from:from:reply-to: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=dfMLeXR4grJcXmZ2HStDN0lNhqZopbn7ZAqchtoGLBE=; b=sbLR433rxZNSmyyYltDQ6czA/Z+MPBLRrvp4E6/clvGSs6PZama51TuRv2OajEp399i05e Euk+7t/WKkIh38Bg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=LtyXxyCn; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=NNR9CmEz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777641657; h=from:from:reply-to: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=dfMLeXR4grJcXmZ2HStDN0lNhqZopbn7ZAqchtoGLBE=; b=LtyXxyCncjH11Ha0YLRKCLUomM4/2yrApASs3pOHAzybwfH6cELJgPnn2rv9Di2XD324m4 rur1te1gFgFYFO6TeFTu7iNfW7zOoJ4w5tyuxh3SqCAxMhgdhEdYC4cpiroyGLpUzMewHR Jv+yH3/GKPyddl+EoHWFIYH9Nd29wT4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777641657; h=from:from:reply-to: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=dfMLeXR4grJcXmZ2HStDN0lNhqZopbn7ZAqchtoGLBE=; b=NNR9CmEz2eeTZ3CGtRgz7SoFESN57sJZjj7dxpSq6P0z+xDaq9NvsHfE5HdaIQSRMpRgzD uLOpqGcSrIKqFZAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D808E593B0; Fri, 1 May 2026 13:20:57 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id jgaQM7mo9GnBCgAAD6G6ig (envelope-from ); Fri, 01 May 2026 13:20:57 +0000 Message-ID: <43ea8c40-2938-420b-98ba-24eef1241d9c@suse.de> Date: Fri, 1 May 2026 15:20:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/7] [gdbsupport] Factor out base_next_iterator To: Simon Marchi , gdb-patches@sourceware.org References: <20260423063530.1074175-1-tdevries@suse.de> <20260423063530.1074175-4-tdevries@suse.de> <52ebd2ce-a27b-4cf6-81f4-ad3fa3537ee1@simark.ca> Content-Language: en-US From: Tom de Vries In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,sourceware.org:url,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Queue-Id: ECA036A88F X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 4/30/26 9:09 PM, Simon Marchi wrote: > On 4/30/26 12:24 PM, Simon Marchi wrote: >> Rather than copy paste what I mean here, I pushed what I think it could >> look like to the users/simark/next-iterator branch. >> >> https://sourceware.org/git/?p=binutils-gdb.git;a=shortlog;h=refs/heads/users/simark/next-iterator >> https://sourceware.org/cgit/binutils-gdb/log/?h=users/simark/next-iterator >> >> But just to illustrate here is how the function block iterator and >> range are implemented: >> >> /* Iterator and range type to iterate over this block and its superblocks >> within a function. */ >> >> struct function_block_incrementer >> { >> const block *operator() (const block &b) const noexcept >> { >> /* If the current item is the function-defining block, we're done. */ >> if (b.function () != nullptr) >> return nullptr; >> >> return b.superblock (); >> } >> }; >> >> using function_block_iterator >> = base_next_iterator; >> using function_block_range = iterator_range; > > Just a note: in your version, if you pass a global or static block to > function_block_iterator, it sets the item to nullptr right away, so you > iterate on nothing. I couldn't do that in my version, so I chose to > assert that the block isn't global or static, which puts the > responsibillity on the caller not to call this on a global or static > block. The only caller is in ada-lang.c, it passes the result of > get_frame_block(). I guess that a block from a frame is always in a > function (is not the global or static block), but if that assumption > isn't true, then a check would be needed in the caller. I think letting the iterator sort this out is the better option. Thanks, - Tom