aboutsummaryrefslogtreecommitdiff
path: root/gdb/ctfread.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/ctfread.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/ctfread.c')
-rw-r--r--gdb/ctfread.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 4ff475f..7713500 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -115,6 +115,7 @@ struct ctf_context
{
ctf_dict_t *fp;
struct objfile *of;
+ psymtab_storage *partial_symtabs;
partial_symtab *pst;
struct buildsym_compunit *builder;
};
@@ -122,8 +123,11 @@ struct ctf_context
/* A partial symtab, specialized for this module. */
struct ctf_psymtab : public standard_psymtab
{
- ctf_psymtab (const char *filename, struct objfile *objfile, CORE_ADDR addr)
- : standard_psymtab (filename, objfile, addr)
+ ctf_psymtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile,
+ CORE_ADDR addr)
+ : standard_psymtab (filename, partial_symtabs, objfile, addr)
{
}
@@ -1259,7 +1263,7 @@ ctf_psymtab_add_enums (struct ctf_context *ccp, ctf_id_t tid)
ccp->pst->add_psymbol (ename, true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::GLOBAL,
- 0, language_c, ccp->of);
+ 0, language_c, ccp->partial_symtabs, ccp->of);
}
if (ctf_errno (ccp->fp) != ECTF_NEXT_END)
complaint (_("ctf_enum_next ctf_psymtab_add_enums failed - %s"),
@@ -1359,16 +1363,18 @@ ctf_psymtab::read_symtab (struct objfile *objfile)
static ctf_psymtab *
create_partial_symtab (const char *name,
ctf_dict_t *cfp,
+ psymtab_storage *partial_symtabs,
struct objfile *objfile)
{
ctf_psymtab *pst;
struct ctf_context *ccx;
- pst = new ctf_psymtab (name, objfile, 0);
+ pst = new ctf_psymtab (name, partial_symtabs, objfile, 0);
ccx = XOBNEW (&objfile->objfile_obstack, struct ctf_context);
ccx->fp = cfp;
ccx->of = objfile;
+ ccx->partial_symtabs = partial_symtabs;
ccx->pst = pst;
ccx->builder = nullptr;
pst->context = ccx;
@@ -1434,7 +1440,7 @@ ctf_psymtab_type_cb (ctf_id_t tid, void *arg)
ccp->pst->add_psymbol (name.get (), true,
domain, aclass, section,
psymbol_placement::GLOBAL,
- 0, language_c, ccp->of);
+ 0, language_c, ccp->partial_symtabs, ccp->of);
return 0;
}
@@ -1449,7 +1455,7 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg)
ccp->pst->add_psymbol (name, true,
VAR_DOMAIN, LOC_STATIC, -1,
psymbol_placement::GLOBAL,
- 0, language_c, ccp->of);
+ 0, language_c, ccp->partial_symtabs, ccp->of);
return 0;
}
@@ -1457,11 +1463,12 @@ ctf_psymtab_var_cb (const char *name, ctf_id_t id, void *arg)
debugging information is available. */
static void
-scan_partial_symbols (ctf_dict_t *cfp, struct objfile *of)
+scan_partial_symbols (ctf_dict_t *cfp, psymtab_storage *partial_symtabs,
+ struct objfile *of)
{
bfd *abfd = of->obfd;
const char *name = bfd_get_filename (abfd);
- ctf_psymtab *pst = create_partial_symtab (name, cfp, of);
+ ctf_psymtab *pst = create_partial_symtab (name, cfp, partial_symtabs, of);
struct ctf_context *ccx = pst->context;
@@ -1512,7 +1519,7 @@ scan_partial_symbols (ctf_dict_t *cfp, struct objfile *of)
pst->add_psymbol (tname.get (), true,
tdomain, aclass, -1,
psymbol_placement::STATIC,
- 0, language_c, of);
+ 0, language_c, partial_symtabs, of);
}
pst->end ();
@@ -1539,7 +1546,8 @@ elfctf_build_psymtabs (struct objfile *of)
bfd_get_filename (abfd), ctf_errmsg (err));
ctf_dict_key.emplace (of, fp);
- scan_partial_symbols (fp, of);
+ psymtab_storage *partial_symtabs = of->partial_symtabs.get ();
+ scan_partial_symbols (fp, partial_symtabs, of);
}
#else