From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UcmXOmal9GnSEwkAWB0awg (envelope-from ) for ; Fri, 01 May 2026 09:06:46 -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=xSo3FjjN; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MGCc0bkP; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xSo3FjjN; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MGCc0bkP; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EB82D1E0BA; Fri, 01 May 2026 09:06:46 -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 3EA4D1E067 for ; Fri, 01 May 2026 09:06:46 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id D05BB46A9CF4 for ; Fri, 1 May 2026 13:06:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D05BB46A9CF4 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=xSo3FjjN; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MGCc0bkP; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xSo3FjjN; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=MGCc0bkP 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 5BD27490030A for ; Fri, 1 May 2026 13:06:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BD27490030A 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 5BD27490030A 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=1777640781; cv=none; b=dGElIECuGSStncN5N0+RTEW7Jkkn8NPGGGjBQtRnAQMYJe72wUGpd2pF0Kie2dzNBzmsmvVa8bmYuSOkfimKu36Mtfrxk/H7BBmUJmUEOgJ9iLo9j7QtPRjR8elPwkwrA6IslD+nGVCApcEs1UWxAQP8FScA8HhiCnYau428CsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777640781; c=relaxed/simple; bh=gaH4/5ItSE9iKXZI9cTdfQJ3xLOK/EU/DW1mCQSMVcA=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=Oq3kOODU3eTdkw7EvrfnlwzYTtuuMaANQdJgIY6lyXlJwMY6MI0C9kS24oGPQeaa5fOisXr7epP8TFaIFSpPPFCz9nHZk7AiutSd0iQPnoBECK4UZxklEnA97he5U+zZhxvlmKONvxa2V1yj4ffqLJ3tKDcIaDAn4HSZaviP2f8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BD27490030A Received: from imap1.dmz-prg2.suse.org (unknown [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 A2EFA6A8B6; Fri, 1 May 2026 13:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777640779; 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=sdbz+qRS7goHQFLlkGBNxrZg5ZS7lKhyEFCI9GN9u6w=; b=xSo3FjjN0RFGrypq3JuYOBF6owGOaCJTEp8qKe/pMcxQr+Zrda7pPHSqiezNwxBdbXrGh3 jOSQNEhrISS6QX1umjhExkeVpcVMGvBL7uyjeg2y1AZzk1c8Ce/xjEgTb3YuZJbb3o3Huk ZjL+rCANvmNeMrR4aSR19PBvnasHpVo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777640779; 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=sdbz+qRS7goHQFLlkGBNxrZg5ZS7lKhyEFCI9GN9u6w=; b=MGCc0bkPg0+QR1TLjyqjg54982t0DJhuSGPXfC/4fViRVRfRonUQHwHK4YNHqqRFJaeAzQ yX+zHrAvGNgyHOBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1777640779; 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=sdbz+qRS7goHQFLlkGBNxrZg5ZS7lKhyEFCI9GN9u6w=; b=xSo3FjjN0RFGrypq3JuYOBF6owGOaCJTEp8qKe/pMcxQr+Zrda7pPHSqiezNwxBdbXrGh3 jOSQNEhrISS6QX1umjhExkeVpcVMGvBL7uyjeg2y1AZzk1c8Ce/xjEgTb3YuZJbb3o3Huk ZjL+rCANvmNeMrR4aSR19PBvnasHpVo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1777640779; 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=sdbz+qRS7goHQFLlkGBNxrZg5ZS7lKhyEFCI9GN9u6w=; b=MGCc0bkPg0+QR1TLjyqjg54982t0DJhuSGPXfC/4fViRVRfRonUQHwHK4YNHqqRFJaeAzQ yX+zHrAvGNgyHOBQ== 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 8F311593B0; Fri, 1 May 2026 13:06:19 +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 xMvKIUul9GmaewAAD6G6ig (envelope-from ); Fri, 01 May 2026 13:06:19 +0000 Message-ID: Date: Fri, 1 May 2026 15:06:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/7] [gdb] Add block::superblocks To: Jan Vrany , gdb-patches@sourceware.org References: <20260423063530.1074175-1-tdevries@suse.de> <20260423063530.1074175-5-tdevries@suse.de> <68a8fb3fdf0ed5a00262f8d37e31f879b0da214b.camel@vrany.io> Content-Language: en-US From: Tom de Vries In-Reply-To: <68a8fb3fdf0ed5a00262f8d37e31f879b0da214b.camel@vrany.io> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid, imap1.dmz-prg2.suse.org:helo, sourceware.org:url] 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/27/26 1:11 PM, Jan Vrany wrote: >> Add a function block::superblocks that can be used to transform: > > Hi, > > a nit: shouldn't the commit summary and message say super_blocks (with underscore)? > > Hi Jan, yes, though now I've renamed it to blocks::block_and_superblocks, so that's fixed in the v1 ( https://sourceware.org/pipermail/gdb-patches/2026-May/227068.html ). > On Thu, 2026-04-23 at 08:35 +0200, Tom de Vries wrote: >> Add a function block::superblocks that can be used to transform: >> ... >>   while (block != NULL) >>     { >>       ... >>       block = block->superblock (); >>     } >> ... >> into: >> ... >>   for (auto b : block::super_blocks (block)) >>     { >>       ... >>     } >> ... >> >> I'm not sure about the name.  It might suggest that block is not included in >> the iteration, but in fact it is. > > >> I considered block::block_and_supers () instead, but it seems a bit awkward. > > I'd personally prefer block::block_and_supers over block::super_blocks. It's bit > awkward, but better awkward than misleading. > Thanks for weighing in. As mentioned, I've gone with blocks::block_and_superblocks, so I hope that's clear enough. >> --- >>  gdb/block.h | 36 ++++++++++++++++++++++++++++++++++++ >>  1 file changed, 36 insertions(+) >> >> diff --git a/gdb/block.h b/gdb/block.h >> index 091120ae2b8..4a1db79d7ed 100644 >> --- a/gdb/block.h >> +++ b/gdb/block.h >> @@ -108,6 +108,27 @@ struct blockranges >> >>  struct block : public allocate_on_obstack >>  { >> +  /* Variant of next_iterator using the superblock field instead of next.  */ >> +  struct superblock_iterator : base_next_iterator >> +  { >> +    typedef superblock_iterator self_type; >> + >> +    explicit superblock_iterator (value_type item) >> +      : base_next_iterator (item) >> +    { >> +    } >> + >> +    superblock_iterator () = default; >> + >> +    self_type &operator++ () >> +    { >> +      this->m_item = this->m_item->superblock (); >> +      return *this; >> +    } >> +  }; >> + >> +  using superblock_range = iterator_range; >> + >>    /* Return this block's start address.  */ >>    CORE_ADDR start () const >>    { return m_start; } >> @@ -306,6 +327,21 @@ struct block : public allocate_on_obstack >> >>    struct dynamic_prop *static_link () const; >> >> > > I think comment would be useful here, especially as "super_blocks" > returns this block AND all its superblocks. > I've added comments in the v1, thanks for pointing this out. Thanks, - Tom >> +  superblock_range super_blocks () const >> +  { >> +    superblock_range::iterator begin (this); >> + >> +    return superblock_range (std::move (begin)); >> +  } >> + >> +  static superblock_range super_blocks (const block *b) >> +  { >> +    if (b == nullptr) >> +      return superblock_range (); >> + >> +    return b->super_blocks (); >> +  } >> + > > > Thanks! > > Jan > >