aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-20 17:23:40 -0600
committerTom Tromey <tom@tromey.com>2021-03-20 17:23:45 -0600
commit7b249e470a82063605c3789f4b2d0378400423de (patch)
tree748b61bd197aa3beff13a90cea71bd40da24e052 /gdb/psymtab.c
parentd1eef86d12f5aa2f8461add1180df9db4b59a39d (diff)
downloadgdb-7b249e470a82063605c3789f4b2d0378400423de.zip
gdb-7b249e470a82063605c3789f4b2d0378400423de.tar.gz
gdb-7b249e470a82063605c3789f4b2d0378400423de.tar.bz2
Add partial_symtabs parameter to psymtab construction functions
This adds a partial_symtabs parameter to the psymtab constructors and to add_psymbol. This helps with the overall project of removing the partial symtabs from the objfile. gdb/ChangeLog 2021-03-20 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_start_psymtab): Add partial_symtabs parameter. (xcoff_end_psymtab, scan_xcoff_symtab): Update. * psymtab.c (partial_symtab::partial_symtab): Add partial_symtabs parameter. (add_psymbol_to_bcache): Remove. (partial_symtab::add_psymbol): Add partial_symtabs parameter. (partial_symtab::add_psymbol, partial_symtab::partial_symtab): Likewise. * psympriv.h (partial_symtab): Add partial_symtabs parameter. <add_psymbol>: Likewise. (standard_psymtab, legacy_psymtab): Likewise. * mdebugread.c (parse_partial_symbols): Update. (handle_psymbol_enumerators): Add partial_symtabs parameter. (handle_psymbol_enumerators): Update. (new_psymtab): Add partial_symtabs parameter. * dwarf2/read.h (dwarf2_psymtab): Add partial_symtabs parameter. * dwarf2/read.c (dwarf2_include_psymtab): Add partial_symtabs parameter. (dwarf2_create_include_psymtab): Add partial_symtabs parameter. (create_partial_symtab, add_partial_symbol, dwarf_decode_lines): Update. * dbxread.c (read_dbx_symtab): Update. (start_psymtab): Add partial_symtabs parameter. (dbx_end_psymtab): Update. * ctfread.c (struct ctf_context) <partial_symtabs>: New member. (ctf_psymtab): Add partial_symtabs parameter. (create_partial_symtab, ctf_psymtab_type_cb, ctf_psymtab_var_cb): Update. (scan_partial_symbols): Add partial_symtabs parameter. (scan_partial_symbols, elfctf_build_psymtabs) (ctf_psymtab_add_enums): Update.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 302ef9a..e662ba1 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1447,9 +1447,10 @@ make_psymbol_functions (const std::shared_ptr<psymtab_storage> &storage)
the end of the symbol list. */
partial_symtab::partial_symtab (const char *filename,
+ psymtab_storage *partial_symtabs,
struct objfile *objfile,
CORE_ADDR textlow)
- : partial_symtab (filename, objfile)
+ : partial_symtab (filename, partial_symtabs, objfile)
{
set_text_low (textlow);
set_text_high (raw_text_low ()); /* default */
@@ -1514,33 +1515,21 @@ psymbol_bcache::compare (const void *addr1, const void *addr2, int length)
&& sym1->ginfo.linkage_name () == sym2->ginfo.linkage_name ());
}
-/* Helper function, initialises partial symbol structure and stashes
- it into objfile's bcache. Note that our caching mechanism will
- use all fields of struct partial_symbol to determine hash value of the
- structure. In other words, having two symbols with the same name but
- different domain (or address) is possible and correct. */
-
-static struct partial_symbol *
-add_psymbol_to_bcache (const partial_symbol &psymbol, struct objfile *objfile,
- bool *added)
-{
- /* Stash the partial symbol away in the cache. */
- return ((struct partial_symbol *)
- objfile->partial_symtabs->psymbol_cache.insert
- (&psymbol, sizeof (struct partial_symbol), added));
-}
-
/* See psympriv.h. */
void
partial_symtab::add_psymbol (const partial_symbol &psymbol,
psymbol_placement where,
+ psymtab_storage *partial_symtabs,
struct objfile *objfile)
{
bool added;
/* Stash the partial symbol away in the cache. */
- partial_symbol *psym = add_psymbol_to_bcache (psymbol, objfile, &added);
+ partial_symbol *psym
+ = ((struct partial_symbol *)
+ partial_symtabs->psymbol_cache.insert
+ (&psymbol, sizeof (struct partial_symbol), &added));
/* Do not duplicate global partial symbols. */
if (where == psymbol_placement::GLOBAL && !added)
@@ -1563,7 +1552,9 @@ partial_symtab::add_psymbol (gdb::string_view name, bool copy_name,
short section,
psymbol_placement where,
CORE_ADDR coreaddr,
- enum language language, struct objfile *objfile)
+ enum language language,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile)
{
struct partial_symbol psymbol;
memset (&psymbol, 0, sizeof (psymbol));
@@ -1572,20 +1563,22 @@ partial_symtab::add_psymbol (gdb::string_view name, bool copy_name,
psymbol.ginfo.set_section_index (section);
psymbol.domain = domain;
psymbol.aclass = theclass;
- psymbol.ginfo.set_language (language, objfile->partial_symtabs->obstack ());
+ psymbol.ginfo.set_language (language, partial_symtabs->obstack ());
psymbol.ginfo.compute_and_set_names (name, copy_name, objfile->per_bfd);
- add_psymbol (psymbol, where, objfile);
+ add_psymbol (psymbol, where, partial_symtabs, objfile);
}
/* See psympriv.h. */
-partial_symtab::partial_symtab (const char *filename_, struct objfile *objfile)
+partial_symtab::partial_symtab (const char *filename_,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile)
: searched_flag (PST_NOT_SEARCHED),
text_low_valid (0),
text_high_valid (0)
{
- objfile->partial_symtabs->install_psymtab (this);
+ partial_symtabs->install_psymtab (this);
filename = objfile->intern (filename_);