From patchwork Sun Oct 29 17:35:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78691 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB2C138618E3 for ; Sun, 29 Oct 2023 17:40:32 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 49D4B38618DA for ; Sun, 29 Oct 2023 17:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49D4B38618DA Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 49D4B38618DA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698601116; cv=none; b=ISJ2/SMTTBNsh7zzn9RjtqnzyDX91QwOUnZ8xOUK8BQhWvZnsY31XFL6iB5X5xfE+zw+w+jKgySgVG0087L+Y6QwbgD2wjIFXzJ/LY0OQK8W30FuiRZ0cBbfVVmlIGzo9OU680cFrvG19vcABOMNQGtNl3wvj0pWYMwF3lBx7gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698601116; c=relaxed/simple; bh=eQxhlFfH9gp0wMQmg7g8qQODr5Yy7z44IERhUP8M5PU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LRlurov0VzKdCpY6gdpX12FDDJnQrADrnh+iGB8fzEUWQcZI/8AWNKnoI0K1JWRyx1Wx66L6TS3uEyzrp4tP8MrXIgipv9gQgEKHNbd93ZPzMNxK2rBkfv0mgzOR7+OetGW/D3CVP5GTUXWWyIdPGOEDCPfFaANNGyHDuDAWp48= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id x2aSqQOKfKOkLx9k4qPFSR; Sun, 29 Oct 2023 17:38:28 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id x9k2qAofGwasUx9k2qmwCn; Sun, 29 Oct 2023 17:38:26 +0000 X-Authority-Analysis: v=2.4 cv=ZpP+lv3G c=1 sm=1 tr=0 ts=653e9892 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=eoFT3E_SFiD_dCFiW3gA:9 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:Cc:To:From:Sender:Reply-To: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=maiJQVVmPYPg5AbOs6JuM0VjnI74aYi0hAfY052AeNY=; b=Sy4jj+9dUBWK1cqNIlyn+o+QNN xFg+jUihYypiaR1COgMLhdQwUZXUyX4MwhzNaXljjlYJktbl//0Rd0Orhu2o13iGNfZRQWarJvTyY 6Pna4asb/43MvT98OlZW0/aGT; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:47472 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qx9k2-000nop-0z; Sun, 29 Oct 2023 11:38:26 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 10/15] Remove two quick_symbol_functions methods Date: Sun, 29 Oct 2023 11:35:29 -0600 Message-ID: <20231029173839.471514-11-tom@tromey.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231029173839.471514-1-tom@tromey.com> References: <20231029173839.471514-1-tom@tromey.com> MIME-Version: 1.0 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.77.73 X-Source-L: No X-Exim-ID: 1qx9k2-000nop-0z X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net (localhost.localdomain) [97.122.77.73]:47472 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfN16NJGrIg5wg/jaZLBZcNtJiJo0ccAETa4QMi+ik6pA47dafKkfqsOPy97OY/+W6eRQKgxmuZyBOJJCuz36fyLaCtSnswBH5vmNbRE07lZTsw+VxhzV DuhyZg+B4p998w+hkYybsBm3dfJxdvD/Z6kPDa5vkfpbKxQnO8Z+95c/OkfYo3GRyKaqX7RgLja85MUF66FLyBCVqswqb0wHv28= X-Spam-Status: No, score=-3024.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org quick_symbol_functions::read_partial_symbols is no longer implemented, so both it and quick_symbol_functions::can_lazily_read_symbols can be removed. This allows for other functions to be removed as well. Note that SYMFILE_NO_READ is now pretty much dead. I haven't removed it here -- but could if that's desirable. I tend to think that this functionality would be better implemented in the core; but whenever I dive into the non-DWARF readers it is pretty depressing. --- gdb/objfile-flags.h | 4 --- gdb/objfiles.h | 14 ---------- gdb/psymtab.c | 1 - gdb/quick-symbol.h | 14 ---------- gdb/symfile-debug.c | 67 ++++++++++++--------------------------------- gdb/symfile.c | 4 --- 6 files changed, 17 insertions(+), 87 deletions(-) diff --git a/gdb/objfile-flags.h b/gdb/objfile-flags.h index 9dee2ee51a0..74aea1a88d3 100644 --- a/gdb/objfile-flags.h +++ b/gdb/objfile-flags.h @@ -44,10 +44,6 @@ enum objfile_flag : unsigned add-symbol-file command. */ OBJF_USERLOADED = 1 << 2, /* User loaded */ - /* Set if we have tried to read partial symtabs for this objfile. - This is used to allow lazy reading of partial symtabs. */ - OBJF_PSYMTABS_READ = 1 << 3, - /* Set if this is the main symbol file (as opposed to symbol file for dynamically loaded code). */ OBJF_MAINLINE = 1 << 4, diff --git a/gdb/objfiles.h b/gdb/objfiles.h index c0ca9de6874..13ee58d7454 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -612,9 +612,6 @@ struct objfile domain_enum domain, bool *symbol_found_p); - /* See quick_symbol_functions. */ - void require_partial_symbols (bool verbose); - /* Return the relocation offset applied to SECTION. */ CORE_ADDR section_offset (bfd_section *section) const { @@ -699,17 +696,6 @@ struct objfile section_iterator (sections_end, sections_end))); } -private: - - /* Ensure that partial symbols have been read and return the "quick" (aka - partial) symbol functions for this symbol reader. */ - const std::forward_list & - qf_require_partial_symbols () - { - this->require_partial_symbols (true); - return qf; - } - public: /* The object file's original name as specified by the user, diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 41ecf31424b..0a470d68342 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -81,7 +81,6 @@ psymtab_storage::install_psymtab (partial_symtab *pst) psymtab_storage::partial_symtab_range psymbol_functions::partial_symbols (struct objfile *objfile) { - gdb_assert ((objfile->flags & OBJF_PSYMTABS_READ) != 0); return m_partial_symtabs->range (); } diff --git a/gdb/quick-symbol.h b/gdb/quick-symbol.h index 49505aef64a..f03e4cc1c1a 100644 --- a/gdb/quick-symbol.h +++ b/gdb/quick-symbol.h @@ -220,20 +220,6 @@ struct quick_symbol_functions virtual void compute_main_name (struct objfile *objfile) { } - - /* Return true if this class can lazily read the symbols. This may - only return true if there are in fact symbols to be read, because - this is used in the implementation of 'has_partial_symbols'. */ - virtual bool can_lazily_read_symbols () - { - return false; - } - - /* Read the partial symbols for OBJFILE. This will only ever be - called if can_lazily_read_symbols returns true. */ - virtual void read_partial_symbols (struct objfile *objfile) - { - } }; typedef std::unique_ptr quick_symbol_functions_up; diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c index 4b27d9eb406..1ed80d0737a 100644 --- a/gdb/symfile-debug.c +++ b/gdb/symfile-debug.c @@ -85,11 +85,7 @@ objfile::has_partial_symbols () not be present in this objfile. */ for (const auto &iter : qf) { - if ((flags & OBJF_PSYMTABS_READ) == 0 - && iter->can_lazily_read_symbols ()) - retval = true; - else - retval = iter->has_symbols (this); + retval = iter->has_symbols (this); if (retval) break; } @@ -110,7 +106,7 @@ objfile::has_unexpanded_symtabs () objfile_debug_name (this)); bool result = false; - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) { if (iter->has_unexpanded_symtabs (this)) { @@ -135,7 +131,7 @@ objfile::find_last_source_symtab () gdb_printf (gdb_stdlog, "qf->find_last_source_symtab (%s)\n", objfile_debug_name (this)); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) { retval = iter->find_last_source_symtab (this); if (retval != nullptr) @@ -168,7 +164,7 @@ objfile::forget_cached_source_info () } } - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->forget_cached_source_info (this); } @@ -215,7 +211,7 @@ objfile::map_symtabs_matching_filename return result; }; - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) { if (!iter->expand_symtabs_matching (this, match_one_filename, @@ -280,7 +276,7 @@ objfile::lookup_symbol (block_enum kind, const char *name, domain_enum domain) return true; }; - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) { if (!iter->expand_symtabs_matching (this, nullptr, @@ -311,7 +307,7 @@ objfile::print_stats (bool print_bcache) gdb_printf (gdb_stdlog, "qf->print_stats (%s, %d)\n", objfile_debug_name (this), print_bcache); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->print_stats (this, print_bcache); } @@ -337,7 +333,7 @@ objfile::expand_symtabs_for_function (const char *func_name) lookup_name_info base_lookup (func_name, symbol_name_match_type::FULL); lookup_name_info lookup_name = base_lookup.make_ignore_params (); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->expand_symtabs_matching (this, nullptr, &lookup_name, @@ -356,7 +352,7 @@ objfile::expand_all_symtabs () gdb_printf (gdb_stdlog, "qf->expand_all_symtabs (%s)\n", objfile_debug_name (this)); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->expand_all_symtabs (this); } @@ -374,7 +370,7 @@ objfile::expand_symtabs_with_fullname (const char *fullname) return filename_cmp (basenames ? basename : fullname, filename) == 0; }; - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->expand_symtabs_matching (this, file_matcher, nullptr, @@ -399,7 +395,7 @@ objfile::expand_matching_symbols domain_name (domain), global, host_address_to_string (ordered_compare)); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->expand_matching_symbols (this, name, domain, global, ordered_compare); } @@ -426,7 +422,7 @@ objfile::expand_symtabs_matching host_address_to_string (&expansion_notify), search_domain_name (kind)); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) if (!iter->expand_symtabs_matching (this, file_matcher, lookup_name, symbol_matcher, expansion_notify, search_flags, domain, kind)) @@ -451,7 +447,7 @@ objfile::find_pc_sect_compunit_symtab (struct bound_minimal_symbol msymbol, host_address_to_string (section), warn_if_readin); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) { retval = iter->find_pc_sect_compunit_symtab (this, msymbol, pc, section, warn_if_readin); @@ -479,7 +475,7 @@ objfile::map_symbol_filenames (gdb::function_view fun, objfile_debug_name (this), need_fullname); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->map_symbol_filenames (this, fun, need_fullname); } @@ -491,7 +487,7 @@ objfile::compute_main_name () "qf->compute_main_name (%s)\n", objfile_debug_name (this)); - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) iter->compute_main_name (this); } @@ -505,7 +501,7 @@ objfile::find_compunit_symtab_by_address (CORE_ADDR address) hex_string (address)); struct compunit_symtab *result = NULL; - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) { result = iter->find_compunit_symtab_by_address (this, address); if (result != nullptr) @@ -530,7 +526,7 @@ objfile::lookup_global_symbol_language (const char *name, enum language result = language_unknown; *symbol_found_p = false; - for (const auto &iter : qf_require_partial_symbols ()) + for (const auto &iter : qf) { result = iter->lookup_global_symbol_language (this, name, domain, symbol_found_p); @@ -541,35 +537,6 @@ objfile::lookup_global_symbol_language (const char *name, return result; } -void -objfile::require_partial_symbols (bool verbose) -{ - if ((flags & OBJF_PSYMTABS_READ) == 0) - { - flags |= OBJF_PSYMTABS_READ; - - bool printed = false; - for (const auto &iter : qf) - { - if (iter->can_lazily_read_symbols ()) - { - if (verbose && !printed) - { - gdb_printf (_("Reading symbols from %ps...\n"), - styled_string (file_name_style.style (), - objfile_name (this))); - printed = true; - } - iter->read_partial_symbols (this); - } - } - if (printed && !objfile_has_symbols (this)) - gdb_printf (_("(No debugging symbols found in %ps)\n"), - styled_string (file_name_style.style (), - objfile_name (this))); - } -} - /* Debugging version of struct sym_probe_fns. */ diff --git a/gdb/symfile.c b/gdb/symfile.c index eebc5ea44b9..a89876c6835 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -790,8 +790,6 @@ read_symbols (struct objfile *objfile, symfile_add_flags add_flags) add_flags | SYMFILE_NOT_FILENAME, objfile); } } - if ((add_flags & SYMFILE_NO_READ) == 0) - objfile->require_partial_symbols (false); } /* Initialize entry point information for this objfile. */ @@ -2621,8 +2619,6 @@ reread_symbols (int from_tty) (*objfile->sf->sym_init) (objfile); clear_complaints (); - objfile->flags &= ~OBJF_PSYMTABS_READ; - /* We are about to read new symbols and potentially also DWARF information. Some targets may want to pass addresses read from DWARF DIE's through an adjustment function before