From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 33065395B432 for ; Wed, 27 May 2020 14:50:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 33065395B432 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A9DDB1E5F9; Wed, 27 May 2020 10:50:15 -0400 (EDT) Subject: [PATCH v2 41.5/42] Move line_header_hash to dwarf2_per_objfile To: Simon Marchi , gdb-patches@sourceware.org References: <20200512210913.5593-1-simon.marchi@efficios.com> From: Simon Marchi Message-ID: Date: Wed, 27 May 2020 10:50:14 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200512210913.5593-1-simon.marchi@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, 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: Wed, 27 May 2020 14:50:17 -0000 Here's another patch, inserted between 41 and 42. >From 5b16dc91567e370a5eaffc27bf2a35eafd46ca93 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 27 May 2020 01:20:50 -0400 Subject: [PATCH] Move line_header_hash to dwarf2_per_objfile The `line_header_hash` field of `struct dwarf2_per_bfd` contains some `struct line_header` objects. A `struct line_header` objects contains some `file_entry` objects. A `file_entry` object contains a pointer to the `symtab` object created from it. The `line_header_hash` is therefore ultimately objfile-dependent and can't be shared as-is between objfiles. Move it from `dwarf2_per_bfd` to `dwarf2_per_objfile`. gdb/ChangeLog: * dwarf2/read.h (struct dwarf2_per_bfd) : Move to... (struct dwarf2_per_objfile) : ... here. * dwarf2/read.c (handle_DW_AT_stmt_list): Update. --- gdb/dwarf2/read.c | 12 ++++++------ gdb/dwarf2/read.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index df15068269c..c77c3562123 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -10888,10 +10888,10 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, compile_unit, then use the line header hash table if it's already created, but don't create one just yet. */ - if (dwarf2_per_objfile->per_bfd->line_header_hash == NULL + if (dwarf2_per_objfile->line_header_hash == NULL && die->tag == DW_TAG_partial_unit) { - dwarf2_per_objfile->per_bfd->line_header_hash + dwarf2_per_objfile->line_header_hash .reset (htab_create_alloc (127, line_header_hash_voidp, line_header_eq_voidp, free_line_header_voidp, @@ -10901,9 +10901,9 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, line_header_local.sect_off = line_offset; line_header_local.offset_in_dwz = cu->per_cu->is_dwz; line_header_local_hash = line_header_hash (&line_header_local); - if (dwarf2_per_objfile->per_bfd->line_header_hash != NULL) + if (dwarf2_per_objfile->line_header_hash != NULL) { - slot = htab_find_slot_with_hash (dwarf2_per_objfile->per_bfd->line_header_hash.get (), + slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (), &line_header_local, line_header_local_hash, NO_INSERT); @@ -10927,11 +10927,11 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, cu->line_header = lh.release (); cu->line_header_die_owner = die; - if (dwarf2_per_objfile->per_bfd->line_header_hash == NULL) + if (dwarf2_per_objfile->line_header_hash == NULL) slot = NULL; else { - slot = htab_find_slot_with_hash (dwarf2_per_objfile->per_bfd->line_header_hash.get (), + slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash.get (), &line_header_local, line_header_local_hash, INSERT); gdb_assert (slot != NULL); diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 996cf55af22..b53aab7be63 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -234,9 +234,6 @@ struct dwarf2_per_bfd /* The CUs we recently read. */ std::vector just_read_cus; - /* Table containing line_header indexed by offset and offset_in_dwz. */ - htab_up line_header_hash; - /* Table containing all filenames. This is an optional because the table is lazily constructed on first access. */ gdb::optional filenames_cache; @@ -368,6 +365,9 @@ struct dwarf2_per_objfile The mapping is done via (CU/TU + DIE offset) -> type. */ htab_up die_type_hash; + /* Table containing line_header indexed by offset and offset_in_dwz. */ + htab_up line_header_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