From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id vk3JN3un7mi0WzIAWB0awg (envelope-from ) for ; Tue, 14 Oct 2025 15:41:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1760470907; bh=m/K7KyqMSRao6lKocHjg3uMUUYPF0UaUez6WTbu6g/0=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DSwU8zDnCbDIs46XH1NPeMtWeW/Sg1j2rrLHeMbg3RskCRReytsxTY0TPFi0TEb7N M9Pt7h8Za3lrL+NBOrsLOU0U39vWnENfyqmFBGJHvg2/Edtyc9s6mo0kcLiRn/paH+ 4c9ifGEw4Fr8Pz73IlM8UHfdJvmzuH4XWlK02bTM= Received: by simark.ca (Postfix, from userid 112) id D5A1E1E047; Tue, 14 Oct 2025 15:41:47 -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_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=gPzSzbMZ; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 1EE541E047 for ; Tue, 14 Oct 2025 15:41:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B5753385703C for ; Tue, 14 Oct 2025 19:41:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5753385703C Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=gPzSzbMZ Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 369953858D35 for ; Tue, 14 Oct 2025 19:41:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 369953858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 369953858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760470868; cv=none; b=tUDEk+MULRDUecLqUfC+IK5p8P8Qtt510xjb5k8x8H3lunlgPPSso2SErk8zRiFgWFmv+pd/CY5I3nBccPTUAJsuVDzR+2ZOxObhLO8jLAZzIhRVko5/Swojf05BOlIfZDEjeHum/mbCPuu4gIIEqbvhOw2v+ANtsUNIjkdQN6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760470868; c=relaxed/simple; bh=m/K7KyqMSRao6lKocHjg3uMUUYPF0UaUez6WTbu6g/0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=kPspohAkh5NkGe55aEr4fzkVFhP5IjFuX/+EjVXUPtX032GnR/LxSLYxpJKENSyfeowrTqpnuvV1+5/LJ7rk/NeS3UMemkESo5jjWVNFAOoRty0Z/xSgozK6oRYp6cHMcCTjgO8+LOftlcPTH9GqzQtWP8+JsK9CjHh/7/qU11E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 369953858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1760470867; bh=m/K7KyqMSRao6lKocHjg3uMUUYPF0UaUez6WTbu6g/0=; h=Date:Subject:To:References:From:In-Reply-To:From; b=gPzSzbMZEd/uja+uI9qHi5M9lAiSjp1bveLg+eeJiyz6PU/qNg5GeDM2RXjHSBIYz LBWCjVN9uqJTbmYxqjP5kgVAfI+EIPxNCRUlS7MwY4b18ehawFnPun23FuTqq9OXBV OQwkjctGKEwm+X1TiqTfAfnrnutUmB4fVxBGtrWE= Received: by simark.ca (Postfix) id A61071E047; Tue, 14 Oct 2025 15:41:07 -0400 (EDT) Message-ID: <77c4be93-0eac-4477-a7c2-62724a841db9@simark.ca> Date: Tue, 14 Oct 2025 15:41:06 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] gdb: use std::vector<> to hold on blocks in struct blockvector To: Andrew Burgess , Jan Vrany , gdb-patches@sourceware.org References: <20251013182318.1045138-1-jan.vrany@labware.com> <20251013182318.1045138-3-jan.vrany@labware.com> <87v7kha5pg.fsf@redhat.com> Content-Language: fr From: Simon Marchi In-Reply-To: <87v7kha5pg.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 10/14/25 11:00 AM, Andrew Burgess wrote: >> @@ -809,6 +810,41 @@ make_blockranges (struct objfile *objfile, >> return blr; >> } >> >> +static bool >> +block_ordering_predicate (struct block *b1, struct block *b2) > > Functions should have a comment above them. > >> +{ >> + CORE_ADDR start1 = b1->start (); >> + CORE_ADDR start2 = b2->start (); >> + >> + if (start1 != start2) >> + return start1 < start2; >> + return (b2->end () < b1->end ()); >> +} > > I notice that we use a slightly different ordering function in > buildsym.c, one that doesn't consider the end address. Probably doesn't > matter, but maybe it's at least worth mentioning in a comment or the > commit message, that way, if someone is looking at the code in the > future they can understand why these things are different. Even if the > reason is just "we have no motivating example for why these should be > the same right now". buildsym sorts them (locally, in its singly-linked list) in the inverse order, but then fills the blockvector backwards. So the blocks end up in the right order in the blockvector. I think this is an artefact from the past and could be simplified. The predicate for sorting blocks in a blockvector should probably be written just once (in block.h) and used by whoever needs it. Simon