From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7833) id C63C53857349; Thu, 26 May 2022 20:37:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C63C53857349 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Lancelot SIX To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: Change psymbol_functions::require_partial_symbols to partial_symbols X-Act-Checkin: binutils-gdb X-Git-Author: Lancelot SIX X-Git-Refname: refs/heads/master X-Git-Oldrev: fcf8e814206f9f5a0a90b2f509fe12d841fa5163 X-Git-Newrev: 98aa8321ee1bbd4b511992f2bbc4d34450c4a3f9 Message-Id: <20220526203713.C63C53857349@sourceware.org> Date: Thu, 26 May 2022 20:37:13 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2022 20:37:13 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D98aa8321ee1b= bd4b511992f2bbc4d34450c4a3f9 commit 98aa8321ee1bbd4b511992f2bbc4d34450c4a3f9 Author: Lancelot SIX Date: Tue May 24 13:32:18 2022 +0100 gdb: Change psymbol_functions::require_partial_symbols to partial_symbo= ls =20 The previous patch ensured that partial symbols are read before calling most of the quick_function's methods. =20 The psymbol_functions class has the require_partial_symbols method which serves this exact purpose, and does not need to do it anymore. =20 This patch renames this method to partial_symbols and makes it an acces= sor which asserts that partial symbols have been read at this point. =20 Regression tested on x86_64-linux. Diff: --- 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 (); } =20 - /* 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); =20 /* 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) =20 =0C =20 -/* 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. */ =20 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) !=3D 0); return m_partial_symtabs->range (); } =20 @@ -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. */ =20 - for (partial_symtab *pst : require_partial_symbols (objfile)) + for (partial_symtab *pst : partial_symbols (objfile)) if (!pst->psymtabs_addrmap_supported && pc >=3D pst->text_low (objfile) && pc < pst->text_high (objfile)) { @@ -358,7 +355,7 @@ psymbol_functions::lookup_global_symbol_language (struc= t objfile *objfile, =20 lookup_name_info lookup_name (name, symbol_name_match_type::FULL); =20 - 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 objf= ile *ofp) { struct partial_symtab *cs_pst =3D NULL; =20 - for (partial_symtab *ps : require_partial_symbols (ofp)) + for (partial_symtab *ps : partial_symbols (ofp)) { const char *name =3D ps->filename; int len =3D strlen (name); @@ -643,7 +640,7 @@ psymbol_functions::find_last_source_symtab (struct objf= ile *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 !=3D NULL) { @@ -839,7 +836,7 @@ psymbol_functions::print_stats (struct objfile *objfile= , bool print_bcache) n_psyms); =20 i =3D 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); } =20 @@ -897,7 +894,7 @@ psymbol_functions::map_symbol_filenames gdb::function_view fun, bool need_fullname) { - for (partial_symtab *ps : require_partial_symbols (objfile)) + for (partial_symtab *ps : partial_symbols (objfile)) { const char *fullname; =20 @@ -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 =3D PST_NOT_SEARCHED; =20 gdb::optional psym_lookup_name; @@ -1161,7 +1158,7 @@ psymbol_functions::has_symbols (struct objfile *objfi= le) 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 (s= truct objfile *objfile, { std::set seen_addrs; =20 - 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 fro= m_tty) } else { - for (partial_symtab *ps : psf->require_partial_symbols (objfile)) + for (partial_symtab *ps : psf->partial_symbols (objfile)) { int print_for_source =3D 0; =20 @@ -1665,7 +1662,7 @@ maintenance_info_psymtabs (const char *regexp, int fr= om_tty) =3D dynamic_cast (iter.get ()); if (psf =3D=3D nullptr) continue; - for (partial_symtab *psymtab : psf->require_partial_symbols (objfile)) + for (partial_symtab *psymtab : psf->partial_symbols (objfile)) { QUIT; =20 @@ -1772,7 +1769,7 @@ maintenance_check_psymtabs (const char *ignore, int f= rom_tty) if (psf =3D=3D nullptr) continue; =20 - for (partial_symtab *ps : psf->require_partial_symbols (objfile)) + for (partial_symtab *ps : psf->partial_symbols (objfile)) { struct gdbarch *gdbarch =3D objfile->arch ();