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.
This commit is contained in:
Tom Tromey
2021-03-20 17:23:40 -06:00
parent d1eef86d12
commit 7b249e470a
9 changed files with 206 additions and 107 deletions

View File

@ -1960,11 +1960,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);
@ -2020,7 +2022,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;
@ -2244,7 +2246,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);
}
@ -2427,7 +2429,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;
@ -2586,7 +2588,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':
@ -2598,7 +2601,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':
@ -2616,7 +2620,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. */
@ -2624,7 +2629,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;
}
}
@ -2637,7 +2643,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
@ -2699,7 +2706,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. */
@ -2718,7 +2726,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':
@ -2738,7 +2747,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
@ -2769,7 +2779,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