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 8A6A0395B0B1 for ; Tue, 12 May 2020 21:09:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8A6A0395B0B1 X-ASG-Debug-ID: 1589317756-0c856e18f31444ba0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 0OT6C2yRDn9WGbmk (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 1D576441D68; Tue, 12 May 2020 17:09:16 -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 09/42] Remove reference to dwarf2_per_cu_data::dwarf2_per_objfile in dw2_do_instantiate_symtab Date: Tue, 12 May 2020 17:08:40 -0400 X-ASG-Orig-Subj: [PATCH v2 09/42] Remove reference to dwarf2_per_cu_data::dwarf2_per_objfile in dw2_do_instantiate_symtab Message-Id: <20200512210913.5593-10-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: 10415 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81805 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-29.9 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:21 -0000 This patch begins by removing the per_cu->dwarf2_per_objfile reference in dw2_do_instantiate_symtab, instead accepting a dwarf2_per_objfile object as a parameter. It then fixes the fallouts. In this context, the dwarf2_per_objfile is generally derived from an objfile passed to a quick_symbol_functions callback. gdb/ChangeLog: * dwarf2/read.c (dw2_do_instantiate_symtab): Add per_objfile parameter, don't use per_cu->dwarf2_per_objfile. (dw2_instantiate_symtab): Likewise. (dw2_find_last_source_symtab): Update. (dw2_map_expand_apply): Update. (dw2_lookup_symbol): Update. (dw2_expand_symtabs_for_function): Update. (dw2_expand_all_symtabs): Update. (dw2_expand_symtabs_with_fullname): Update. (dw2_expand_symtabs_matching_one): Add per_objfile parameter, don't use per_cu->dwarf2_per_objfile. (dw2_expand_marked_cus): Update. (dw2_find_pc_sect_compunit_symtab): Update. (dw2_debug_names_lookup_symbol): Update. (dw2_debug_names_expand_symtabs_for_function): Update. (dw2_debug_names_map_matching_symbols): Update. (dwarf2_psymtab::expand_psymtab): Update. --- gdb/dwarf2/read.c | 78 +++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 096002219a3..983218ab15a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -2341,13 +2341,13 @@ load_cu (struct dwarf2_per_cu_data *per_cu, bool skip_partial) dwarf2_find_base_address (per_cu->cu->dies, per_cu->cu); } -/* Read in the symbols for PER_CU. */ +/* Read in the symbols for PER_CU in the context of DWARF"_PER_OBJFILE. */ static void -dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial) +dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *dwarf2_per_objfile, + bool skip_partial) { - struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; - /* Skip type_unit_groups, reading the type units they contain is handled elsewhere. */ if (per_cu->type_unit_group_p ()) @@ -2383,22 +2383,23 @@ dw2_do_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial) age_cached_comp_units (dwarf2_per_objfile); } -/* Ensure that the symbols for PER_CU have been read in. OBJFILE is - the objfile from which this CU came. Returns the resulting symbol - table. */ +/* Ensure that the symbols for PER_CU have been read in. DWARF2_PER_OBJFILE is + the per-objfile for which this symtab is instantiated. + + Returns the resulting symbol table. */ static struct compunit_symtab * -dw2_instantiate_symtab (struct dwarf2_per_cu_data *per_cu, bool skip_partial) +dw2_instantiate_symtab (dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *dwarf2_per_objfile, + bool skip_partial) { - struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile; - gdb_assert (dwarf2_per_objfile->per_bfd->using_index); if (!dwarf2_per_objfile->symtab_set_p (per_cu)) { free_cached_comp_units freer (dwarf2_per_objfile); scoped_restore decrementer = increment_reading_symtab (); - dw2_do_instantiate_symtab (per_cu, skip_partial); + dw2_do_instantiate_symtab (per_cu, dwarf2_per_objfile, skip_partial); process_cu_includes (dwarf2_per_objfile); } @@ -3255,7 +3256,8 @@ dw2_find_last_source_symtab (struct objfile *objfile) struct dwarf2_per_objfile *dwarf2_per_objfile = get_dwarf2_per_objfile (objfile); dwarf2_per_cu_data *dwarf_cu = dwarf2_per_objfile->per_bfd->all_comp_units.back (); - compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu, false); + compunit_symtab *cust + = dw2_instantiate_symtab (dwarf_cu, dwarf2_per_objfile, false); if (cust == NULL) return NULL; @@ -3312,7 +3314,7 @@ dw2_map_expand_apply (struct objfile *objfile, /* This may expand more than one symtab, and we want to iterate over all of them. */ - dw2_instantiate_symtab (per_cu, false); + dw2_instantiate_symtab (per_cu, per_objfile, false); return iterate_over_some_symtabs (name, real_path, objfile->compunit_symtabs, last_made, callback); @@ -3554,7 +3556,8 @@ dw2_lookup_symbol (struct objfile *objfile, block_enum block_index, while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL) { struct symbol *sym, *with_opaque = NULL; - struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false); + struct compunit_symtab *stab + = dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false); const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab); const struct block *block = BLOCKVECTOR_BLOCK (bv, block_index); @@ -3635,7 +3638,7 @@ dw2_expand_symtabs_for_function (struct objfile *objfile, dw2_symtab_iter_init (&iter, dwarf2_per_objfile, {}, VAR_DOMAIN, func_name); while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL) - dw2_instantiate_symtab (per_cu, false); + dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false); } @@ -3656,7 +3659,7 @@ dw2_expand_all_symtabs (struct objfile *objfile) be triggered later on. See PR symtab/23010. So, tell dw2_instantiate_symtab to skip partial CUs -- any important partial CU will be read via DW_TAG_imported_unit anyway. */ - dw2_instantiate_symtab (per_cu, true); + dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, true); } } @@ -3688,7 +3691,7 @@ dw2_expand_symtabs_with_fullname (struct objfile *objfile, if (filename_cmp (this_fullname, fullname) == 0) { - dw2_instantiate_symtab (per_cu, false); + dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false); break; } } @@ -4494,16 +4497,17 @@ run_test () static void dw2_expand_symtabs_matching_one - (struct dwarf2_per_cu_data *per_cu, + (dwarf2_per_cu_data *per_cu, + dwarf2_per_objfile *per_objfile, gdb::function_view file_matcher, gdb::function_view expansion_notify) { if (file_matcher == NULL || per_cu->v.quick->mark) { - dwarf2_per_objfile *per_objfile = per_cu->dwarf2_per_objfile; bool symtab_was_null = !per_objfile->symtab_set_p (per_cu); - compunit_symtab *symtab = dw2_instantiate_symtab (per_cu, false); + compunit_symtab *symtab + = dw2_instantiate_symtab (per_cu, per_objfile, false); gdb_assert (symtab != nullptr); if (expansion_notify != NULL && symtab_was_null) @@ -4517,7 +4521,7 @@ dw2_expand_symtabs_matching_one static void dw2_expand_marked_cus - (struct dwarf2_per_objfile *dwarf2_per_objfile, offset_type idx, + (dwarf2_per_objfile *dwarf2_per_objfile, offset_type idx, gdb::function_view file_matcher, gdb::function_view expansion_notify, search_domain kind) @@ -4591,7 +4595,7 @@ dw2_expand_marked_cus } dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->per_bfd->get_cutu (cu_index); - dw2_expand_symtabs_matching_one (per_cu, file_matcher, + dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, file_matcher, expansion_notify); } } @@ -4698,8 +4702,8 @@ dw2_expand_symtabs_matching { QUIT; - dw2_expand_symtabs_matching_one (per_cu, file_matcher, - expansion_notify); + dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, + file_matcher, expansion_notify); } return; } @@ -4768,10 +4772,9 @@ dw2_find_pc_sect_compunit_symtab (struct objfile *objfile, warning (_("(Internal error: pc %s in read in CU, but not in symtab.)"), paddress (objfile->arch (), pc)); - result - = recursively_find_pc_sect_compunit_symtab (dw2_instantiate_symtab (data, - false), - pc); + result = recursively_find_pc_sect_compunit_symtab + (dw2_instantiate_symtab (data, per_objfile, false), pc); + gdb_assert (result != NULL); return result; } @@ -5613,7 +5616,8 @@ dw2_debug_names_lookup_symbol (struct objfile *objfile, block_enum block_index, while ((per_cu = iter.next ()) != NULL) { struct symbol *sym, *with_opaque = NULL; - struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu, false); + compunit_symtab *stab + = dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false); const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab); const struct block *block = BLOCKVECTOR_BLOCK (bv, block_index); @@ -5673,7 +5677,7 @@ dw2_debug_names_expand_symtabs_for_function (struct objfile *objfile, struct dwarf2_per_cu_data *per_cu; while ((per_cu = iter.next ()) != NULL) - dw2_instantiate_symtab (per_cu, false); + dw2_instantiate_symtab (per_cu, dwarf2_per_objfile, false); } } @@ -5712,7 +5716,8 @@ dw2_debug_names_map_matching_symbols struct dwarf2_per_cu_data *per_cu; while ((per_cu = iter.next ()) != NULL) - dw2_expand_symtabs_matching_one (per_cu, nullptr, nullptr); + dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, nullptr, + nullptr); return true; }); @@ -5758,8 +5763,8 @@ dw2_debug_names_expand_symtabs_matching { QUIT; - dw2_expand_symtabs_matching_one (per_cu, file_matcher, - expansion_notify); + dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, + file_matcher, expansion_notify); } return; } @@ -5776,8 +5781,8 @@ dw2_debug_names_expand_symtabs_matching struct dwarf2_per_cu_data *per_cu; while ((per_cu = iter.next ()) != NULL) - dw2_expand_symtabs_matching_one (per_cu, file_matcher, - expansion_notify); + dw2_expand_symtabs_matching_one (per_cu, dwarf2_per_objfile, + file_matcher, expansion_notify); return true; }); } @@ -8999,7 +9004,8 @@ dwarf2_psymtab::expand_psymtab (struct objfile *objfile) expand_dependencies (objfile); - dw2_do_instantiate_symtab (per_cu_data, false); + dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); + dw2_do_instantiate_symtab (per_cu_data, per_objfile, false); gdb_assert (get_compunit_symtab (objfile) != nullptr); } -- 2.26.2