From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
To: <gdb-patches@sourceware.org>
Cc: simark@simark.ca, lancelot.six@amd.com, lsix@lancelotsix.com
Subject: [PATCH v3 2/2] gdb: Change psymbol_functions::require_partial_symbols to partial_symbols
Date: Fri, 20 May 2022 23:55:30 +0100 [thread overview]
Message-ID: <20220520225530.372343-1-lancelot.six@amd.com> (raw)
In-Reply-To: <da5a2538-d0e3-d326-ba2b-d467b8c078d7@simark.ca>
Hi,
Here is an updated (V3) version of the last patch of the series which
renames require_partial_symbols into partial_symbols and updates the
relevant comments.
Best,
Lancelot.
---
The previous patch ensured that partial symbols are read before calling
most of the quick_function's methods.
The psymbol_functions class has the require_partial_symbols method which
serves this exact purpose, and does not need to do it anymore.
This patch renames this method to partial_symbols and makes it an accessor
which asserts that partial symbols have been read at this point.
Regression tested on x86_64-linux.
---
gdb/psympriv.h | 5 ++---
gdb/psymtab.c | 37 +++++++++++++++++--------------------
2 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 677a57edee8..a7ba82a7604 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -553,9 +553,8 @@ struct psymbol_functions : public quick_symbol_functions
m_psymbol_map.clear ();
}
- /* Ensure the partial symbols for OBJFILE have been loaded. Return
- a range adapter for the psymtabs. */
- psymtab_storage::partial_symtab_range require_partial_symbols
+ /* Return a range adapter for the psymtabs. */
+ psymtab_storage::partial_symtab_range partial_symbols
(struct objfile *objfile);
/* Return the partial symbol storage associated with this
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 402d6085fe6..e6c9526cc4f 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -76,15 +76,12 @@ psymtab_storage::install_psymtab (partial_symtab *pst)
\f
-/* Ensure that the partial symbols for OBJFILE have been loaded. This
- will print a message when symbols are loaded. This function
- returns a range adapter suitable for iterating over the psymtabs of
- OBJFILE. */
+/* See psympriv.h. */
psymtab_storage::partial_symtab_range
-psymbol_functions::require_partial_symbols (struct objfile *objfile)
+psymbol_functions::partial_symbols (struct objfile *objfile)
{
- objfile->require_partial_symbols (true);
+ gdb_assert ((objfile->flags & OBJF_PSYMTABS_READ) != 0);
return m_partial_symtabs->range ();
}
@@ -236,7 +233,7 @@ psymbol_functions::find_pc_sect_psymtab (struct objfile *objfile,
its CUs may be missing in PSYMTABS_ADDRMAP as they may be varying
debug info type in single OBJFILE. */
- for (partial_symtab *pst : require_partial_symbols (objfile))
+ for (partial_symtab *pst : partial_symbols (objfile))
if (!pst->psymtabs_addrmap_supported
&& pc >= pst->text_low (objfile) && pc < pst->text_high (objfile))
{
@@ -358,7 +355,7 @@ psymbol_functions::lookup_global_symbol_language (struct objfile *objfile,
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
- for (partial_symtab *ps : require_partial_symbols (objfile))
+ for (partial_symtab *ps : partial_symbols (objfile))
{
struct partial_symbol *psym;
if (ps->readin_p (objfile))
@@ -607,7 +604,7 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp)
{
struct partial_symtab *cs_pst = NULL;
- for (partial_symtab *ps : require_partial_symbols (ofp))
+ for (partial_symtab *ps : partial_symbols (ofp))
{
const char *name = ps->filename;
int len = strlen (name);
@@ -643,7 +640,7 @@ psymbol_functions::find_last_source_symtab (struct objfile *ofp)
void
psymbol_functions::forget_cached_source_info (struct objfile *objfile)
{
- for (partial_symtab *pst : require_partial_symbols (objfile))
+ for (partial_symtab *pst : partial_symbols (objfile))
{
if (pst->fullname != NULL)
{
@@ -839,7 +836,7 @@ psymbol_functions::print_stats (struct objfile *objfile, bool print_bcache)
n_psyms);
i = 0;
- for (partial_symtab *ps : require_partial_symbols (objfile))
+ for (partial_symtab *ps : partial_symbols (objfile))
{
if (!ps->readin_p (objfile))
i++;
@@ -884,7 +881,7 @@ psymbol_functions::dump (struct objfile *objfile)
void
psymbol_functions::expand_all_symtabs (struct objfile *objfile)
{
- for (partial_symtab *psymtab : require_partial_symbols (objfile))
+ for (partial_symtab *psymtab : partial_symbols (objfile))
psymtab_to_symtab (objfile, psymtab);
}
@@ -897,7 +894,7 @@ psymbol_functions::map_symbol_filenames
gdb::function_view<symbol_filename_ftype> fun,
bool need_fullname)
{
- for (partial_symtab *ps : require_partial_symbols (objfile))
+ for (partial_symtab *ps : partial_symbols (objfile))
{
const char *fullname;
@@ -958,7 +955,7 @@ psymbol_functions::expand_matching_symbols
int global,
symbol_compare_ftype *ordered_compare)
{
- for (partial_symtab *ps : require_partial_symbols (objfile))
+ for (partial_symtab *ps : partial_symbols (objfile))
{
QUIT;
if (!ps->readin_p (objfile)
@@ -1093,7 +1090,7 @@ psymbol_functions::expand_symtabs_matching
enum search_domain search)
{
/* Clear the search flags. */
- for (partial_symtab *ps : require_partial_symbols (objfile))
+ for (partial_symtab *ps : partial_symbols (objfile))
ps->searched_flag = PST_NOT_SEARCHED;
gdb::optional<lookup_name_info> psym_lookup_name;
@@ -1161,7 +1158,7 @@ psymbol_functions::has_symbols (struct objfile *objfile)
bool
psymbol_functions::has_unexpanded_symtabs (struct objfile *objfile)
{
- for (partial_symtab *psymtab : require_partial_symbols (objfile))
+ for (partial_symtab *psymtab : partial_symbols (objfile))
{
/* Is this already expanded? */
if (psymtab->readin_p (objfile))
@@ -1209,7 +1206,7 @@ psymbol_functions::find_compunit_symtab_by_address (struct objfile *objfile,
{
std::set<CORE_ADDR> seen_addrs;
- for (partial_symtab *pst : require_partial_symbols (objfile))
+ for (partial_symtab *pst : partial_symbols (objfile))
{
fill_psymbol_map (objfile, pst,
&seen_addrs,
@@ -1594,7 +1591,7 @@ maintenance_print_psymbols (const char *args, int from_tty)
}
else
{
- for (partial_symtab *ps : psf->require_partial_symbols (objfile))
+ for (partial_symtab *ps : psf->partial_symbols (objfile))
{
int print_for_source = 0;
@@ -1665,7 +1662,7 @@ maintenance_info_psymtabs (const char *regexp, int from_tty)
= dynamic_cast<psymbol_functions *> (iter.get ());
if (psf == nullptr)
continue;
- for (partial_symtab *psymtab : psf->require_partial_symbols (objfile))
+ for (partial_symtab *psymtab : psf->partial_symbols (objfile))
{
QUIT;
@@ -1772,7 +1769,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
if (psf == nullptr)
continue;
- for (partial_symtab *ps : psf->require_partial_symbols (objfile))
+ for (partial_symtab *ps : psf->partial_symbols (objfile))
{
struct gdbarch *gdbarch = objfile->arch ();
--
2.25.1
next prev parent reply other threads:[~2022-05-20 22:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 18:45 [PATCH v2 0/2] Fix regression with lazy-loading of partial symbols Lancelot SIX via Gdb-patches
2022-05-19 18:45 ` [PATCH v2 1/2] gdb: Require psymtab before calling quick_functions in objfile Lancelot SIX via Gdb-patches
2022-05-20 15:51 ` Tom Tromey
2022-05-20 23:07 ` Lancelot SIX via Gdb-patches
2022-05-21 1:07 ` Tom Tromey
2022-05-19 18:45 ` [PATCH v2 2/2] gdb: Simplify psymbol_functions::require_partial_symbols Lancelot SIX via Gdb-patches
2022-05-20 15:51 ` Tom Tromey
2022-05-20 16:07 ` Simon Marchi via Gdb-patches
2022-05-20 22:55 ` Lancelot SIX via Gdb-patches [this message]
2022-05-26 17:57 ` [PATCH v3 2/2] gdb: Change psymbol_functions::require_partial_symbols to partial_symbols Tom Tromey
2022-05-26 20:42 ` Lancelot SIX via Gdb-patches
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=20220520225530.372343-1-lancelot.six@amd.com \
--to=gdb-patches@sourceware.org \
--cc=lancelot.six@amd.com \
--cc=lsix@lancelotsix.com \
--cc=simark@simark.ca \
/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