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 4D0353842400 for ; Sun, 28 Feb 2021 20:38:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4D0353842400 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 cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway33.websitewelcome.com (Postfix) with ESMTP id EDC1C3C5179A for ; Sun, 28 Feb 2021 14:38:13 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id GSpRlZqXQABzoGSpRlmdXC; 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=EyuqlNqQ4lXs/Vp4KmRXh4YMhx5CatVx/tbEwl2xzJA=; b=jjzSSQ4u3YKYdpWLcATZZNMWEO FDeV8MCXHLQXFPDH8dC1rpXPVYJRHvOCJScjEWaZI5R0QiaOQe6FJNNcQMD878rGWMY2lxOJnoeTA F6bG2F2oxKI1zvoEXWgR+v7Le; 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-Hl for gdb-patches@sourceware.org; Sun, 28 Feb 2021 13:38:13 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 16/26] Reference psymtabs via per_bfd in DWARF reader Date: Sun, 28 Feb 2021 13:37:53 -0700 Message-Id: <20210228203803.1693413-17-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-Hl 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: 17 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 reader to reference the psymtabs via the per_bfd object, rather than via the objfile. This helps isolate the partial symtabs from the objfile. gdb/ChangeLog 2021-02-28 Tom Tromey * dwarf2/read.c (dwarf2_create_include_psymtab): Add per_bfd parameter. (process_psymtab_comp_unit_reader) (build_type_psymtab_dependencies, dwarf2_build_psymtabs_hard) (add_partial_subprogram, dwarf2_ranges_read, dwarf_decode_lines): Reference psymtabs via per_bfd. --- gdb/ChangeLog | 9 +++++++++ gdb/dwarf2/read.c | 40 +++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4008e7dff2f..9aaf484a31e 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -6514,7 +6514,8 @@ struct dwarf2_include_psymtab : public partial_symtab partial symtab as being an include of PST. */ static void -dwarf2_create_include_psymtab (const char *name, dwarf2_psymtab *pst, +dwarf2_create_include_psymtab (dwarf2_per_bfd *per_bfd, + const char *name, dwarf2_psymtab *pst, struct objfile *objfile) { dwarf2_include_psymtab *subpst = new dwarf2_include_psymtab (name, objfile); @@ -6522,7 +6523,7 @@ dwarf2_create_include_psymtab (const char *name, dwarf2_psymtab *pst, if (!IS_ABSOLUTE_PATH (subpst->filename)) subpst->dirname = pst->dirname; - subpst->dependencies = objfile->partial_symtabs->allocate_dependencies (1); + subpst->dependencies = per_bfd->partial_symtabs->allocate_dependencies (1); subpst->dependencies[0] = pst; subpst->number_of_dependencies = 1; } @@ -7792,6 +7793,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, { struct dwarf2_cu *cu = reader->cu; dwarf2_per_objfile *per_objfile = cu->per_objfile; + dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; struct objfile *objfile = per_objfile->objfile; struct gdbarch *gdbarch = objfile->arch (); struct dwarf2_per_cu_data *per_cu = cu->per_cu; @@ -7842,7 +7844,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, - baseaddr - 1); /* Store the contiguous range if it is not empty; it can be empty for CUs with no code. */ - addrmap_set_empty (objfile->partial_symtabs->psymtabs_addrmap, + addrmap_set_empty (per_bfd->partial_symtabs->psymtabs_addrmap, low, high, pst); } @@ -7893,7 +7895,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader, post-pass. */ pst->number_of_dependencies = len; pst->dependencies - = objfile->partial_symtabs->allocate_dependencies (len); + = per_bfd->partial_symtabs->allocate_dependencies (len); for (i = 0; i < len; ++i) { pst->dependencies[i] @@ -8149,7 +8151,7 @@ static int build_type_psymtab_dependencies (void **slot, void *info) { dwarf2_per_objfile *per_objfile = (dwarf2_per_objfile *) info; - struct objfile *objfile = per_objfile->objfile; + dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; struct type_unit_group *tu_group = (struct type_unit_group *) *slot; struct dwarf2_per_cu_data *per_cu = &tu_group->per_cu; dwarf2_psymtab *pst = per_cu->v.psymtab; @@ -8160,7 +8162,7 @@ build_type_psymtab_dependencies (void **slot, void *info) gdb_assert (per_cu->type_unit_group_p ()); pst->number_of_dependencies = len; - pst->dependencies = objfile->partial_symtabs->allocate_dependencies (len); + pst->dependencies = per_bfd->partial_symtabs->allocate_dependencies (len); for (i = 0; i < len; ++i) { struct signatured_type *iter = tu_group->tus->at (i); @@ -8284,6 +8286,7 @@ static void dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) { struct objfile *objfile = per_objfile->objfile; + dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; dwarf_read_debug_printf ("Building psymtabs of objfile %s ...", objfile_name (objfile)); @@ -8292,7 +8295,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) = make_scoped_restore (&per_objfile->per_bfd->reading_partial_symbols, true); - per_objfile->per_bfd->info.read (objfile); + per_bfd->info.read (objfile); /* Any cached compilation units will be linked by the per-objfile read_in_chain. Make sure to free them when we're done. */ @@ -8307,10 +8310,10 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) auto_obstack temp_obstack; scoped_restore save_psymtabs_addrmap - = make_scoped_restore (&objfile->partial_symtabs->psymtabs_addrmap, + = make_scoped_restore (&per_bfd->partial_symtabs->psymtabs_addrmap, addrmap_create_mutable (&temp_obstack)); - for (dwarf2_per_cu_data *per_cu : per_objfile->per_bfd->all_comp_units) + for (dwarf2_per_cu_data *per_cu : per_bfd->all_comp_units) { if (per_cu->v.psymtab != NULL) /* In case a forward DW_TAG_imported_unit has read the CU already. */ @@ -8323,9 +8326,9 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) process_skeletonless_type_units (per_objfile); /* Now that all TUs have been processed we can fill in the dependencies. */ - if (per_objfile->per_bfd->type_unit_groups != NULL) + if (per_bfd->type_unit_groups != NULL) { - htab_traverse_noresize (per_objfile->per_bfd->type_unit_groups.get (), + htab_traverse_noresize (per_bfd->type_unit_groups.get (), build_type_psymtab_dependencies, per_objfile); } @@ -8334,9 +8337,9 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) set_partial_user (per_objfile); - objfile->partial_symtabs->psymtabs_addrmap - = addrmap_create_fixed (objfile->partial_symtabs->psymtabs_addrmap, - objfile->partial_symtabs->obstack ()); + per_bfd->partial_symtabs->psymtabs_addrmap + = addrmap_create_fixed (per_bfd->partial_symtabs->psymtabs_addrmap, + per_bfd->partial_symtabs->obstack ()); /* At this point we want to keep the address map. */ save_psymtabs_addrmap.release (); @@ -8951,6 +8954,7 @@ add_partial_subprogram (struct partial_die_info *pdi, if (set_addrmap) { struct objfile *objfile = cu->per_objfile->objfile; + dwarf2_per_bfd *per_bfd = cu->per_objfile->per_bfd; struct gdbarch *gdbarch = objfile->arch (); CORE_ADDR baseaddr; CORE_ADDR this_highpc; @@ -8965,7 +8969,7 @@ add_partial_subprogram (struct partial_die_info *pdi, = (gdbarch_adjust_dwarf2_addr (gdbarch, pdi->highpc + baseaddr) - baseaddr); - addrmap_set_empty (objfile->partial_symtabs->psymtabs_addrmap, + addrmap_set_empty (per_bfd->partial_symtabs->psymtabs_addrmap, this_lowpc, this_highpc - 1, cu->per_cu->v.psymtab); } @@ -14735,6 +14739,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return, dwarf2_psymtab *ranges_pst, dwarf_tag tag) { struct objfile *objfile = cu->per_objfile->objfile; + dwarf2_per_bfd *per_bfd = cu->per_objfile->per_bfd; struct gdbarch *gdbarch = objfile->arch (); const CORE_ADDR baseaddr = objfile->text_section_offset (); int low_set = 0; @@ -14756,7 +14761,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return, highpc = (gdbarch_adjust_dwarf2_addr (gdbarch, range_end + baseaddr) - baseaddr); - addrmap_set_empty (objfile->partial_symtabs->psymtabs_addrmap, + addrmap_set_empty (per_bfd->partial_symtabs->psymtabs_addrmap, lowpc, highpc - 1, ranges_pst); } @@ -22085,7 +22090,8 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir, psymtab_include_file_name (lh, file_entry, pst, comp_dir, &name_holder); if (include_name != NULL) - dwarf2_create_include_psymtab (include_name, pst, objfile); + dwarf2_create_include_psymtab (cu->per_objfile->per_bfd, + include_name, pst, objfile); } } else -- 2.26.2