From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 213EA395383D for ; Tue, 12 May 2020 21:09:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 213EA395383D X-ASG-Debug-ID: 1589317755-0c856e314b893530001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id TvoGFBwhiBRKBnOa (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 May 2020 17:09:16 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from epycamd.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by smtp.ebox.ca (Postfix) with ESMTP id E353D441D66; Tue, 12 May 2020 17:09:15 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-181-218.qc.cable.ebox.net[192.222.181.218] X-Barracuda-Apparent-Source-IP: 192.222.181.218 X-Barracuda-RBL-IP: 192.222.181.218 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH v2 07/42] Move die_type_hash to dwarf2_per_objfile Date: Tue, 12 May 2020 17:08:38 -0400 X-ASG-Orig-Subj: [PATCH v2 07/42] Move die_type_hash to dwarf2_per_objfile Message-Id: <20200512210913.5593-8-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512210913.5593-1-simon.marchi@efficios.com> References: <20200512210913.5593-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1589317756 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 3460 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE7568M X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81805 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE7568M Custom Rule 7568M X-Spam-Status: No, score=-30.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, 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: Tue, 12 May 2020 21:09:20 -0000 The die_type_hash field can't be shared between multiple obfiles, as it holds `struct type` objects, which are objfile-specific. Move it from dwarf2_per_bfd to dwarf2_per_objfile and update all references. gdb/ChangeLog: * dwarf2/read.h (struct dwarf2_per_bfd) : Move to struct dwarf2_per_objfile. (struct dwarf2_per_objfile) : Move from struct dwarf2_per_bfd. * dwarf2/read.c (set_die_type): Update. (get_die_type_at_offset): Update. --- gdb/dwarf2/read.c | 10 +++++----- gdb/dwarf2/read.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 4dfa85ff0c7..c9617293284 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -23717,8 +23717,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) cu->per_cu->addr_type ())) type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop); - if (dwarf2_per_objfile->per_bfd->die_type_hash == NULL) - dwarf2_per_objfile->per_bfd->die_type_hash + if (dwarf2_per_objfile->die_type_hash == NULL) + dwarf2_per_objfile->die_type_hash = htab_up (htab_create_alloc (127, per_cu_offset_and_type_hash, per_cu_offset_and_type_eq, @@ -23728,7 +23728,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) ofs.sect_off = die->sect_off; ofs.type = type; slot = (struct dwarf2_per_cu_offset_and_type **) - htab_find_slot (dwarf2_per_objfile->per_bfd->die_type_hash.get (), &ofs, INSERT); + htab_find_slot (dwarf2_per_objfile->die_type_hash.get (), &ofs, INSERT); if (*slot) complaint (_("A problem internal to GDB: DIE %s has type already set"), sect_offset_str (die->sect_off)); @@ -23748,13 +23748,13 @@ get_die_type_at_offset (sect_offset sect_off, struct dwarf2_per_cu_offset_and_type *slot, ofs; struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; - if (dwarf2_per_objfile->per_bfd->die_type_hash == NULL) + if (dwarf2_per_objfile->die_type_hash == NULL) return NULL; ofs.per_cu = per_cu; ofs.sect_off = sect_off; slot = ((struct dwarf2_per_cu_offset_and_type *) - htab_find (dwarf2_per_objfile->per_bfd->die_type_hash.get (), &ofs)); + htab_find (dwarf2_per_objfile->die_type_hash.get (), &ofs)); if (slot) return slot->type; else diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 7631938edb0..2897ea6e601 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -229,11 +229,6 @@ struct dwarf2_per_bfd symbols. */ bool reading_partial_symbols = false; - /* Table mapping type DIEs to their struct type *. - This is NULL if not allocated yet. - The mapping is done via (CU/TU + DIE offset) -> type. */ - htab_up die_type_hash; - /* The CUs we recently read. */ std::vector just_read_cus; @@ -310,6 +305,11 @@ struct dwarf2_per_objfile other objfiles backed by the same BFD. */ struct dwarf2_per_bfd *per_bfd; + /* Table mapping type DIEs to their struct type *. + This is nullptr if not allocated yet. + The mapping is done via (CU/TU + DIE offset) -> type. */ + htab_up die_type_hash; + private: /* Hold the corresponding compunit_symtab for each CU or TU. This is indexed by dwarf2_per_cu_data::index. A NULL value means -- 2.26.2