aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.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/mdebugread.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/mdebugread.c')
-rw-r--r--gdb/mdebugread.c65
1 files changed, 41 insertions, 24 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index d178bee..34ee718 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. */