Make psymbols and psymtabs independent of the program space

This patch finally makes partial symbols and partial symtabs
independent of the program space.

Specifically:

It changes add_psymbol_to_list to accept a section index, and changes
the psymbol readers to pass this.  At the same time it removes the
code to add the objfile's section offset to the psymbol.

It adds an objfile argument to the psymtab textlow and texthigh
accessors and changes some code to use the raw variants instead.

It removes the "relocate" method from struct quick_symbol_functions,
as it is no longer needed any more.

It changes partial_symbol::address so that the relevant offset is now
applied at the point of use.

gdb/ChangeLog
2018-07-26  Tom Tromey  <tom@tromey.com>

	* dwarf-index-write.c (add_address_entry): Don't add objfile
	offsets.
	* dbxread.c (find_stab_function): Rename from
	find_stab_function_addr.  Return a bound_minimal_symbol.
	(read_dbx_symtab): Use raw_text_low, raw_text_high.
	Don't add objfile offsets.
	(end_psymtab): Use raw_text_low, raw_text_high,
	MSYMBOL_VALUE_RAW_ADDRESS.
	(read_ofile_symtab): Update.
	(process_one_symbol): Update.
	* dwarf2read.c (create_addrmap_from_index): Don't add objfile
	offsets.
	(dw2_relocate): Remove.
	(dw2_find_pc_sect_symtab): Bias PC by the text offset before
	searching addrmap.
	(dwarf2_gdb_index_functions, dwarf2_debug_names_functions):
	Update.
	(process_psymtab_comp_unit_reader, add_partial_symbol)
	(add_partial_subprogram, dwarf2_ranges_read): Update.
	(load_partial_dies): Update.
	(add_address_entry): Don't add objfile offsets.
	(dwarf2_build_include_psymtabs): Update.
	(create_addrmap_from_aranges): Don't add objfile offsets.
	(dw2_find_pc_sect_compunit_symtab): Update.
	* mdebugread.c (parse_symbol): Don't add objfile offsets.
	(parse_lines): Remove 'pst' parameter, replace with 'textlow'.
	Update.
	(parse_partial_symbols): Don't add objfile offsets.  Use
	raw_text_low, raw_text_high.  Update.
	(handle_psymbol_enumerators, psymtab_to_symtab_1): Update.
	* objfiles.c (objfile_relocate1): Don't relocate psymtabs_addrmap
	or call 'relocate' quick function.  Clear psymbol_map.
	* psympriv.h (struct partial_symbol) <address>: Add section
	offset.
	<set_unrelocated_address>: Rename from set_address.
	<raw_text_low, raw_text_high>: New methods.
	<text_low, text_high>: Add objfile parameter.
	(add_psymbol_to_bcache): Add 'section' parameter.  Call
	set_unrelocated_address.
	* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
	(find_pc_psymbol): Update.
	(fixup_psymbol_section, relocate_psymtabs): Remove.
	(dump_psymtab, psym_functions): Update.
	(add_psymbol_to_bcache, add_psymbol_to_list): Add 'section'
	parameter.
	(maintenance_info_psymtabs, maintenance_check_psymtabs): Update.
	(start_psymtab_common): Update.
	* symfile-debug.c (debug_qf_relocate): Remove.
	(debug_sym_quick_functions): Update.
	* symfile.h (struct quick_symbol_functions) <relocate>: Remove.
	* xcoffread.c (scan_xcoff_symtab): Don't add objfile offsets.
	Update.
This commit is contained in:
Tom Tromey
2018-05-03 16:36:21 -06:00
parent 52948f01e4
commit 7974897237
11 changed files with 280 additions and 356 deletions

View File

@ -2342,10 +2342,10 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
CORE_ADDR highval =
symbol.n_value + csect_aux.x_csect.x_scnlen.l;
if (highval > pst->text_high ())
if (highval > pst->raw_text_high ())
pst->set_text_high (highval);
if (!pst->text_low_valid
|| symbol.n_value < pst->text_low ())
|| symbol.n_value < pst->raw_text_low ())
pst->set_text_low (symbol.n_value);
}
misc_func_recorded = 0;
@ -2659,27 +2659,24 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
switch (p[1])
{
case 'S':
symbol.n_value += ANOFFSET (objfile->section_offsets,
SECT_OFF_DATA (objfile));
if (gdbarch_static_transform_name_p (gdbarch))
namestring = gdbarch_static_transform_name
(gdbarch, namestring);
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
&objfile->static_psymbols,
symbol.n_value,
psymtab_language, objfile);
continue;
case 'G':
symbol.n_value += ANOFFSET (objfile->section_offsets,
SECT_OFF_DATA (objfile));
/* The addresses in these entries are reported to be
wrong. See the code that reads 'G's for symtabs. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
&objfile->global_psymbols,
symbol.n_value,
psymtab_language, objfile);
@ -2697,14 +2694,14 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
&& namestring[0] != ' '))
{
add_psymbol_to_list (namestring, p - namestring, 1,
STRUCT_DOMAIN, LOC_TYPEDEF,
STRUCT_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
p += 1;
@ -2716,7 +2713,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
if (p != namestring) /* a name is there, not just :T... */
{
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
VAR_DOMAIN, LOC_TYPEDEF, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
}
@ -2778,7 +2775,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
/* Note that the value doesn't matter for
enum constants in psymtabs, just in symtabs. */
add_psymbol_to_list (p, q - p, 1,
VAR_DOMAIN, LOC_CONST,
VAR_DOMAIN, LOC_CONST, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
/* Point past the name. */
@ -2796,7 +2793,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
case 'c':
/* Constant, e.g. from "const" in Pascal. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_CONST,
VAR_DOMAIN, LOC_CONST, -1,
&objfile->static_psymbols,
0, psymtab_language, objfile);
continue;
@ -2812,10 +2809,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
function_outside_compilation_unit_complaint (name);
xfree (name);
}
symbol.n_value += ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
&objfile->static_psymbols,
symbol.n_value,
psymtab_language, objfile);
@ -2843,10 +2839,9 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
if (startswith (namestring, "@FIX"))
continue;
symbol.n_value += ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
&objfile->global_psymbols,
symbol.n_value,
psymtab_language, objfile);