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 DCBF7386EC38 for ; Wed, 6 Apr 2022 14:42:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DCBF7386EC38 X-ASG-Debug-ID: 1649256128-0c856e06abae93f0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id Gu3SSAeKlffQKt9e (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 06 Apr 2022 10:42:08 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id 95027441D67; Wed, 6 Apr 2022 10:42:08 -0400 (EDT) From: Simon Marchi X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 4/4] gdb: remove symtab::pspace Date: Wed, 6 Apr 2022 10:42:05 -0400 X-ASG-Orig-Subj: [PATCH 4/4] gdb: remove symtab::pspace Message-Id: <20220406144205.1415376-5-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406144205.1415376-1-simon.marchi@polymtl.ca> References: <20220406144205.1415376-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1649256128 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 8730 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.97169 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3602.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_QUARANTINE, KAM_DMARC_STATUS, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP, T_SCC_BODY_TEXT_LINE, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 06 Apr 2022 14:42:18 -0000 Same idea as previous patch, but for symtab::pspace. Change-Id: I1023abe622bea75ef648c6a97a01b53775d4104d --- gdb/annotate.c | 2 +- gdb/linespec.c | 49 +++++++++++++++++++++++++++++-------------------- gdb/source.c | 2 +- gdb/symtab.c | 8 -------- gdb/symtab.h | 2 -- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/gdb/annotate.c b/gdb/annotate.c index 6ae314572221..33805dcdb307 100644 --- a/gdb/annotate.c +++ b/gdb/annotate.c @@ -453,7 +453,7 @@ annotate_source_line (struct symtab *s, int line, int mid_statement, /* Update the current symtab and line. */ symtab_and_line sal; - sal.pspace = s->pspace (); + sal.pspace = s->compunit ()->objfile ()->pspace; sal.symtab = s; sal.line = line; set_current_source_symtab_and_line (sal); diff --git a/gdb/linespec.c b/gdb/linespec.c index 10717ac6c43f..9d4707cbb4e7 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -2188,7 +2188,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls) for (const auto &sym : ls->labels.label_symbols) { struct program_space *pspace - = symbol_symtab (sym.symbol)->pspace (); + = symbol_symtab (sym.symbol)->compunit ()->objfile ()->pspace; if (symbol_to_sal (&sal, state->funfirstline, sym.symbol) && maybe_add_address (state->addr_set, pspace, sal.pc)) @@ -2210,7 +2210,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls) for (const auto &sym : ls->function_symbols) { program_space *pspace - = symbol_symtab (sym.symbol)->pspace (); + = symbol_symtab (sym.symbol)->compunit ()->objfile ()->pspace; set_current_program_space (pspace); /* Don't skip to the first line of the function if we @@ -3462,8 +3462,10 @@ lookup_prefix_sym (struct linespec_state *state, { /* Program spaces that are executing startup should have been filtered out earlier. */ - gdb_assert (!elt->pspace ()->executing_startup); - set_current_program_space (elt->pspace ()); + program_space *pspace = elt->compunit ()->objfile ()->pspace; + + gdb_assert (!pspace->executing_startup); + set_current_program_space (pspace); iterate_over_file_blocks (elt, lookup_name, STRUCT_DOMAIN, collector); iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN, collector); } @@ -3481,8 +3483,8 @@ compare_symbols (const block_symbol &a, const block_symbol &b) { uintptr_t uia, uib; - uia = (uintptr_t) symbol_symtab (a.symbol)->pspace (); - uib = (uintptr_t) symbol_symtab (b.symbol)->pspace (); + uia = (uintptr_t) symbol_symtab (a.symbol)->compunit ()->objfile ()->pspace; + uib = (uintptr_t) symbol_symtab (b.symbol)->compunit ()->objfile ()->pspace; if (uia < uib) return true; @@ -3606,7 +3608,7 @@ find_method (struct linespec_state *self, /* Program spaces that are executing startup should have been filtered out earlier. */ - pspace = symbol_symtab (sym)->pspace (); + pspace = symbol_symtab (sym)->compunit ()->objfile ()->pspace; gdb_assert (!pspace->executing_startup); set_current_program_space (pspace); t = check_typedef (sym->type ()); @@ -3617,7 +3619,8 @@ find_method (struct linespec_state *self, sure not to miss the last batch. */ if (ix == sym_classes->size () - 1 || (pspace - != symbol_symtab (sym_classes->at (ix + 1).symbol)->pspace ())) + != (symbol_symtab (sym_classes->at (ix + 1).symbol) + ->compunit ()->objfile ()->pspace))) { /* If we did not find a direct implementation anywhere in this program space, consider superclasses. */ @@ -3981,7 +3984,8 @@ find_label_symbols (struct linespec_state *self, for (const auto &elt : function_symbols) { fn_sym = elt.symbol; - set_current_program_space (symbol_symtab (fn_sym)->pspace ()); + set_current_program_space + (symbol_symtab (fn_sym)->compunit ()->objfile ()->pspace); block = SYMBOL_BLOCK_VALUE (fn_sym); find_label_symbols_in_block (block, name, fn_sym, completion_mode, @@ -4010,13 +4014,14 @@ decode_digits_list_mode (struct linespec_state *self, /* The logic above should ensure this. */ gdb_assert (elt != NULL); - set_current_program_space (elt->pspace ()); + program_space *pspace = elt->compunit ()->objfile ()->pspace; + set_current_program_space (pspace); /* Simplistic search just for the list command. */ val.symtab = find_line_symtab (elt, val.line, NULL, NULL); if (val.symtab == NULL) val.symtab = elt; - val.pspace = elt->pspace (); + val.pspace = pspace; val.pc = 0; val.explicit_line = true; @@ -4044,13 +4049,14 @@ decode_digits_ordinary (struct linespec_state *self, /* The logic above should ensure this. */ gdb_assert (elt != NULL); - set_current_program_space (elt->pspace ()); + program_space *pspace = elt->compunit ()->objfile ()->pspace; + set_current_program_space (pspace); pcs = find_pcs_for_symtab_line (elt, line, best_entry); for (CORE_ADDR pc : pcs) { symtab_and_line sal; - sal.pspace = elt->pspace (); + sal.pspace = pspace; sal.symtab = elt; sal.line = line; sal.explicit_line = true; @@ -4241,9 +4247,11 @@ search_minsyms_for_name (struct collect_info *info, } else { - if (search_pspace == NULL || symtab->pspace () == search_pspace) + program_space *pspace = symtab->compunit ()->objfile ()->pspace; + + if (search_pspace == NULL || pspace == search_pspace) { - set_current_program_space (symtab->pspace ()); + set_current_program_space (pspace); iterate_over_minimal_symbols (symtab->compunit ()->objfile (), name, [&] (struct minimal_symbol *msym) @@ -4329,14 +4337,15 @@ add_matching_symbols_to_info (const char *name, { return info->add_symbol (bsym); }); search_minsyms_for_name (info, lookup_name, pspace, NULL); } - else if (pspace == NULL || pspace == elt->pspace ()) + else if (pspace == NULL || pspace == elt->compunit ()->objfile ()->pspace) { int prev_len = info->result.symbols->size (); /* Program spaces that are executing startup should have been filtered out earlier. */ - gdb_assert (!elt->pspace ()->executing_startup); - set_current_program_space (elt->pspace ()); + program_space *elt_pspace = elt->compunit ()->objfile ()->pspace; + gdb_assert (!elt_pspace->executing_startup); + set_current_program_space (elt_pspace); iterate_over_file_blocks (elt, lookup_name, VAR_DOMAIN, [&] (block_symbol *bsym) { return info->add_symbol (bsym); }); @@ -4375,7 +4384,7 @@ symbol_to_sal (struct symtab_and_line *result, result->symbol = sym; result->line = sym->line (); result->pc = SYMBOL_VALUE_ADDRESS (sym); - result->pspace = result->symtab->pspace (); + result->pspace = result->symtab->compunit ()->objfile ()->pspace; result->explicit_pc = 1; return 1; } @@ -4391,7 +4400,7 @@ symbol_to_sal (struct symtab_and_line *result, result->symbol = sym; result->line = sym->line (); result->pc = SYMBOL_VALUE_ADDRESS (sym); - result->pspace = result->symtab->pspace (); + result->pspace = result->symtab->compunit ()->objfile ()->pspace; return 1; } } diff --git a/gdb/source.c b/gdb/source.c index 24f53f68e35b..e9016573333c 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -311,7 +311,7 @@ select_source_symtab (struct symtab *s) if (s) { current_source_location *loc - = get_source_location (s->pspace ()); + = get_source_location (s->compunit ()->objfile ()->pspace); loc->set (s, 1); return; } diff --git a/gdb/symtab.c b/gdb/symtab.c index eeb16e4643b8..3cc2d4f8648c 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -335,14 +335,6 @@ search_domain_name (enum search_domain e) /* See symtab.h. */ -program_space * -symtab::pspace () const -{ - return this->compunit ()->objfile ()->pspace; -} - -/* See symtab.h. */ - call_site * compunit_symtab::find_call_site (CORE_ADDR pc) const { diff --git a/gdb/symtab.h b/gdb/symtab.h index 87d483505297..a89b0a2e42d7 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1476,8 +1476,6 @@ struct symtab m_language = language; } - program_space *pspace () const; - /* Unordered chain of all filetabs in the compunit, with the exception that the "main" source file is the first entry in the list. */ -- 2.35.1