From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway33.websitewelcome.com (gateway33.websitewelcome.com [192.185.146.210]) by sourceware.org (Postfix) with ESMTPS id 051EF3874C16 for ; Sun, 28 Feb 2021 20:38:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 051EF3874C16 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 9DB703C5179D for ; Sun, 28 Feb 2021 14:38:13 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id GSpRlo857qvFOGSpRl2iCt; Sun, 28 Feb 2021 14:38:13 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: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=g2mtK00jr15jfDMMS2Nph8tik9RHQfBEQ6CimE5n1oI=; b=S2Tab3ZB6LMSz8LHjC50wog2Tn iV0rKDk05mB1IREdAFjcoiQR122AeiKYrpOCYkm3csJvExsAJ2T9PowokmreSAIb+6pbutda6dljD o1p4nS4T6ODx/JyPmtf6IJTM0; Received: from 97-122-70-152.hlrn.qwest.net ([97.122.70.152]:36732 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lGSpR-000Xkq-AS for gdb-patches@sourceware.org; Sun, 28 Feb 2021 13:38:13 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 15/26] Change how DWARF index writer finds address map Date: Sun, 28 Feb 2021 13:37:52 -0700 Message-Id: <20210228203803.1693413-16-tom@tromey.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210228203803.1693413-1-tom@tromey.com> References: <20210228203803.1693413-1-tom@tromey.com> 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.70.152 X-Source-L: No X-Exim-ID: 1lGSpR-000Xkq-AS X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-70-152.hlrn.qwest.net (localhost.localdomain) [97.122.70.152]:36732 X-Source-Auth: tom+tromey.com X-Email-Count: 16 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3033.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L5, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Feb 2021 20:38:16 -0000 This changes the DWARF index writer to find the psymtab address map in the per_bfd object, rather than go via the objfile. gdb/ChangeLog 2021-02-28 Tom Tromey * dwarf2/index-write.c (struct addrmap_index_data) : Remove. (add_address_entry): Remove objfile parameter. (add_address_entry_worker): Update. (write_address_map): Replace objfile parameter with per_bfd. (write_gdbindex, write_psymtabs_to_index): Update. --- gdb/ChangeLog | 9 +++++++++ gdb/dwarf2/index-write.c | 21 ++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index a7b9ae66cae..f42a25331f8 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -413,7 +413,6 @@ struct addrmap_index_data : addr_vec (addr_vec_), cu_index_htab (cu_index_htab_) {} - struct objfile *objfile; data_buf &addr_vec; psym_index_map &cu_index_htab; @@ -430,7 +429,7 @@ struct addrmap_index_data /* Write an address entry to ADDR_VEC. */ static void -add_address_entry (struct objfile *objfile, data_buf &addr_vec, +add_address_entry (data_buf &addr_vec, CORE_ADDR start, CORE_ADDR end, unsigned int cu_index) { addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, start); @@ -447,7 +446,7 @@ add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj) partial_symtab *pst = (partial_symtab *) obj; if (data->previous_valid) - add_address_entry (data->objfile, data->addr_vec, + add_address_entry (data->addr_vec, data->previous_cu_start, start_addr, data->previous_cu_index); @@ -465,12 +464,12 @@ add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj) return 0; } -/* Write OBJFILE's address map to ADDR_VEC. +/* Write PER_BFD's address map to ADDR_VEC. CU_INDEX_HTAB is used to map addrmap entries to their CU indices in the index file. */ static void -write_address_map (struct objfile *objfile, data_buf &addr_vec, +write_address_map (dwarf2_per_bfd *per_bfd, data_buf &addr_vec, psym_index_map &cu_index_htab) { struct addrmap_index_data addrmap_index_data (addr_vec, cu_index_htab); @@ -479,10 +478,9 @@ write_address_map (struct objfile *objfile, data_buf &addr_vec, the addrmap iterator only provides the start of a region; we have to wait until the next invocation to get the start of the next region. */ - addrmap_index_data.objfile = objfile; addrmap_index_data.previous_valid = 0; - addrmap_foreach (objfile->partial_symtabs->psymtabs_addrmap, + addrmap_foreach (per_bfd->partial_symtabs->psymtabs_addrmap, add_address_entry_worker, &addrmap_index_data); /* It's highly unlikely the last entry (end address = 0xff...ff) @@ -491,7 +489,7 @@ write_address_map (struct objfile *objfile, data_buf &addr_vec, doesn't work here. To cope we pass 0xff...ff, this is a rare situation anyway. */ if (addrmap_index_data.previous_valid) - add_address_entry (objfile, addr_vec, + add_address_entry (addr_vec, addrmap_index_data.previous_cu_start, (CORE_ADDR) -1, addrmap_index_data.previous_cu_index); } @@ -1463,7 +1461,7 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, FILE *out_file, /* Dump the address map. */ data_buf addr_vec; - write_address_map (objfile, addr_vec, cu_index_htab); + write_address_map (per_objfile->per_bfd, addr_vec, cu_index_htab); /* Write out the .debug_type entries, if any. */ data_buf types_cu_list; @@ -1686,6 +1684,7 @@ write_psymtabs_to_index (dwarf2_per_objfile *per_objfile, const char *dir, const char *basename, const char *dwz_basename, dw_index_kind index_kind) { + dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; struct objfile *objfile = per_objfile->objfile; if (per_objfile->per_bfd->using_index) @@ -1694,8 +1693,8 @@ write_psymtabs_to_index (dwarf2_per_objfile *per_objfile, const char *dir, if (per_objfile->per_bfd->types.size () > 1) error (_("Cannot make an index when the file has multiple .debug_types sections")); - if (!objfile->partial_symtabs->psymtabs - || !objfile->partial_symtabs->psymtabs_addrmap) + if (!per_bfd->partial_symtabs->psymtabs + || !per_bfd->partial_symtabs->psymtabs_addrmap) return; struct stat st; -- 2.26.2