diff options
author | Tom Tromey <tom@tromey.com> | 2019-10-22 17:28:37 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-01-26 16:40:21 -0700 |
commit | 891813beaab0029c88c9eeec9c1847d68a4d6050 (patch) | |
tree | b8f7d6ed3f2dc760bab54a5f641c044ca104cc98 /gdb/mdebugread.c | |
parent | c3693a1d9466bc9d3abe004e66f1b56fed22ba61 (diff) | |
download | fsf-binutils-gdb-891813beaab0029c88c9eeec9c1847d68a4d6050.zip fsf-binutils-gdb-891813beaab0029c88c9eeec9c1847d68a4d6050.tar.gz fsf-binutils-gdb-891813beaab0029c88c9eeec9c1847d68a4d6050.tar.bz2 |
Introduce partial_symtab::read_symtab method
This introduces a new partial_symtab::read_symtab method, and updates
the symbol readers to subclass partial_symtab and implement this
method. The old read_symtab and read_symtab_private members are
removed.
In practice, only DWARF and CTF are truly updated to take advantage of
the new setup. The other symbol readers are less actively maintained,
and so this patch also introduces a "legacy_psymtab", which
essentially works the same way as the old partial_symtab.
(Note that, without more knowledge of the interaction between these
symbol readers, fixing this to remove the new (small) overhead is not
trivial, because these readers copy the read_symtab pointer between
partial symtabs.)
gdb/ChangeLog
2020-01-26 Tom Tromey <tom@tromey.com>
* xcoffread.c (this_symtab_psymtab, read_xcoff_symtab)
(xcoff_psymtab_to_symtab_1, xcoff_read_symtab)
(xcoff_start_psymtab, xcoff_end_psymtab, scan_xcoff_symtab): Use
legacy_symtab.
* stabsread.h (dbx_end_psymtab): Use legacy_symtab.
* psymtab.c (psymtab_to_symtab): Call method.
(dump_psymtab): Update.
* psympriv.h (struct partial_symtab): Add virtual destructor.
<read_symtab>: New method.
(struct legacy_symtab): New.
* mdebugread.c (mdebug_read_symtab): Use legacy_psymtab.
(struct pst_map) <pst>: Now a legacy_psymtab.
(parse_procedure, parse_partial_symbols, psymtab_to_symtab_1)
(new_psymtab): Use legacy_psymtab.
* dwarf2read.h (struct dwarf2_psymtab): New.
(struct dwarf2_per_cu_data) <psymtab>: Use it.
* dwarf2read.c (dwarf2_create_include_psymtab)
(dwarf2_build_include_psymtabs, create_type_unit_group)
(create_partial_symtab, process_psymtab_comp_unit_reader)
(build_type_psymtabs_reader, build_type_psymtab_dependencies)
(set_partial_user): Use dwarf2_psymtab.
(dwarf2_psymtab::read_symtab): Rename from dwarf2_read_symtab.
(psymtab_to_symtab_1, process_full_comp_unit)
(process_full_type_unit, dwarf2_ranges_read)
(dwarf2_get_pc_bounds, psymtab_include_file_name)
(dwarf_decode_lines): Use dwarf2_psymtab.
* dwarf-index-write.c (psym_index_map): Use dwarf2_psymtab.
(add_address_entry_worker, write_one_signatured_type)
(recursively_count_psymbols, recursively_write_psymbols)
(write_one_signatured_type, psyms_seen_size, write_gdbindex)
(write_debug_names): Likewise.
* dbxread.c (struct header_file_location): Take a legacy_psymtab.
<pst>: Now a legacy_psymtab.
(find_corresponding_bincl_psymtab): Return a legacy_psymtab.
(read_dbx_symtab, start_psymtab, dbx_end_psymtab)
(dbx_psymtab_to_symtab_1, read_ofile_symtab): Use legacy_psymtab.
* ctfread.c (struct ctf_psymtab): New.
(ctf_start_symtab, ctf_end_symtab, psymtab_to_symtab): Take a
ctf_psymtab.
(ctf_psymtab::read_symtab): Rename from ctf_read_symtab.
(create_partial_symtab): Return a ctf_psymtab.
(scan_partial_symbols): Update.
Change-Id: Ia57a828786867d6ad03200af8f996f48ed15285e
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r-- | gdb/mdebugread.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index dafc7f4..621b314 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -251,10 +251,10 @@ static struct symbol *mylookup_symbol (const char *, const struct block *, static void sort_blocks (struct symtab *); -static struct partial_symtab *new_psymtab (const char *, struct objfile *); +static legacy_psymtab *new_psymtab (const char *, struct objfile *); static void psymtab_to_symtab_1 (struct objfile *objfile, - struct partial_symtab *, const char *); + legacy_psymtab *, const char *); static void add_block (struct block *, struct symtab *); @@ -275,7 +275,7 @@ static const char *mdebug_next_symbol_text (struct objfile *); and reorders the symtab list at the end. SELF is not NULL. */ static void -mdebug_read_symtab (struct partial_symtab *self, struct objfile *objfile) +mdebug_read_symtab (legacy_psymtab *self, struct objfile *objfile) { if (info_verbose) { @@ -389,7 +389,7 @@ mdebug_build_psymtabs (minimal_symbol_reader &reader, struct pst_map { - struct partial_symtab *pst; /* the psymtab proper */ + legacy_psymtab *pst; /* the psymtab proper */ long n_globals; /* exported globals (external symbols) */ long globals_offset; /* cumulative */ }; @@ -1910,7 +1910,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend, static void parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, - struct partial_symtab *pst) + legacy_psymtab *pst) { struct symbol *s, *i; const struct block *b; @@ -2310,7 +2310,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, EXTR *ext_in; EXTR *ext_in_end; SYMR sh; - struct partial_symtab *pst; + legacy_psymtab *pst; int textlow_not_set = 1; /* List of current psymtab's include files. */ @@ -2320,7 +2320,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, EXTR *extern_tab; struct pst_map *fdr_to_pst; /* Index within current psymtab dependency list. */ - struct partial_symtab **dependency_list; + legacy_psymtab **dependency_list; int dependencies_used, dependencies_allocated; char *name; enum language prev_language; @@ -2349,8 +2349,8 @@ parse_partial_symbols (minimal_symbol_reader &reader, dependencies_allocated = 30; dependencies_used = 0; dependency_list = - (struct partial_symtab **) alloca (dependencies_allocated * - sizeof (struct partial_symtab *)); + (legacy_psymtab **) alloca (dependencies_allocated * + sizeof (legacy_psymtab *)); set_last_source_file (NULL); @@ -2373,7 +2373,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, fdr_to_pst = fdr_to_pst_holder.data (); fdr_to_pst++; { - struct partial_symtab *new_pst = new_psymtab ("", objfile); + legacy_psymtab *new_pst = new_psymtab ("", objfile); fdr_to_pst[-1].pst = new_pst; FDR_IDX (new_pst) = -1; @@ -2591,7 +2591,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, /* Pass 3 over files, over local syms: fill in static symbols. */ for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++) { - struct partial_symtab *save_pst; + legacy_psymtab *save_pst; EXTR *ext_ptr; CORE_ADDR textlow; @@ -2609,7 +2609,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, textlow = fh->adr; else textlow = 0; - pst = new partial_symtab (fdr_name (fh), objfile, textlow); + pst = new legacy_psymtab (fdr_name (fh), objfile, textlow); pst->read_symtab_private = XOBNEW (&objfile->objfile_obstack, symloc); memset (pst->read_symtab_private, 0, sizeof (struct symloc)); @@ -2621,7 +2621,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, PENDING_LIST (pst) = pending_list; /* The way to turn this into a symtab is to call... */ - pst->read_symtab = mdebug_read_symtab; + pst->legacy_read_symtab = mdebug_read_symtab; /* Set up language for the pst. The language from the FDR is used if it is unambigious (e.g. cfront @@ -2895,7 +2895,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, { /* Here if prev stab wasn't N_SO. */ if (pst) { - pst = (struct partial_symtab *) 0; + pst = (legacy_psymtab *) 0; includes_used = 0; dependencies_used = 0; } @@ -3285,7 +3285,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, if (pst && gdbarch_sofun_address_maybe_missing (gdbarch)) { - pst = (struct partial_symtab *) 0; + pst = (legacy_psymtab *) 0; includes_used = 0; dependencies_used = 0; } @@ -3740,12 +3740,12 @@ parse_partial_symbols (minimal_symbol_reader &reader, /* Remove the dummy psymtab created for -O3 images above, if it is still empty, to enable the detection of stripped executables. */ - pst = objfile->partial_symtabs->psymtabs; - if (pst->next == NULL - && pst->number_of_dependencies == 0 - && pst->n_global_syms == 0 - && pst->n_static_syms == 0) - objfile->partial_symtabs->discard_psymtab (pst); + partial_symtab *pst_del = objfile->partial_symtabs->psymtabs; + if (pst_del->next == NULL + && pst_del->number_of_dependencies == 0 + && pst_del->n_global_syms == 0 + && pst_del->n_static_syms == 0) + objfile->partial_symtabs->discard_psymtab (pst_del); } /* If the current psymbol has an enumerated type, we need to add @@ -3844,7 +3844,7 @@ mdebug_next_symbol_text (struct objfile *objfile) static void psymtab_to_symtab_1 (struct objfile *objfile, - struct partial_symtab *pst, const char *filename) + legacy_psymtab *pst, const char *filename) { bfd_size_type external_sym_size; bfd_size_type external_pdr_size; @@ -3882,7 +3882,7 @@ psymtab_to_symtab_1 (struct objfile *objfile, gdb_flush (gdb_stdout); } /* We only pass the filename for debug purposes. */ - psymtab_to_symtab_1 (objfile, pst->dependencies[i], + psymtab_to_symtab_1 (objfile, (legacy_psymtab *) pst->dependencies[i], pst->dependencies[i]->filename); } @@ -4655,12 +4655,12 @@ new_symtab (const char *name, int maxlines, struct objfile *objfile) /* Allocate a new partial_symtab NAME. */ -static struct partial_symtab * +static legacy_psymtab * new_psymtab (const char *name, struct objfile *objfile) { - struct partial_symtab *psymtab; + legacy_psymtab *psymtab; - psymtab = new partial_symtab (name, objfile); + psymtab = new legacy_psymtab (name, objfile); /* Keep a backpointer to the file's symbols. */ @@ -4672,7 +4672,7 @@ new_psymtab (const char *name, struct objfile *objfile) PENDING_LIST (psymtab) = pending_list; /* The way to turn this into a symtab is to call... */ - psymtab->read_symtab = mdebug_read_symtab; + psymtab->legacy_read_symtab = mdebug_read_symtab; return (psymtab); } |