From patchwork Tue Apr 16 17:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 88557 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1DB403847718 for ; Tue, 16 Apr 2024 17:06:39 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id C80033858416 for ; Tue, 16 Apr 2024 17:05:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C80033858416 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 C80033858416 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713287132; cv=none; b=TfvFbmCL4h/dWhLxl0vXnQ/v2RNq7fYbwRPrC7bgCyQ8BBZL2uEmN69Az6w3xz+bIEzsChtc2yhLHOqfW5VFXWVg0QK8/VsP9mMog6rW2LftzF2/802rZwI/X3prNoB5fvK5cSKFwHDWG4WNkx5jlN8TyDIelGpRLfIC0R7vs4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713287132; c=relaxed/simple; bh=g6hrrXBQce1Xub4juoO9Mqja0J2x64HeeZlG+xbr6EE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=rWeCdKnzr7sgixBXZAej8wKC/8awkkuG2tt2mx3W5OMpTtU94lAolghNMeDzEpHxXt+OU5ytT+jGOsUf7C+O9AyKXJAEC5OrKumBAlp4OYycpOW8CIA7zTiO6xo5MOnDE2b3Kv4AZiYOKMaoxWOBb3QRMhQT+YmJYo7FSm32GLc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5004a.ext.cloudfilter.net ([10.0.29.221]) by cmsmtp with ESMTPS id wEHWrU7GbHXmAwmFJrB8CV; Tue, 16 Apr 2024 17:05:25 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id wmFIrMwSvGDo0wmFIrhH9y; Tue, 16 Apr 2024 17:05:25 +0000 X-Authority-Analysis: v=2.4 cv=I+uuR8gg c=1 sm=1 tr=0 ts=661eafd5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=raytVjVEu-sA:10 a=Qbun_eYptAEA:10 a=n2ZCfAgK6ObDiUX-HLQA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=IEiPbMeMqSugjDb0pu+IY58xvDbyBwSLSmM2fr2XXYc=; b=ZPoDR5DPwRBie3S3VcEQkVFbpB zLgvfTpnQnEE0fte8XJBvdOVdPHQcXqT7EyDDrHuEAJuUE7djHCRJEZkesceYM5TSnsuqr5TID/+J xQeAYmg7QN731m30AlrcHgmkP; Received: from 97-122-82-115.hlrn.qwest.net ([97.122.82.115]:36636 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rwmFI-002fVU-1H for gdb-patches@sourceware.org; Tue, 16 Apr 2024 11:05:24 -0600 From: Tom Tromey Date: Tue, 16 Apr 2024 11:05:24 -0600 Subject: [PATCH 2/5] Remove more calls to dwarf2_per_objfile::adjust MIME-Version: 1.0 Message-Id: <20240416-dwarf-race-relocate-2-v1-2-1fc912e95e87@tromey.com> References: <20240416-dwarf-race-relocate-2-v1-0-1fc912e95e87@tromey.com> In-Reply-To: <20240416-dwarf-race-relocate-2-v1-0-1fc912e95e87@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.13.0 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.82.115 X-Source-L: No X-Exim-ID: 1rwmFI-002fVU-1H X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-82-115.hlrn.qwest.net ([192.168.0.21]) [97.122.82.115]:36636 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHLgAGA0TT7ii44m7+4IXtmOUzIosdiZ1/EwqMEXZmPYiXCkr4yLIJiQ8kC2O3vubBFewfl7oTr9MYIBAGNAXowg+g4bD554b8qFtxDvw+b+CH/OKgoe qnkkgYpnCVIEjtOZpJq4d0n+40FxSg70LJgGmk2G2VUdsBk56RNnIp95RtBNmUWxQ/YvunE5C7SvCezgkMoBQ1im/YBxeoSXGiw= X-Spam-Status: No, score=-3021.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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+patchwork=sourceware.org@sourceware.org As with the previous patch, this patch removes some calls to dwarf2_per_objfile::adjust. These calls are not needed by the cooked indexer, as it does not create symbols or look up symbols by address. The call in dwarf2_ranges_read is similarly not needed, as it is only used to update an addrmap; and in any case I believe this particular call is only reached by the indexer. --- gdb/dwarf2/read.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index b029c49a339..9670f232f05 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10930,7 +10930,6 @@ dwarf2_ranges_read (unsigned offset, unrelocated_addr *low_return, unrelocated_addr *high_return, struct dwarf2_cu *cu, addrmap_mutable *map, void *datum, dwarf_tag tag) { - dwarf2_per_objfile *per_objfile = cu->per_objfile; int low_set = 0; unrelocated_addr low = {}; unrelocated_addr high = {}; @@ -10941,13 +10940,10 @@ dwarf2_ranges_read (unsigned offset, unrelocated_addr *low_return, { if (map != nullptr) { - unrelocated_addr lowpc; - unrelocated_addr highpc; - - lowpc = per_objfile->adjust (range_beginning); - highpc = per_objfile->adjust (range_end); /* addrmap only accepts CORE_ADDR, so we must cast here. */ - map->set_empty ((CORE_ADDR) lowpc, (CORE_ADDR) highpc - 1, datum); + map->set_empty ((CORE_ADDR) range_beginning, + (CORE_ADDR) range_end - 1, + datum); } /* FIXME: This is recording everything as a low-high @@ -16004,14 +16000,11 @@ cooked_indexer::check_bounds (cutu_reader *reader) cu, m_index_storage->get_addrmap (), cu->per_cu); if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc) { - dwarf2_per_objfile *per_objfile = cu->per_objfile; - unrelocated_addr low = per_objfile->adjust (best_lowpc); - unrelocated_addr high = per_objfile->adjust (best_highpc); /* Store the contiguous range if it is not empty; it can be empty for CUs with no code. addrmap requires CORE_ADDR, so we cast here. */ - m_index_storage->get_addrmap ()->set_empty ((CORE_ADDR) low, - (CORE_ADDR) high - 1, + m_index_storage->get_addrmap ()->set_empty ((CORE_ADDR) best_lowpc, + (CORE_ADDR) best_highpc - 1, cu->per_cu); cu->per_cu->addresses_seen = true; @@ -16313,13 +16306,10 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, if (*high_pc > *low_pc) { - dwarf2_per_objfile *per_objfile = reader->cu->per_objfile; - unrelocated_addr lo = per_objfile->adjust (*low_pc); - unrelocated_addr hi = per_objfile->adjust (*high_pc); /* Need CORE_ADDR casts for addrmap. */ - m_index_storage->get_addrmap ()->set_empty ((CORE_ADDR) lo, - (CORE_ADDR) hi - 1, - scanning_per_cu); + m_index_storage->get_addrmap ()->set_empty + ((CORE_ADDR) *low_pc, (CORE_ADDR) *high_pc - 1, + scanning_per_cu); } }