From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v3 13/18] Remove two quick_symbol_functions methods
Date: Wed, 22 Nov 2023 22:32:22 -0700 [thread overview]
Message-ID: <20231122-t-bg-dwarf-reading-v3-13-fc3180de63c4@tromey.com> (raw)
In-Reply-To: <20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@tromey.com>
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 63f5db82cfa..06bcb092b48 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -622,9 +622,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
{
@@ -709,17 +706,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<quick_symbol_functions_up> &
- 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 d4cd5810c20..ef5c0606fec 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> quick_symbol_functions_up;
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index ea9d0c47ba5..60f12e3be66 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -87,11 +87,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;
}
@@ -112,7 +108,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))
{
@@ -137,7 +133,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)
@@ -170,7 +166,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);
}
@@ -217,7 +213,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,
@@ -282,7 +278,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,
@@ -313,7 +309,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);
}
@@ -339,7 +335,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,
@@ -358,7 +354,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);
}
@@ -376,7 +372,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,
@@ -401,7 +397,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);
}
@@ -428,7 +424,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))
@@ -453,7 +449,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);
@@ -481,7 +477,7 @@ objfile::map_symbol_filenames (gdb::function_view<symbol_filename_ftype> 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);
}
@@ -493,7 +489,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);
}
@@ -507,7 +503,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)
@@ -532,7 +528,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);
@@ -543,35 +539,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)));
- }
-}
-
/* Call LOOKUP_FUNC to find the filename of a file containing the separate
debug information matching OBJFILE. If LOOKUP_FUNC does return a
filename then open this file and return a std::pair containing the
diff --git a/gdb/symfile.c b/gdb/symfile.c
index c5af186ad33..7cbd993be8f 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. */
@@ -2620,8 +2618,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
--
2.41.0
next prev parent reply other threads:[~2023-11-23 5:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 5:32 [PATCH v3 00/18] Index DWARF in the background Tom Tromey
2023-11-23 5:32 ` [PATCH v3 01/18] Don't use objfile::intern in DWO code Tom Tromey
2023-11-23 5:32 ` [PATCH v3 02/18] Pre-read DWZ section data Tom Tromey
2023-11-23 5:32 ` [PATCH v3 03/18] Add a couple of bfd_cache_close calls Tom Tromey
2023-11-23 5:32 ` [PATCH v3 04/18] Add thread-safety to gdb's BFD wrappers Tom Tromey
2023-11-23 5:32 ` [PATCH v3 05/18] Refactor complaint thread-safety approach Tom Tromey
2023-11-23 5:32 ` [PATCH v3 06/18] Add quick_symbol_functions::compute_main_name Tom Tromey
2023-11-23 5:32 ` [PATCH v3 07/18] Add gdb::task_group Tom Tromey
2023-11-23 5:32 ` [PATCH v3 08/18] Move cooked_index_storage to cooked-index.h Tom Tromey
2023-11-23 5:32 ` [PATCH v3 09/18] Add "maint set dwarf synchronous" Tom Tromey
2023-11-23 7:02 ` Eli Zaretskii
2023-11-23 5:32 ` [PATCH v3 10/18] Change how cooked index waits for threads Tom Tromey
2023-11-23 5:32 ` [PATCH v3 11/18] Do more DWARF reading in the background Tom Tromey
2023-11-23 5:32 ` [PATCH v3 12/18] Simplify the public DWARF API Tom Tromey
2023-11-23 5:32 ` Tom Tromey [this message]
2023-11-23 5:32 ` [PATCH v3 14/18] Change current_language to be a macro Tom Tromey
2023-11-23 5:32 ` [PATCH v3 15/18] Lazy language setting Tom Tromey
2023-11-23 5:32 ` [PATCH v3 16/18] Optimize lookup_minimal_symbol_text Tom Tromey
2023-11-23 5:32 ` [PATCH v3 17/18] Avoid language-based lookups in startup path Tom Tromey
2023-11-23 5:32 ` [PATCH v3 18/18] Back out some parallel_for_each features Tom Tromey
2023-11-27 15:31 ` [PATCH v3 00/18] Index DWARF in the background Tom de Vries
2023-12-10 17:19 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231122-t-bg-dwarf-reading-v3-13-fc3180de63c4@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).