From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 21/26] Add partial_symtabs parameter to psymtab construction functions
Date: Sun, 28 Feb 2021 13:37:58 -0700 [thread overview]
Message-ID: <20210228203803.1693413-22-tom@tromey.com> (raw)
In-Reply-To: <20210228203803.1693413-1-tom@tromey.com>
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-02-28 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): Update.
---
gdb/ChangeLog | 33 ++++++++++++++++++++++++
gdb/ctfread.c | 26 ++++++++++++-------
gdb/dbxread.c | 42 ++++++++++++++++++------------
gdb/dwarf2/read.c | 26 +++++++++++++------
gdb/dwarf2/read.h | 6 +++--
gdb/mdebugread.c | 65 ++++++++++++++++++++++++++++++-----------------
gdb/psympriv.h | 34 +++++++++++++++++--------
gdb/psymtab.c | 39 ++++++++++++----------------
gdb/xcoffread.c | 39 ++++++++++++++++++----------
9 files changed, 204 insertions(+), 106 deletions(-)
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 928cb3025c3..6adfcc12056 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)
{
}
@@ -1311,16 +1315,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;
@@ -1383,7 +1389,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;
}
@@ -1398,7 +1404,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;
}
@@ -1406,11 +1412,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;
@@ -1461,7 +1468,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 ();
@@ -1488,7 +1495,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
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index e0cc2597f73..a6f44d5a564 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -298,8 +298,8 @@ static void add_old_header_file (const char *, int);
static void add_this_object_header_file (int);
-static legacy_psymtab *start_psymtab (struct objfile *, const char *,
- CORE_ADDR, int);
+static legacy_psymtab *start_psymtab (psymtab_storage *, struct objfile *,
+ const char *, CORE_ADDR, int);
/* Free up old header file tables. */
@@ -1291,7 +1291,7 @@ read_dbx_symtab (minimal_symbol_reader &reader,
if (!pst)
{
- pst = start_psymtab (objfile,
+ pst = start_psymtab (partial_symtabs, objfile,
namestring, valu,
first_so_symnum * symbol_size);
pst->dirname = dirname_nso;
@@ -1467,7 +1467,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
VAR_DOMAIN, LOC_STATIC,
data_sect_index,
psymbol_placement::STATIC,
- nlist.n_value, psymtab_language, objfile);
+ nlist.n_value, psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'G':
@@ -1477,7 +1478,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
VAR_DOMAIN, LOC_STATIC,
data_sect_index,
psymbol_placement::GLOBAL,
- nlist.n_value, psymtab_language, objfile);
+ nlist.n_value, psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'T':
@@ -1494,14 +1496,16 @@ read_dbx_symtab (minimal_symbol_reader &reader,
pst->add_psymbol (gdb::string_view (sym_name, sym_len),
true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
pst->add_psymbol (gdb::string_view (sym_name, sym_len),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
p += 1;
}
}
@@ -1513,7 +1517,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
pst->add_psymbol (gdb::string_view (sym_name, sym_len),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
}
check_enum:
/* If this is an enumerated type, we need to
@@ -1574,7 +1579,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
pst->add_psymbol (gdb::string_view (p, q - p), true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC, 0,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
/* Point past the name. */
p = q;
/* Skip over the value. */
@@ -1592,7 +1598,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
pst->add_psymbol (gdb::string_view (sym_name, sym_len), true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC, 0,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'f':
@@ -1648,7 +1655,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
psymbol_placement::STATIC,
- nlist.n_value, psymtab_language, objfile);
+ nlist.n_value, psymtab_language,
+ partial_symtabs, objfile);
continue;
/* Global functions were ignored here, but now they
@@ -1707,7 +1715,8 @@ read_dbx_symtab (minimal_symbol_reader &reader,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
psymbol_placement::GLOBAL,
- nlist.n_value, psymtab_language, objfile);
+ nlist.n_value, psymtab_language,
+ partial_symtabs, objfile);
continue;
/* Two things show up here (hopefully); static symbols of
@@ -1902,10 +1911,11 @@ read_dbx_symtab (minimal_symbol_reader &reader,
(normal). */
static legacy_psymtab *
-start_psymtab (struct objfile *objfile, const char *filename, CORE_ADDR textlow,
- int ldsymoff)
+start_psymtab (psymtab_storage *partial_symtabs, struct objfile *objfile,
+ const char *filename, CORE_ADDR textlow, int ldsymoff)
{
- legacy_psymtab *result = new legacy_psymtab (filename, objfile, textlow);
+ legacy_psymtab *result = new legacy_psymtab (filename, partial_symtabs,
+ objfile, textlow);
result->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct symloc);
@@ -2028,7 +2038,7 @@ dbx_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
for (i = 0; i < num_includes; i++)
{
legacy_psymtab *subpst =
- new legacy_psymtab (include_list[i], objfile);
+ new legacy_psymtab (include_list[i], partial_symtabs, objfile);
subpst->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct symloc);
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3a050b351a0..183876bb5b7 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -6467,8 +6467,10 @@ read_abbrev_offset (dwarf2_per_objfile *per_objfile,
/* A partial symtab that is used only for include files. */
struct dwarf2_include_psymtab : public partial_symtab
{
- dwarf2_include_psymtab (const char *filename, struct objfile *objfile)
- : partial_symtab (filename, objfile)
+ dwarf2_include_psymtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile)
+ : partial_symtab (filename, partial_symtabs, objfile)
{
}
@@ -6521,10 +6523,13 @@ struct dwarf2_include_psymtab : public partial_symtab
static void
dwarf2_create_include_psymtab (dwarf2_per_bfd *per_bfd,
- const char *name, dwarf2_psymtab *pst,
+ const char *name,
+ dwarf2_psymtab *pst,
+ psymtab_storage *partial_symtabs,
struct objfile *objfile)
{
- dwarf2_include_psymtab *subpst = new dwarf2_include_psymtab (name, objfile);
+ dwarf2_include_psymtab *subpst
+ = new dwarf2_include_psymtab (name, partial_symtabs, objfile);
if (!IS_ABSOLUTE_PATH (subpst->filename))
subpst->dirname = pst->dirname;
@@ -7779,7 +7784,8 @@ create_partial_symtab (dwarf2_per_cu_data *per_cu,
struct objfile *objfile = per_objfile->objfile;
dwarf2_psymtab *pst;
- pst = new dwarf2_psymtab (name, objfile, per_cu);
+ pst = new dwarf2_psymtab (name, per_objfile->per_bfd->partial_symtabs.get (),
+ objfile, per_cu);
pst->psymtabs_addrmap_supported = true;
@@ -8893,7 +8899,9 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
&objfile->objfile_obstack);
psymbol.ginfo.set_linkage_name (pdi->linkage_name);
}
- cu->per_cu->v.psymtab->add_psymbol (psymbol, *where, objfile);
+ cu->per_cu->v.psymtab->add_psymbol
+ (psymbol, *where, per_objfile->per_bfd->partial_symtabs.get (),
+ objfile);
}
}
@@ -22096,8 +22104,10 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
psymtab_include_file_name (lh, file_entry, pst,
comp_dir, &name_holder);
if (include_name != NULL)
- dwarf2_create_include_psymtab (cu->per_objfile->per_bfd,
- include_name, pst, objfile);
+ dwarf2_create_include_psymtab
+ (cu->per_objfile->per_bfd, include_name, pst,
+ cu->per_objfile->per_bfd->partial_symtabs.get (),
+ objfile);
}
}
else
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index aba1d83e468..236b3358190 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -406,9 +406,11 @@ dwarf2_per_objfile *get_dwarf2_per_objfile (struct objfile *objfile);
/* A partial symtab specialized for DWARF. */
struct dwarf2_psymtab : public partial_symtab
{
- dwarf2_psymtab (const char *filename, struct objfile *objfile,
+ dwarf2_psymtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile,
dwarf2_per_cu_data *per_cu)
- : partial_symtab (filename, objfile, 0),
+ : partial_symtab (filename, partial_symtabs, objfile, 0),
per_cu_data (per_cu)
{
}
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index d178beef734..34ee718e22a 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -252,7 +252,8 @@ static struct symbol *mylookup_symbol (const char *, const struct block *,
static void sort_blocks (struct symtab *);
-static legacy_psymtab *new_psymtab (const char *, struct objfile *);
+static legacy_psymtab *new_psymtab (const char *, psymtab_storage *,
+ struct objfile *);
static void mdebug_expand_psymtab (legacy_psymtab *pst,
struct objfile *objfile);
@@ -265,7 +266,8 @@ static int add_line (struct linetable *, int, CORE_ADDR, int);
static struct linetable *shrink_linetable (struct linetable *);
-static void handle_psymbol_enumerators (struct objfile *, partial_symtab *,
+static void handle_psymbol_enumerators (struct objfile *, psymtab_storage *,
+ partial_symtab *,
FDR *, int, CORE_ADDR);
static const char *mdebug_next_symbol_text (struct objfile *);
@@ -2365,7 +2367,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
fdr_to_pst = fdr_to_pst_holder.data ();
fdr_to_pst++;
{
- legacy_psymtab *new_pst = new_psymtab ("", objfile);
+ legacy_psymtab *new_pst = new_psymtab ("", partial_symtabs, objfile);
fdr_to_pst[-1].pst = new_pst;
FDR_IDX (new_pst) = -1;
@@ -2601,7 +2603,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
textlow = fh->adr;
else
textlow = 0;
- pst = new legacy_psymtab (fdr_name (fh), objfile, textlow);
+ pst = new legacy_psymtab (fdr_name (fh), partial_symtabs, objfile,
+ textlow);
pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc);
memset (pst->read_symtab_private, 0, sizeof (struct symloc));
@@ -3038,7 +3041,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
SECT_OFF_DATA (objfile),
psymbol_placement::STATIC,
sh.value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'G':
/* The addresses in these entries are reported
@@ -3050,7 +3054,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
SECT_OFF_DATA (objfile),
psymbol_placement::GLOBAL,
sh.value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'T':
@@ -3068,7 +3073,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
(gdb::string_view (namestring, p - namestring),
true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC, 0, psymtab_language,
- objfile);
+ partial_symtabs, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
@@ -3077,7 +3082,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC, 0,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
p += 1;
}
}
@@ -3091,7 +3097,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC, 0, psymtab_language,
- objfile);
+ partial_symtabs, objfile);
}
check_enum:
/* If this is an enumerated type, we need to add
@@ -3158,7 +3164,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
LOC_CONST, -1,
psymbol_placement::STATIC,
0, psymtab_language,
- objfile);
+ partial_symtabs, objfile);
/* Point past the name. */
p = q;
/* Skip over the value. */
@@ -3176,7 +3182,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'f':
@@ -3192,7 +3199,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
SECT_OFF_TEXT (objfile),
psymbol_placement::STATIC,
sh.value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
/* Global functions were ignored here, but now they
@@ -3212,7 +3220,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
SECT_OFF_TEXT (objfile),
psymbol_placement::GLOBAL,
sh.value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
/* Two things show up here (hopefully); static
@@ -3446,13 +3455,15 @@ parse_partial_symbols (minimal_symbol_reader &reader,
VAR_DOMAIN, LOC_BLOCK,
section,
psymbol_placement::GLOBAL,
- sh.value, psymtab_language, objfile);
+ sh.value, psymtab_language,
+ partial_symtabs, objfile);
else
pst->add_psymbol (sym_name, true,
VAR_DOMAIN, LOC_BLOCK,
section,
psymbol_placement::STATIC,
- sh.value, psymtab_language, objfile);
+ sh.value, psymtab_language,
+ partial_symtabs, objfile);
procaddr = sh.value;
@@ -3518,10 +3529,11 @@ parse_partial_symbols (minimal_symbol_reader &reader,
pst->add_psymbol (sym_name, true,
STRUCT_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
}
- handle_psymbol_enumerators (objfile, pst, fh,
- sh.st, sh.value);
+ handle_psymbol_enumerators (objfile, partial_symtabs,
+ pst, fh, sh.st, sh.value);
/* Skip over the block. */
new_sdx = sh.index;
@@ -3559,7 +3571,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
pst->add_psymbol (sym_name, true,
VAR_DOMAIN, theclass, section,
psymbol_placement::STATIC,
- sh.value, psymtab_language, objfile);
+ sh.value, psymtab_language,
+ partial_symtabs, objfile);
skip:
cur_sdx++; /* Go to next file symbol. */
}
@@ -3638,7 +3651,8 @@ parse_partial_symbols (minimal_symbol_reader &reader,
VAR_DOMAIN, theclass,
section,
psymbol_placement::GLOBAL,
- svalue, psymtab_language, objfile);
+ svalue, psymtab_language,
+ partial_symtabs, objfile);
}
}
@@ -3740,7 +3754,9 @@ parse_partial_symbols (minimal_symbol_reader &reader,
all the enum constants to the partial symbol table. */
static void
-handle_psymbol_enumerators (struct objfile *objfile, partial_symtab *pst,
+handle_psymbol_enumerators (struct objfile *objfile,
+ psymtab_storage *partial_symtabs,
+ partial_symtab *pst,
FDR *fh, int stype, CORE_ADDR svalue)
{
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
@@ -3799,7 +3815,7 @@ handle_psymbol_enumerators (struct objfile *objfile, partial_symtab *pst,
pst->add_psymbol (name, true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC, 0,
- psymtab_language, objfile);
+ psymtab_language, partial_symtabs, objfile);
ext_sym += external_sym_size;
}
}
@@ -4623,11 +4639,12 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile)
/* Allocate a new partial_symtab NAME. */
static legacy_psymtab *
-new_psymtab (const char *name, struct objfile *objfile)
+new_psymtab (const char *name, psymtab_storage *partial_symtabs,
+ struct objfile *objfile)
{
legacy_psymtab *psymtab;
- psymtab = new legacy_psymtab (name, objfile);
+ psymtab = new legacy_psymtab (name, partial_symtabs, objfile);
/* Keep a backpointer to the file's symbols. */
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index b1b8027ce3a..8717bd259e1 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -117,14 +117,18 @@ struct partial_symtab
partial symtab will also be installed using
psymtab_storage::install. */
- partial_symtab (const char *filename, struct objfile *objfile)
+ partial_symtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile)
ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
/* Like the above, but also sets the initial text low and text high
from the ADDR argument, and sets the global- and
static-offsets. */
- partial_symtab (const char *filename, struct objfile *objfile,
+ partial_symtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile,
CORE_ADDR addr)
ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (3);
@@ -236,6 +240,7 @@ struct partial_symtab
psymbol_placement where,
CORE_ADDR coreaddr,
enum language language,
+ psymtab_storage *partial_symtabs,
struct objfile *objfile);
/* Add a symbol to this partial symbol table of OBJFILE. The psymbol
@@ -244,6 +249,7 @@ struct partial_symtab
void add_psymbol (const partial_symbol &psym,
psymbol_placement where,
+ psymtab_storage *partial_symtabs,
struct objfile *objfile);
@@ -361,14 +367,18 @@ struct partial_symtab
object. */
struct standard_psymtab : public partial_symtab
{
- standard_psymtab (const char *filename, struct objfile *objfile)
- : partial_symtab (filename, objfile)
+ standard_psymtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile)
+ : partial_symtab (filename, partial_symtabs, objfile)
{
}
- standard_psymtab (const char *filename, struct objfile *objfile,
+ standard_psymtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile,
CORE_ADDR addr)
- : partial_symtab (filename, objfile, addr)
+ : partial_symtab (filename, partial_symtabs, objfile, addr)
{
}
@@ -399,14 +409,18 @@ struct standard_psymtab : public partial_symtab
struct legacy_psymtab : public standard_psymtab
{
- legacy_psymtab (const char *filename, struct objfile *objfile)
- : standard_psymtab (filename, objfile)
+ legacy_psymtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile)
+ : standard_psymtab (filename, partial_symtabs, objfile)
{
}
- legacy_psymtab (const char *filename, struct objfile *objfile,
+ legacy_psymtab (const char *filename,
+ psymtab_storage *partial_symtabs,
+ struct objfile *objfile,
CORE_ADDR addr)
- : standard_psymtab (filename, objfile, addr)
+ : standard_psymtab (filename, partial_symtabs, objfile, addr)
{
}
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 302ef9a192f..e662ba16cd6 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_);
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index aab140d8aba..ee52ba53d92 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1959,11 +1959,13 @@ static unsigned int first_fun_line_offset;
(normal). */
static legacy_psymtab *
-xcoff_start_psymtab (struct objfile *objfile,
+xcoff_start_psymtab (psymtab_storage *partial_symtabs,
+ struct objfile *objfile,
const char *filename, int first_symnum)
{
/* We fill in textlow later. */
- legacy_psymtab *result = new legacy_psymtab (filename, objfile, 0);
+ legacy_psymtab *result = new legacy_psymtab (filename, partial_symtabs,
+ objfile, 0);
result->read_symtab_private =
XOBNEW (&objfile->objfile_obstack, struct symloc);
@@ -2019,7 +2021,7 @@ xcoff_end_psymtab (struct objfile *objfile, psymtab_storage *partial_symtabs,
for (i = 0; i < num_includes; i++)
{
legacy_psymtab *subpst =
- new legacy_psymtab (include_list[i], objfile);
+ new legacy_psymtab (include_list[i], partial_symtabs, objfile);
subpst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc);
((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
@@ -2243,7 +2245,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
/* Give all psymtabs for this source file the same
name. */
pst = xcoff_start_psymtab
- (objfile,
+ (partial_symtabs, objfile,
filestring,
symnum_before);
}
@@ -2426,7 +2428,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
else
filestring = namestring;
- pst = xcoff_start_psymtab (objfile,
+ pst = xcoff_start_psymtab (partial_symtabs, objfile,
filestring,
symnum_before);
last_csect_name = NULL;
@@ -2585,7 +2587,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
SECT_OFF_DATA (objfile),
psymbol_placement::STATIC,
symbol.n_value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'G':
@@ -2597,7 +2600,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
SECT_OFF_DATA (objfile),
psymbol_placement::GLOBAL,
symbol.n_value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'T':
@@ -2615,7 +2619,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p - namestring),
true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
@@ -2623,7 +2628,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
p += 1;
}
}
@@ -2636,7 +2642,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
}
check_enum:
/* If this is an enumerated type, we need to
@@ -2698,7 +2705,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
pst->add_psymbol (gdb::string_view (p, q - p), true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
/* Point past the name. */
p = q;
/* Skip over the value. */
@@ -2717,7 +2725,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
p - namestring),
true, VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC,
- 0, psymtab_language, objfile);
+ 0, psymtab_language,
+ partial_symtabs, objfile);
continue;
case 'f':
@@ -2737,7 +2746,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
SECT_OFF_TEXT (objfile),
psymbol_placement::STATIC,
symbol.n_value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
/* Global functions were ignored here, but now they
@@ -2768,7 +2778,8 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
SECT_OFF_TEXT (objfile),
psymbol_placement::GLOBAL,
symbol.n_value,
- psymtab_language, objfile);
+ psymtab_language,
+ partial_symtabs, objfile);
continue;
/* Two things show up here (hopefully); static symbols of
--
2.26.2
next prev parent reply other threads:[~2021-02-28 20:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 20:37 [PATCH 00/26] Allow multiple "partial" symtab readers per objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 01/26] Move some DWARF code out of symfile.h Tom Tromey
2021-02-28 20:37 ` [PATCH 02/26] Introduce dwarf2/public.h Tom Tromey
2021-02-28 20:37 ` [PATCH 03/26] Change objfile_has_partial_symbols to a method Tom Tromey
2021-02-28 20:37 ` [PATCH 04/26] Change objfile::has_partial_symbols to return bool Tom Tromey
2021-02-28 20:37 ` [PATCH 05/26] Introduce method wrappers for quick_symbol_functions Tom Tromey
2021-03-22 13:52 ` Simon Marchi
2021-02-28 20:37 ` [PATCH 06/26] Move quick_symbol_functions to a new header Tom Tromey
2021-02-28 20:37 ` [PATCH 07/26] Move sym_fns::qf to objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 08/26] Convert quick_symbol_functions to use methods Tom Tromey
2021-02-28 20:37 ` [PATCH 09/26] Move psymbol_map out of objfile Tom Tromey
2021-02-28 20:37 ` [PATCH 10/26] Change how some psymbol readers access the psymtab storage Tom Tromey
2021-02-28 20:37 ` [PATCH 11/26] Do not pass objfile to psymtab_discarder Tom Tromey
2021-02-28 20:37 ` [PATCH 12/26] Set per_bfd->partial_symtabs earlier Tom Tromey
2021-02-28 20:37 ` [PATCH 13/26] Change how DWARF indices use addrmap Tom Tromey
2021-02-28 20:37 ` [PATCH 14/26] Move psymtab statistics printing to psymtab.c Tom Tromey
2021-02-28 20:37 ` [PATCH 15/26] Change how DWARF index writer finds address map Tom Tromey
2021-02-28 20:37 ` [PATCH 16/26] Reference psymtabs via per_bfd in DWARF reader Tom Tromey
2021-02-28 20:37 ` [PATCH 17/26] Attach partial symtab storage to psymbol_functions Tom Tromey
2021-02-28 20:37 ` [PATCH 18/26] Rearrange psymtab_storage construction Tom Tromey
2021-02-28 20:37 ` [PATCH 19/26] Remove sym_fns::sym_read_psymbols Tom Tromey
2021-02-28 20:37 ` [PATCH 20/26] Introduce objfile::require_partial_symbols Tom Tromey
2021-02-28 20:37 ` Tom Tromey [this message]
2021-02-28 20:37 ` [PATCH 22/26] Remove last objfile partial_symtab references from psymtab.c Tom Tromey
2021-02-28 20:38 ` [PATCH 23/26] Change count_psyms to be a method on psymbol_functions Tom Tromey
2021-02-28 20:38 ` [PATCH 24/26] Remove objfile::psymtabs Tom Tromey
2021-02-28 20:38 ` [PATCH 25/26] Switch objfile to hold a list of psymbol readers Tom Tromey
2021-02-28 20:38 ` [PATCH 26/26] Allow multiple partial symbol readers per objfile Tom Tromey
2021-03-20 23:33 ` [PATCH 00/26] Allow multiple "partial" symtab " Tom Tromey
2021-03-22 14:13 ` Simon Marchi
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=20210228203803.1693413-22-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).