aboutsummaryrefslogtreecommitdiff
path: root/gdb/ctfread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-10-17 12:34:53 -0600
committerTom Tromey <tom@tromey.com>2020-10-17 12:34:53 -0600
commit932539d7a35ccc15316ec8cc0ef0fefcb3c08f4d (patch)
tree0d5429e890098ea06ec1eec96cc2aafd45fe6e33 /gdb/ctfread.c
parentcfabbd351a174406fd5aa063303f5c8bf9266bbc (diff)
downloadfsf-binutils-gdb-932539d7a35ccc15316ec8cc0ef0fefcb3c08f4d.zip
fsf-binutils-gdb-932539d7a35ccc15316ec8cc0ef0fefcb3c08f4d.tar.gz
fsf-binutils-gdb-932539d7a35ccc15316ec8cc0ef0fefcb3c08f4d.tar.bz2
Have partial symbol tables own psymbol vectors
Currently pointers to all partial symbols are stored in two vectors; and then indices into these vectors are stored in each partial_symtab. This patch changes this so that each partial symtab instead has vectors of symbols. add_psymbol_to_list can now be changed into a method on partial_symtab as well. My main motivation for doing this is that I am looking into calling sort_pst_symbols in the background. However, I haven't actually implemented this yet. (Also this may make it more feasible to also sort the static psymbols, though I haven't tried that either.) Also, though, this lets us remove the "current_global_psymbols" vector, because now the callers can simply refer directly to the psymtab that they are modifying (formerly this was implicit). The main drawback of this patch is that it increases the size of partial symtab. gdb/ChangeLog 2020-10-17 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_end_psymtab): Use partial_symtab::empty. (scan_xcoff_symtab): Update. * psymtab.h (class psymtab_storage) <global_psymbols, static_psymbols, current_global_psymbols, current_static_psymbols>: Remove. * psymtab.c (require_partial_symbols, find_pc_sect_psymbol) (match_partial_symbol, lookup_partial_symbol): Update. (print_partial_symbols): Change parameters. (dump_psymtab, recursively_search_psymtabs) (psym_fill_psymbol_map, psym_find_compunit_symtab_by_address) (sort_pst_symbols, partial_symtab::partial_symtab): Update. (concat): Remove. (end_psymtab_common): Simplify. (append_psymbol_to_list): Change parameters. (partial_symtabs::add_psymbol): Rename from add_psymbol_to_list. (init_psymbol_list): Simplify. (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * psympriv.h (struct partial_symtab) <empty>: New method. <globals_offset, n_global_syms, statics_offset, n_static_syms>: Remove. <global_psymbols, static_psymbols>: New members. <add_psymbol>: New methods. (add_psymbol_to_list): Don't declare. (psymbol_placement): Move earlier. * mdebugread.c (parse_partial_symbols): Update. (handle_psymbol_enumerators): Change parameters. (mdebug_expand_psymtab): Update. * dwarf2/read.c (process_psymtab_comp_unit_reader) (add_partial_symbol): Update. * dwarf2/index-write.c (write_psymbols): Change parameters. (write_one_signatured_type): Update. (recursively_count_psymbols): Update. (recursively_write_psymbols): Update. (class debug_names) <recursively_write_psymbols>: Update. <write_psymbols>: Change parameters. <write_one_signatured_type>: Update. * dbxread.c (read_dbx_symtab): Update. (dbx_end_psymtab): Use partial_symtab::empty. * ctfread.c (struct ctf_context) <pst>: New member. (create_partial_symtab): Set it. (ctf_psymtab_type_cb, ctf_psymtab_var_cb): Update. (scan_partial_symbols): Use the psymtab's context. Update.
Diffstat (limited to 'gdb/ctfread.c')
-rw-r--r--gdb/ctfread.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 0237b48..3c506dd 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -115,6 +115,7 @@ struct ctf_context
{
ctf_file_t *fp;
struct objfile *of;
+ partial_symtab *pst;
struct buildsym_compunit *builder;
};
@@ -1320,6 +1321,8 @@ create_partial_symtab (const char *name,
ccx = XOBNEW (&objfile->objfile_obstack, struct ctf_context);
ccx->fp = cfp;
ccx->of = objfile;
+ ccx->pst = pst;
+ ccx->builder = nullptr;
pst->context = ccx;
return pst;
@@ -1377,7 +1380,7 @@ ctf_psymtab_type_cb (ctf_id_t tid, void *arg)
return 0;
}
- add_psymbol_to_list (name.get (), true,
+ ccp->pst->add_psymbol (name.get (), true,
domain, aclass, section,
psymbol_placement::GLOBAL,
0, language_c, ccp->of);
@@ -1392,10 +1395,10 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg)
{
struct ctf_context *ccp = (struct ctf_context *) arg;
- add_psymbol_to_list (name, true,
- VAR_DOMAIN, LOC_STATIC, -1,
- psymbol_placement::GLOBAL,
- 0, language_c, ccp->of);
+ ccp->pst->add_psymbol (name, true,
+ VAR_DOMAIN, LOC_STATIC, -1,
+ psymbol_placement::GLOBAL,
+ 0, language_c, ccp->of);
return 0;
}
@@ -1405,19 +1408,17 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg)
static void
scan_partial_symbols (ctf_file_t *cfp, struct objfile *of)
{
- struct ctf_context ccx;
bfd *abfd = of->obfd;
const char *name = bfd_get_filename (abfd);
ctf_psymtab *pst = create_partial_symtab (name, cfp, of);
- ccx.fp = cfp;
- ccx.of = of;
+ struct ctf_context *ccx = pst->context;
- if (ctf_type_iter (cfp, ctf_psymtab_type_cb, &ccx) == CTF_ERR)
+ if (ctf_type_iter (cfp, ctf_psymtab_type_cb, ccx) == CTF_ERR)
complaint (_("ctf_type_iter scan_partial_symbols failed - %s"),
ctf_errmsg (ctf_errno (cfp)));
- if (ctf_variable_iter (cfp, ctf_psymtab_var_cb, &ccx) == CTF_ERR)
+ if (ctf_variable_iter (cfp, ctf_psymtab_var_cb, ccx) == CTF_ERR)
complaint (_("ctf_variable_iter scan_partial_symbols failed - %s"),
ctf_errmsg (ctf_errno (cfp)));
@@ -1457,10 +1458,10 @@ scan_partial_symbols (ctf_file_t *cfp, struct objfile *of)
else
aclass = LOC_TYPEDEF;
- add_psymbol_to_list (tname.get (), true,
- tdomain, aclass, -1,
- psymbol_placement::STATIC,
- 0, language_c, of);
+ pst->add_psymbol (tname.get (), true,
+ tdomain, aclass, -1,
+ psymbol_placement::STATIC,
+ 0, language_c, of);
}
end_psymtab_common (of, pst);