From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4VeiESin6GmYjTMAWB0awg (envelope-from ) for ; Wed, 22 Apr 2026 06:47:04 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=vrany.io header.i=@vrany.io header.a=rsa-sha256 header.s=protonmail3 header.b=o5nEDxmL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4442B1E067; Wed, 22 Apr 2026 06:47:04 -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 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 6570F1E067 for ; Wed, 22 Apr 2026 06:47:03 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 091E042FA7A6 for ; Wed, 22 Apr 2026 10:46:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 091E042FA7A6 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=vrany.io header.i=@vrany.io header.a=rsa-sha256 header.s=protonmail3 header.b=o5nEDxmL Received: from mail-244120.protonmail.ch (mail-244120.protonmail.ch [109.224.244.120]) by sourceware.org (Postfix) with ESMTPS id B862C48FE57B for ; Wed, 22 Apr 2026 10:30:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B862C48FE57B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=vrany.io Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrany.io ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B862C48FE57B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=109.224.244.120 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776853827; cv=none; b=mBtlOTtkMs//MU0tLfS2EwZ+0qje0x4Qt12nSCencQ5u563e/zrWH+3uFHQIovDf6jKxu5orsDHRajyOUCaVhypiIG+grCXEmsLXMIOcxpLf39sd/wwOuNJwcqW4DzdsDACl9itRq99iJCKHIbfxUzSE2Xn1UNFUnUyQ24nFB/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776853827; c=relaxed/simple; bh=ph5bwX0MklzUCwMuH2Pm938LfV24tYqzBsphbhxGsVU=; h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version; b=gmrucXmtQZtYwAlSK3hmge3EW0r6t5/bKxmWdkq+mdtV4qzCmzJ8nV0oynwz3h8TDdEwZC+I61Bxz5UOGmSpTklB2MaA6Gb8jyUiGqCH6g1zlRLaobu6/EkZW8GBxLbmBRTito8YiqBHJeZ0kziuzQqC5FW/1oqkVdd3ahe1UsA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B862C48FE57B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrany.io; s=protonmail3; t=1776853825; x=1777113025; bh=7twP+GKltxCStssBQnnb1kY4ZSKg7Bf2B7oNPwjuhWA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=o5nEDxmLj5hIn3ODyPvl/gXD6TuBl1vaVrSKU6Ul6b7H5J+K2ZIQODi21oYCZXsPa n+wmVtNex414+B3qKYR2mf1BCB2xdmA4f6PKp1kuj1fvnin/aJ0ufkg9u4WQ6vqqH4 OHve09wtQe9TNMt5xi7AguMPPYT7zv6N+FXcPZOD9hTA/CNf/FqJvDzSIQivKGvZgg rKJs8vGqDY46WcnVK/W51k8Bbe6zY4L3pd0Q3v1N8c82krlPnw0C40BvGCxFgQJ+fQ LhL4OVMEhNtNie5xjyq2odnuiAasEBC6Le/ZAOJ6dt0Qn3WtlMh67tEhQ/TycsuH30 q0cEkWvIPiYlA== Date: Wed, 22 Apr 2026 10:30:21 +0000 To: gdb-patches@sourceware.org From: Jan Vrany Cc: Jan Vrany Subject: [PATCH v3 6/7] gdb: remove address map from struct blockvector Message-ID: <20260422102923.1185738-7-jan@vrany.io> In-Reply-To: <20260304165914.3209106-1-jan.vrany@labware.com> References: <20260304165914.3209106-1-jan.vrany@labware.com> Feedback-ID: 40767693:user:proton X-Pm-Message-ID: 0a740bcebd5c9892e0d5ef846676382d7b9988ac MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 This commit removes m_map member and its accessors from struct blockvector since it is no longer used. It also updates unit test accordingly. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D33829 --- gdb/block-selftests.c | 90 ++++++++++++------------------------------- gdb/block.c | 10 ----- gdb/block.h | 13 ------- 3 files changed, 24 insertions(+), 89 deletions(-) diff --git a/gdb/block-selftests.c b/gdb/block-selftests.c index d23783d6bdc..77b8d67ded8 100644 --- a/gdb/block-selftests.c +++ b/gdb/block-selftests.c @@ -40,35 +40,19 @@ make_block (struct blockvector &bv, struct obstack &ob,= CORE_ADDR start, return b; } =20 -/* A helper to create and set address map given a blockvector. */ static void -make_map (struct blockvector &bv, struct obstack &ob) +test_blockvector_lookup_contains () { - struct addrmap_mutable map; - - for (int i =3D bv.num_blocks () - 1; i > STATIC_BLOCK; i--) - { - auto b =3D bv.block (i); - map.set_empty (b->start (), b->end () - 1, b); - } - - bv.set_map (new (&ob) addrmap_fixed (&ob, &map)); -} - -/* Create and return blockvector with following blocks: + /* Create blockvector with following blocks: =20 =09B0 0x1000 - 0x4000 (global block) =09B1 0x1000 - 0x4000 (static block) -=09 B2 0x1000 - 0x2000 +=09 B2 0x1000 - 0x2000 =09=09=09=09(hole) -=09 B3 0x3000 - 0x4000 - - If USE_MAP is true, then also set blockvector's address map. -*/ -static blockvector_up -make_blockvector (struct obstack &ob, bool use_map) -{ - auto bv =3D std::make_unique (0); +=09 B3 0x3000 - 0x4000 + */ + auto_obstack ob; + blockvector_up bv =3D std::make_unique (0); =20 auto global_block =3D make_block (*bv.get (), ob, 0x1000, 0x4000); auto static_block =3D make_block (*bv.get (), ob, 0x1000, 0x4000, @@ -76,51 +60,25 @@ make_blockvector (struct obstack &ob, bool use_map) make_block (*bv.get (), ob, 0x1000, 0x2000, static_block); make_block (*bv.get (), ob, 0x3000, 0x4000, static_block); =20 - if (use_map) - make_map (*bv.get (), ob); + /* Test address outside global block's range. */ + SELF_CHECK (bv->lookup (0x0500) =3D=3D nullptr); + SELF_CHECK (bv->contains (0x0500) =3D=3D false); =20 - return bv; -} + /* Test address falling into a block. */ + SELF_CHECK (bv->lookup (0x1500) =3D=3D bv->block (2)); + SELF_CHECK (bv->contains (0x1500) =3D=3D true); =20 -static void -test_blockvector_lookup_contains () -{ - for (bool with_map : { false, true }) - { - /* Test blockvector without an address map. */ - auto_obstack ob; - blockvector_up bv =3D make_blockvector (ob, with_map); - - /* Test address outside global block's range. */ - SELF_CHECK (bv->lookup (0x0500) =3D=3D nullptr); - SELF_CHECK (bv->contains (0x0500) =3D=3D false); - - /* Test address falling into a block. */ - SELF_CHECK (bv->lookup (0x1500) =3D=3D bv->block (2)); - SELF_CHECK (bv->contains (0x1500) =3D=3D true); - - /* Test address falling into a "hole". If BV has an address map, -=09 lookup () returns nullptr and contains (). returns false. If not, -=09 lookup () return static block and contains() returns true. */ - if (with_map) -=09{ -=09 SELF_CHECK (bv->lookup (0x2500) =3D=3D nullptr); -=09 SELF_CHECK (bv->contains (0x2500) =3D=3D false); -=09} - else -=09{ -=09 SELF_CHECK (bv->lookup (0x2500) =3D=3D bv->block (STATIC_BLOCK)); -=09 SELF_CHECK (bv->contains (0x2500) =3D=3D true); -=09} - - /* Test address falling into a block above the "hole". */ - SELF_CHECK (bv->lookup (0x3500) =3D=3D bv->block (3)); - SELF_CHECK (bv->contains (0x3500) =3D=3D true); - - /* Test address outside global block's range. */ - SELF_CHECK (bv->lookup (0x4000) =3D=3D nullptr); - SELF_CHECK (bv->contains (0x4000) =3D=3D false); - } + /* Test address falling into a "hole". */ + SELF_CHECK (bv->lookup (0x2500) =3D=3D bv->block (STATIC_BLOCK)); + SELF_CHECK (bv->contains (0x2500) =3D=3D true); + + /* Test address falling into a block above the "hole". */ + SELF_CHECK (bv->lookup (0x3500) =3D=3D bv->block (3)); + SELF_CHECK (bv->contains (0x3500) =3D=3D true); + + /* Test address outside global block's range. */ + SELF_CHECK (bv->lookup (0x4000) =3D=3D nullptr); + SELF_CHECK (bv->contains (0x4000) =3D=3D false); } =20 } /* namespace selftests */ diff --git a/gdb/block.c b/gdb/block.c index b266ec38ea4..98c99145b15 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -842,11 +842,6 @@ blockvector::lookup (CORE_ADDR addr) const if (addr < start || end <=3D addr) return nullptr; =20 - /* If we have an addrmap mapping code addresses to blocks, then use - that. */ - if (map () !=3D nullptr) - return (const struct block *) map ()->find (addr); - /* Otherwise, use binary search to find the last block that starts before PC. Note: GLOBAL_BLOCK is block 0, STATIC_BLOCK is block 1. @@ -925,11 +920,6 @@ void blockvector::relocate (struct objfile *objfile, =09=09 gdb::array_view offsets) { - int block_line_section =3D SECT_OFF_TEXT (objfile); - - if (m_map !=3D nullptr) - m_map->relocate (offsets[block_line_section]); - for (struct block *b : m_blocks) b->relocate (objfile, offsets); } diff --git a/gdb/block.h b/gdb/block.h index 34bafb962d7..72bc4a5dca3 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -492,14 +492,6 @@ struct blockvector const struct block *static_block () const { return this->block (STATIC_BLOCK); } =20 - /* Const version of the above. */ - const addrmap_fixed *map () const - { return m_map; } - - /* Set this blockvector's address -> block map. */ - void set_map (addrmap_fixed *map) - { m_map =3D map; } - /* Block comparison function. Returns true if B1 must be ordered before B2 in a blockvector, false otherwise. */ static bool block_less_than (const struct block *b1, const struct block = *b2); @@ -526,11 +518,6 @@ struct blockvector =09=09 gdb::array_view offsets); =20 private: - /* An address map mapping addresses to blocks in this blockvector. - This pointer is zero if the blocks' start and end addresses are - enough. */ - addrmap_fixed *m_map =3D nullptr; - /* The blocks themselves. */ std::vector m_blocks; }; --=20 2.53.0