From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QCmwC806HmnG3xQAWB0awg (envelope-from ) for ; Wed, 19 Nov 2025 16:46:53 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=EpjhioW2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 178C61E0B6; Wed, 19 Nov 2025 16:46:53 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 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 697E61E048 for ; Wed, 19 Nov 2025 16:46:52 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B93A3856090 for ; Wed, 19 Nov 2025 21:46:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0B93A3856090 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=EpjhioW2 Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 6F9FE3850850 for ; Wed, 19 Nov 2025 21:46:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F9FE3850850 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F9FE3850850 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763588776; cv=none; b=VC6jdJ6YsCQgZZnh04y7ejS6eFd9bjccucljtH4/mW8MA2YJXutIfA5N3xbU3bJWaCGZXozjjV2j6FBlOOQ8Rw3WyJoIteDur/TYcTp/3/6mU+ZsqKHBqMPx89g3wHd2CaJEGRUaqRgZlJMmJ0SST6KO21SG2fgYJcU9iAMTM7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763588776; c=relaxed/simple; bh=V9qLQa29EzlcslyJKJ544qaYDEY3tHcqMkKl4hPZgz4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=b0jLYbOprWh56b0WlXP4le2eJXmnZhGgGK6CI0kWLuEhI9pgU2rKRJo8DsMQnbgwRu7LAz57WUNlXB1V8arYoGH4IJamGonPBKFQsZrEHLS6cIQUmcJwe6YWoXJHor7JPZhuD8BQoLC/iIRhpnEdfb+3opT7aPHzI3O+pWlg5pY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F9FE3850850 Received: from eig-obgw-5005b.ext.cloudfilter.net ([10.0.29.189]) by cmsmtp with ESMTPS id LomZvE27XSkcfLq0GvqANW; Wed, 19 Nov 2025 21:46:16 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Lq0Fvn9D3jAxuLq0Fvg4HP; Wed, 19 Nov 2025 21:46:15 +0000 X-Authority-Analysis: v=2.4 cv=EoDSrTcA c=1 sm=1 tr=0 ts=691e3aa7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=6UeiqGixMTsA:10 a=ItBw4LHWJt0A:10 a=QUjLiO_1mW03i8pX5xUA:9 a=VS4QxaUSPT0UtbFnIvSC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=IOW375QQNy5l4KYgvUPcHVGC+XAUYFNMW2RvPAZz53M=; b=EpjhioW2qNqRtDnrVS4fcAQ0yO tNb0T7G1NoB42YYvYSKCooEOzuWl147FKdGTCbp2tgYctqg4/bQJwjFNp8RWW22mFjAcbYi2Ph30u OUGiN1zj8R/v+0Dfow7/DRBrr; Received: from 97-122-120-205.hlrn.qwest.net ([97.122.120.205]:33118 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vLq0B-000000047wu-3dLP; Wed, 19 Nov 2025 14:46:12 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove a call to blockvector::map Date: Wed, 19 Nov 2025 14:45:59 -0700 Message-ID: <20251119214559.1468541-1-tom@tromey.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.120.205 X-Source-L: No X-Exim-ID: 1vLq0B-000000047wu-3dLP X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-120-205.hlrn.qwest.net (localhost.localdomain) [97.122.120.205]:33118 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMqZyOO9Q3bkW/aaM2aVmNxJYuvHUjbS+3D1HxSroNq9RFVyDk0xSrBgYFdeq5N5bbZog3MuM09/FIYwUQBKbViT5IkLwi8p7vAjx4XFbfi80gXmemf2 QXJXV/OKDiyehbM+fiWfQxgkfCXy4XjadOefaQY8ngMVJWVo+xyh+xPJ1NFnuxfFFNRHBJYepPm368hEK3JKuz+jO6Yp3Vt/Ndk= 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 block_starting_point_at checks blockvector::map before doing a lookup. This patch removes this call, a step toward making the blockvector API a bit more opaque. It arranges to find the necessary blockvector just once, in gather_inline_frames, and then uses the 'lookup' method to find the desired block. Note that this is a slight change of semantics, in that the old code looked only in the map while the new code looks in the blockvector, regardless of whether a map was made. However, I don't think this should matter, and furthermore this seems like an abstraction violation, with the inline-frame code knowing details of how buildsym decided to create the blockvector. in the longer run, I think only the 'lookup' method should be provided by blockvector -- that is, separately checking the map should be impossible. The idea here is that eventually, for lazy CU expansion, we will want to be able to expand the blockvector. This may be easier with a different underlying data structure, so perhaps the map will go away entirely. After this patch, one such use remains. Regression tested on x86-64 Fedora 40. --- gdb/inline-frame.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c index 5ec18e90547..649acab5793 100644 --- a/gdb/inline-frame.c +++ b/gdb/inline-frame.c @@ -283,19 +283,13 @@ const struct frame_unwind_legacy inline_frame_unwind ( /* Return true if BLOCK, an inlined function block containing PC, has a group of contiguous instructions starting at PC (but not - before it). */ + before it). BV is the blockvector holding BLOCK. */ static bool -block_starting_point_at (CORE_ADDR pc, const struct block *block) +block_starting_point_at (const blockvector *bv, CORE_ADDR pc, + const struct block *block) { - const struct blockvector *bv; - const struct block *new_block; - - bv = blockvector_for_pc (pc, NULL); - if (bv->map () == nullptr) - return false; - - new_block = (const struct block *) bv->map ()->find (pc - 1); + const struct block *new_block = bv->lookup (pc - 1); if (new_block == NULL) return true; @@ -361,8 +355,9 @@ gather_inline_frames (CORE_ADDR this_pc) /* Build the list of inline frames starting at THIS_PC. After the loop, CUR_BLOCK is expected to point at the first function symbol (inlined or not) "containing" the inline frames starting at THIS_PC. */ - const block *cur_block = block_for_pc (this_pc); - if (cur_block == nullptr) + const block *cur_block; + const blockvector *bv = blockvector_for_pc (this_pc, &cur_block); + if (bv == nullptr) return {}; std::vector function_symbols; @@ -375,7 +370,7 @@ gather_inline_frames (CORE_ADDR this_pc) /* See comments in inline_frame_this_id about this use of BLOCK_ENTRY_PC. */ if (cur_block->entry_pc () == this_pc - || block_starting_point_at (this_pc, cur_block)) + || block_starting_point_at (bv, this_pc, cur_block)) function_symbols.push_back (cur_block->function ()); else break; -- 2.49.0