Change section_offsets to a std::vector
This changes section_offsets to be specialization of a std::vector and updates all the users. It also removes the ANOFFSET and SIZEOF_N_SECTION_OFFSETS macros. Most of this is just a generic sort of cleanup, that reduces the number of lines of code. However, a couple spots were doing weird things. objfile_relocate did: - std::vector<struct section_offsets> - new_debug_offsets (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections)); ... which seems to greatly over-estimate the number of elements needed. This appeared in set_objfile_default_section_offset: - std::vector<struct section_offsets> offsets (objf->num_sections, - { { offset } }); ... which makes sense due to type safety, but is also actively confusing given that section_offsets was previously also a kind of vector type. Tested on x86-64 Fedora 30. gdb/ChangeLog 2020-01-08 Tom Tromey <tromey@adacore.com> * xcoffread.c (enter_line_range, read_xcoff_symtab) (process_xcoff_symbol, xcoff_symfile_offsets): Update. * symtab.h (MSYMBOL_VALUE_ADDRESS): Update. (struct section_offsets, ANOFFSET, SIZEOF_N_SECTION_OFFSETS): Remove. (section_offsets): New typedef. * symtab.c (fixup_section, get_msymbol_address): Update. * symmisc.c (dump_msymbols): Update. * symfile.h (relative_addr_info_to_section_offsets) (symfile_map_offsets_to_segments): Update. * symfile.c (build_section_addr_info_from_objfile) (init_objfile_sect_indices): Update. (struct place_section_arg): Change type of "offsets". (place_section): Update. (relative_addr_info_to_section_offsets): Change type of "section_offsets". Remove "num_sections" parameter. (default_symfile_offsets, syms_from_objfile_1) (set_objfile_default_section_offset): Update. (reread_symbols): No need to preserve section offsets by hand. (symfile_map_offsets_to_segments): Change type of "offsets". * stap-probe.c (relocate_address): Update. * stabsread.h (process_one_symbol): Update. * solib-target.c (struct lm_info_target) <offsets>: Change type. (solib_target_relocate_section_addresses): Update. * solib-svr4.c (enable_break, svr4_relocate_main_executable): Update. * solib-frv.c (frv_relocate_main_executable): Update. * solib-dsbt.c (dsbt_relocate_main_executable): Update. * solib-aix.c (solib_aix_get_section_offsets): Change return type. (solib_aix_solib_create_inferior_hook): Update. * remote.c (remote_target::get_offsets): Update. * psymtab.c (find_pc_sect_psymtab): Update. * psympriv.h (struct partial_symbol) <address, text_low, text_high>: Update. * objfiles.h (obj_section_offset): Update. (struct objfile) <section_offsets>: Change type. <num_sections>: Remove. (objfile_relocate): Update. * objfiles.c (entry_point_address_query): Update (relocate_one_symbol): Change type of "section_offsets". (objfile_relocate1, objfile_relocate1): Change type of "new_offsets". (objfile_rebase1): Update. * mipsread.c (mipscoff_symfile_read): Update. (read_alphacoff_dynamic_symtab): Remove "section_offsets" parameter. * mdebugread.c (parse_symbol): Change type of "section_offsets". (parse_external, psymtab_to_symtab_1): Update. * machoread.c (macho_symfile_offsets): Update. * ia64-tdep.c (ia64_find_unwind_table): Update. * hppa-tdep.c (read_unwind_info): Update. * hppa-bsd-tdep.c (hppabsd_find_global_pointer): Update. * dwarf2read.c (create_addrmap_from_index) (create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab) (process_psymtab_comp_unit_reader, add_partial_symbol) (add_partial_subprogram, process_full_comp_unit) (read_file_scope, read_func_scope, read_lexical_block_scope) (read_call_site_scope, dwarf2_rnglists_process) (dwarf2_ranges_process, dwarf2_ranges_read) (dwarf_decode_lines_1, var_decode_location, new_symbol) (dwarf2_fetch_die_loc_sect_off, dwarf2_per_cu_text_offset): Update. * dwarf2-frame.c (execute_cfa_program, dwarf2_frame_find_fde): Update. * dtrace-probe.c (dtrace_probe::get_relocated_address): Update. * dbxread.c (read_dbx_symtab, read_ofile_symtab): Update. (process_one_symbol): Change type of "section_offsets". * ctfread.c (get_objfile_text_range): Update. * coffread.c (coff_symtab_read, enter_linenos) (process_coff_symbol): Update. * coff-pe-read.c (add_pe_forwarded_sym): Update. * amd64-windows-tdep.c (amd64_windows_find_unwind_info): Update. Change-Id: I147eb967e9b44d82f4048039de7bb44b80cd72fb
This commit is contained in:
parent
456e800a63
commit
6a053cb1ff
@ -1,3 +1,79 @@
|
|||||||
|
2020-01-08 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
|
* xcoffread.c (enter_line_range, read_xcoff_symtab)
|
||||||
|
(process_xcoff_symbol, xcoff_symfile_offsets): Update.
|
||||||
|
* symtab.h (MSYMBOL_VALUE_ADDRESS): Update.
|
||||||
|
(struct section_offsets, ANOFFSET, SIZEOF_N_SECTION_OFFSETS):
|
||||||
|
Remove.
|
||||||
|
(section_offsets): New typedef.
|
||||||
|
* symtab.c (fixup_section, get_msymbol_address): Update.
|
||||||
|
* symmisc.c (dump_msymbols): Update.
|
||||||
|
* symfile.h (relative_addr_info_to_section_offsets)
|
||||||
|
(symfile_map_offsets_to_segments): Update.
|
||||||
|
* symfile.c (build_section_addr_info_from_objfile)
|
||||||
|
(init_objfile_sect_indices): Update.
|
||||||
|
(struct place_section_arg): Change type of "offsets".
|
||||||
|
(place_section): Update.
|
||||||
|
(relative_addr_info_to_section_offsets): Change type of
|
||||||
|
"section_offsets". Remove "num_sections" parameter.
|
||||||
|
(default_symfile_offsets, syms_from_objfile_1)
|
||||||
|
(set_objfile_default_section_offset): Update.
|
||||||
|
(reread_symbols): No need to preserve section offsets by hand.
|
||||||
|
(symfile_map_offsets_to_segments): Change type of "offsets".
|
||||||
|
* stap-probe.c (relocate_address): Update.
|
||||||
|
* stabsread.h (process_one_symbol): Update.
|
||||||
|
* solib-target.c (struct lm_info_target) <offsets>: Change type.
|
||||||
|
(solib_target_relocate_section_addresses): Update.
|
||||||
|
* solib-svr4.c (enable_break, svr4_relocate_main_executable):
|
||||||
|
Update.
|
||||||
|
* solib-frv.c (frv_relocate_main_executable): Update.
|
||||||
|
* solib-dsbt.c (dsbt_relocate_main_executable): Update.
|
||||||
|
* solib-aix.c (solib_aix_get_section_offsets): Change return
|
||||||
|
type.
|
||||||
|
(solib_aix_solib_create_inferior_hook): Update.
|
||||||
|
* remote.c (remote_target::get_offsets): Update.
|
||||||
|
* psymtab.c (find_pc_sect_psymtab): Update.
|
||||||
|
* psympriv.h (struct partial_symbol) <address, text_low,
|
||||||
|
text_high>: Update.
|
||||||
|
* objfiles.h (obj_section_offset): Update.
|
||||||
|
(struct objfile) <section_offsets>: Change type.
|
||||||
|
<num_sections>: Remove.
|
||||||
|
(objfile_relocate): Update.
|
||||||
|
* objfiles.c (entry_point_address_query): Update
|
||||||
|
(relocate_one_symbol): Change type of "section_offsets".
|
||||||
|
(objfile_relocate1, objfile_relocate1): Change type of
|
||||||
|
"new_offsets".
|
||||||
|
(objfile_rebase1): Update.
|
||||||
|
* mipsread.c (mipscoff_symfile_read): Update.
|
||||||
|
(read_alphacoff_dynamic_symtab): Remove "section_offsets"
|
||||||
|
parameter.
|
||||||
|
* mdebugread.c (parse_symbol): Change type of "section_offsets".
|
||||||
|
(parse_external, psymtab_to_symtab_1): Update.
|
||||||
|
* machoread.c (macho_symfile_offsets): Update.
|
||||||
|
* ia64-tdep.c (ia64_find_unwind_table): Update.
|
||||||
|
* hppa-tdep.c (read_unwind_info): Update.
|
||||||
|
* hppa-bsd-tdep.c (hppabsd_find_global_pointer): Update.
|
||||||
|
* dwarf2read.c (create_addrmap_from_index)
|
||||||
|
(create_addrmap_from_aranges, dw2_find_pc_sect_compunit_symtab)
|
||||||
|
(process_psymtab_comp_unit_reader, add_partial_symbol)
|
||||||
|
(add_partial_subprogram, process_full_comp_unit)
|
||||||
|
(read_file_scope, read_func_scope, read_lexical_block_scope)
|
||||||
|
(read_call_site_scope, dwarf2_rnglists_process)
|
||||||
|
(dwarf2_ranges_process, dwarf2_ranges_read)
|
||||||
|
(dwarf_decode_lines_1, var_decode_location, new_symbol)
|
||||||
|
(dwarf2_fetch_die_loc_sect_off, dwarf2_per_cu_text_offset):
|
||||||
|
Update.
|
||||||
|
* dwarf2-frame.c (execute_cfa_program, dwarf2_frame_find_fde):
|
||||||
|
Update.
|
||||||
|
* dtrace-probe.c (dtrace_probe::get_relocated_address): Update.
|
||||||
|
* dbxread.c (read_dbx_symtab, read_ofile_symtab): Update.
|
||||||
|
(process_one_symbol): Change type of "section_offsets".
|
||||||
|
* ctfread.c (get_objfile_text_range): Update.
|
||||||
|
* coffread.c (coff_symtab_read, enter_linenos)
|
||||||
|
(process_coff_symbol): Update.
|
||||||
|
* coff-pe-read.c (add_pe_forwarded_sym): Update.
|
||||||
|
* amd64-windows-tdep.c (amd64_windows_find_unwind_info): Update.
|
||||||
|
|
||||||
2020-01-08 Tom Tromey <tromey@adacore.com>
|
2020-01-08 Tom Tromey <tromey@adacore.com>
|
||||||
|
|
||||||
* dwarf2read.c (parse_macro_definition): Use std::string.
|
* dwarf2read.c (parse_macro_definition): Use std::string.
|
||||||
|
@ -953,8 +953,8 @@ amd64_windows_find_unwind_info (struct gdbarch *gdbarch, CORE_ADDR pc,
|
|||||||
pe = pe_data (sec->objfile->obfd);
|
pe = pe_data (sec->objfile->obfd);
|
||||||
dir = &pe->pe_opthdr.DataDirectory[PE_EXCEPTION_TABLE];
|
dir = &pe->pe_opthdr.DataDirectory[PE_EXCEPTION_TABLE];
|
||||||
|
|
||||||
base = pe->pe_opthdr.ImageBase
|
base = (pe->pe_opthdr.ImageBase
|
||||||
+ ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
|
||||||
*image_base = base;
|
*image_base = base;
|
||||||
|
|
||||||
/* Find the entry.
|
/* Find the entry.
|
||||||
|
@ -266,7 +266,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
|
|||||||
really be relocated properly, but nevertheless we make a stab at
|
really be relocated properly, but nevertheless we make a stab at
|
||||||
it, choosing an approach consistent with the history of this
|
it, choosing an approach consistent with the history of this
|
||||||
code. */
|
code. */
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
reader.record_with_info (qualified_name.c_str (), vma - baseaddr, msymtype,
|
reader.record_with_info (qualified_name.c_str (), vma - baseaddr, msymtype,
|
||||||
section);
|
section);
|
||||||
|
@ -919,8 +919,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
|
|||||||
file with no symbols. */
|
file with no symbols. */
|
||||||
if (in_source_file)
|
if (in_source_file)
|
||||||
complete_symtab (filestring,
|
complete_symtab (filestring,
|
||||||
cs->c_value + ANOFFSET (objfile->section_offsets,
|
(cs->c_value
|
||||||
SECT_OFF_TEXT (objfile)),
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]),
|
||||||
main_aux.x_scn.x_scnlen);
|
main_aux.x_scn.x_scnlen);
|
||||||
in_source_file = 0;
|
in_source_file = 0;
|
||||||
}
|
}
|
||||||
@ -986,7 +986,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
|
|||||||
|| cs->c_sclass == C_THUMBEXTFUNC
|
|| cs->c_sclass == C_THUMBEXTFUNC
|
||||||
|| cs->c_sclass == C_THUMBEXT
|
|| cs->c_sclass == C_THUMBEXT
|
||||||
|| (pe_file && (cs->c_sclass == C_STAT)))
|
|| (pe_file && (cs->c_sclass == C_STAT)))
|
||||||
offset = ANOFFSET (objfile->section_offsets, sec);
|
offset = objfile->section_offsets[sec];
|
||||||
|
|
||||||
if (bfd_section->flags & SEC_CODE)
|
if (bfd_section->flags & SEC_CODE)
|
||||||
{
|
{
|
||||||
@ -1113,8 +1113,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
|
|||||||
NULL, cstk.start_addr,
|
NULL, cstk.start_addr,
|
||||||
fcn_cs_saved.c_value
|
fcn_cs_saved.c_value
|
||||||
+ fcn_aux_saved.x_sym.x_misc.x_fsize
|
+ fcn_aux_saved.x_sym.x_misc.x_fsize
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
|
||||||
SECT_OFF_TEXT (objfile)));
|
|
||||||
within_function = 0;
|
within_function = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1123,8 +1122,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
|
|||||||
if (strcmp (cs->c_name, ".bb") == 0)
|
if (strcmp (cs->c_name, ".bb") == 0)
|
||||||
{
|
{
|
||||||
tmpaddr = cs->c_value;
|
tmpaddr = cs->c_value;
|
||||||
tmpaddr += ANOFFSET (objfile->section_offsets,
|
tmpaddr += objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
push_context (++depth, tmpaddr);
|
push_context (++depth, tmpaddr);
|
||||||
}
|
}
|
||||||
else if (strcmp (cs->c_name, ".eb") == 0)
|
else if (strcmp (cs->c_name, ".eb") == 0)
|
||||||
@ -1147,9 +1145,9 @@ coff_symtab_read (minimal_symbol_reader &reader,
|
|||||||
}
|
}
|
||||||
if (*get_local_symbols () && !outermost_context_p ())
|
if (*get_local_symbols () && !outermost_context_p ())
|
||||||
{
|
{
|
||||||
tmpaddr =
|
tmpaddr
|
||||||
cs->c_value + ANOFFSET (objfile->section_offsets,
|
= (cs->c_value
|
||||||
SECT_OFF_TEXT (objfile));
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
|
||||||
/* Make a block for the local symbols within. */
|
/* Make a block for the local symbols within. */
|
||||||
finish_block (0, cstk.old_blocks, NULL,
|
finish_block (0, cstk.old_blocks, NULL,
|
||||||
cstk.start_addr, tmpaddr);
|
cstk.start_addr, tmpaddr);
|
||||||
@ -1441,8 +1439,7 @@ enter_linenos (long file_offset, int first_line,
|
|||||||
if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
|
if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr = lptr.l_addr.l_paddr;
|
CORE_ADDR addr = lptr.l_addr.l_paddr;
|
||||||
addr += ANOFFSET (objfile->section_offsets,
|
addr += objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
record_line (get_current_subfile (),
|
record_line (get_current_subfile (),
|
||||||
first_line + L_LNNO32 (&lptr),
|
first_line + L_LNNO32 (&lptr),
|
||||||
gdbarch_addr_bits_remove (gdbarch, addr));
|
gdbarch_addr_bits_remove (gdbarch, addr));
|
||||||
@ -1577,8 +1574,7 @@ process_coff_symbol (struct coff_symbol *cs,
|
|||||||
|
|
||||||
if (ISFCN (cs->c_type))
|
if (ISFCN (cs->c_type))
|
||||||
{
|
{
|
||||||
SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets,
|
SYMBOL_VALUE (sym) += objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
SYMBOL_TYPE (sym) =
|
SYMBOL_TYPE (sym) =
|
||||||
lookup_function_type (decode_function_type (cs, cs->c_type,
|
lookup_function_type (decode_function_type (cs, cs->c_type,
|
||||||
aux, objfile));
|
aux, objfile));
|
||||||
@ -1610,8 +1606,7 @@ process_coff_symbol (struct coff_symbol *cs,
|
|||||||
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
|
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
|
||||||
SET_SYMBOL_VALUE_ADDRESS (sym,
|
SET_SYMBOL_VALUE_ADDRESS (sym,
|
||||||
(CORE_ADDR) cs->c_value
|
(CORE_ADDR) cs->c_value
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
|
||||||
SECT_OFF_TEXT (objfile)));
|
|
||||||
add_symbol_to_list (sym, get_global_symbols ());
|
add_symbol_to_list (sym, get_global_symbols ());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1621,8 +1616,7 @@ process_coff_symbol (struct coff_symbol *cs,
|
|||||||
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
|
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
|
||||||
SET_SYMBOL_VALUE_ADDRESS (sym,
|
SET_SYMBOL_VALUE_ADDRESS (sym,
|
||||||
(CORE_ADDR) cs->c_value
|
(CORE_ADDR) cs->c_value
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]);
|
||||||
SECT_OFF_TEXT (objfile)));
|
|
||||||
if (within_function)
|
if (within_function)
|
||||||
{
|
{
|
||||||
/* Static symbol of local scope. */
|
/* Static symbol of local scope. */
|
||||||
|
@ -1165,7 +1165,7 @@ get_objfile_text_range (struct objfile *of, int *tsize)
|
|||||||
|
|
||||||
codes = bfd_get_section_by_name (abfd, ".text");
|
codes = bfd_get_section_by_name (abfd, ".text");
|
||||||
*tsize = codes ? bfd_section_size (codes) : 0;
|
*tsize = codes ? bfd_section_size (codes) : 0;
|
||||||
return ANOFFSET (of->section_offsets, SECT_OFF_TEXT (of));
|
return of->section_offsets[SECT_OFF_TEXT (of)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start a symtab for OBJFILE in CTF format. */
|
/* Start a symtab for OBJFILE in CTF format. */
|
||||||
|
@ -1046,9 +1046,7 @@ read_dbx_symtab (minimal_symbol_reader &reader, struct objfile *objfile)
|
|||||||
|
|
||||||
/* If data_sect_index is still -1, that's okay. It's perfectly fine
|
/* If data_sect_index is still -1, that's okay. It's perfectly fine
|
||||||
for the file to have no .data, no .bss, and no .text at all, if
|
for the file to have no .data, no .bss, and no .text at all, if
|
||||||
it also has no global or static variables. If it does, we will
|
it also has no global or static variables. */
|
||||||
get an internal error from an ANOFFSET macro below when we try to
|
|
||||||
use data_sect_index. */
|
|
||||||
|
|
||||||
for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
|
for (symnum = 0; symnum < DBX_SYMCOUNT (objfile); symnum++)
|
||||||
{
|
{
|
||||||
@ -2179,13 +2177,12 @@ read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
|||||||
int sym_size; /* Size of symbols to read */
|
int sym_size; /* Size of symbols to read */
|
||||||
CORE_ADDR text_offset; /* Start of text segment for symbols */
|
CORE_ADDR text_offset; /* Start of text segment for symbols */
|
||||||
int text_size; /* Size of text segment for symbols */
|
int text_size; /* Size of text segment for symbols */
|
||||||
struct section_offsets *section_offsets;
|
|
||||||
|
|
||||||
sym_offset = LDSYMOFF (pst);
|
sym_offset = LDSYMOFF (pst);
|
||||||
sym_size = LDSYMLEN (pst);
|
sym_size = LDSYMLEN (pst);
|
||||||
text_offset = pst->text_low (objfile);
|
text_offset = pst->text_low (objfile);
|
||||||
text_size = pst->text_high (objfile) - pst->text_low (objfile);
|
text_size = pst->text_high (objfile) - pst->text_low (objfile);
|
||||||
section_offsets = objfile->section_offsets;
|
const section_offsets §ion_offsets = objfile->section_offsets;
|
||||||
|
|
||||||
dbxread_objfile = objfile;
|
dbxread_objfile = objfile;
|
||||||
|
|
||||||
@ -2378,7 +2375,7 @@ cp_set_block_scope (const struct symbol *symbol,
|
|||||||
|
|
||||||
void
|
void
|
||||||
process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
||||||
const struct section_offsets *section_offsets,
|
const section_offsets §ion_offsets,
|
||||||
struct objfile *objfile, enum language language)
|
struct objfile *objfile, enum language language)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||||
@ -2469,7 +2466,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
|||||||
sline_found_in_function = 0;
|
sline_found_in_function = 0;
|
||||||
|
|
||||||
/* Relocate for dynamic loading. */
|
/* Relocate for dynamic loading. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
valu = gdbarch_addr_bits_remove (gdbarch, valu);
|
valu = gdbarch_addr_bits_remove (gdbarch, valu);
|
||||||
last_function_start = valu;
|
last_function_start = valu;
|
||||||
|
|
||||||
@ -2557,7 +2554,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
|||||||
case N_FN_SEQ:
|
case N_FN_SEQ:
|
||||||
/* This kind of symbol indicates the start of an object file.
|
/* This kind of symbol indicates the start of an object file.
|
||||||
Relocate for dynamic loading. */
|
Relocate for dynamic loading. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case N_SO:
|
case N_SO:
|
||||||
@ -2565,7 +2562,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
|||||||
source file. Finish the symbol table of the previous source
|
source file. Finish the symbol table of the previous source
|
||||||
file (if any) and start accumulating a new symbol table.
|
file (if any) and start accumulating a new symbol table.
|
||||||
Relocate for dynamic loading. */
|
Relocate for dynamic loading. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
n_opt_found = 0;
|
n_opt_found = 0;
|
||||||
|
|
||||||
@ -2601,7 +2598,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
|||||||
sub-source-file, one whose contents were copied or included
|
sub-source-file, one whose contents were copied or included
|
||||||
in the compilation of the main source file (whose name was
|
in the compilation of the main source file (whose name was
|
||||||
given in the N_SO symbol). Relocate for dynamic loading. */
|
given in the N_SO symbol). Relocate for dynamic loading. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
start_subfile (name);
|
start_subfile (name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2701,7 +2698,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
|||||||
symbol_file_add as addr (this is known to affect
|
symbol_file_add as addr (this is known to affect
|
||||||
SunOS 4, and I suspect ELF too). Since there is no
|
SunOS 4, and I suspect ELF too). Since there is no
|
||||||
Ttext.text symbol, we can get addr from the text offset. */
|
Ttext.text symbol, we can get addr from the text offset. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
goto define_a_symbol;
|
goto define_a_symbol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2723,22 +2720,22 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
|||||||
|
|
||||||
case_N_STSYM: /* Static symbol in data segment. */
|
case_N_STSYM: /* Static symbol in data segment. */
|
||||||
case N_DSLINE: /* Source line number, data segment. */
|
case N_DSLINE: /* Source line number, data segment. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
|
valu += section_offsets[SECT_OFF_DATA (objfile)];
|
||||||
goto define_a_symbol;
|
goto define_a_symbol;
|
||||||
|
|
||||||
case_N_LCSYM: /* Static symbol in BSS segment. */
|
case_N_LCSYM: /* Static symbol in BSS segment. */
|
||||||
case N_BSLINE: /* Source line number, BSS segment. */
|
case N_BSLINE: /* Source line number, BSS segment. */
|
||||||
/* N_BROWS: overlaps with N_BSLINE. */
|
/* N_BROWS: overlaps with N_BSLINE. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
|
valu += section_offsets[SECT_OFF_BSS (objfile)];
|
||||||
goto define_a_symbol;
|
goto define_a_symbol;
|
||||||
|
|
||||||
case_N_ROSYM: /* Static symbol in read-only data segment. */
|
case_N_ROSYM: /* Static symbol in read-only data segment. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_RODATA (objfile));
|
valu += section_offsets[SECT_OFF_RODATA (objfile)];
|
||||||
goto define_a_symbol;
|
goto define_a_symbol;
|
||||||
|
|
||||||
case N_ENTRY: /* Alternate entry point. */
|
case N_ENTRY: /* Alternate entry point. */
|
||||||
/* Relocate for dynamic loading. */
|
/* Relocate for dynamic loading. */
|
||||||
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
goto define_a_symbol;
|
goto define_a_symbol;
|
||||||
|
|
||||||
/* The following symbol types we don't know how to process.
|
/* The following symbol types we don't know how to process.
|
||||||
@ -2789,8 +2786,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
|
|||||||
/* Deal with the SunPRO 3.0 compiler which omits the
|
/* Deal with the SunPRO 3.0 compiler which omits the
|
||||||
address from N_FUN symbols. */
|
address from N_FUN symbols. */
|
||||||
if (type == N_FUN
|
if (type == N_FUN
|
||||||
&& valu == ANOFFSET (section_offsets,
|
&& valu == section_offsets[SECT_OFF_TEXT (objfile)]
|
||||||
SECT_OFF_TEXT (objfile))
|
|
||||||
&& gdbarch_sofun_address_maybe_missing (gdbarch))
|
&& gdbarch_sofun_address_maybe_missing (gdbarch))
|
||||||
{
|
{
|
||||||
struct bound_minimal_symbol minsym
|
struct bound_minimal_symbol minsym
|
||||||
|
@ -685,8 +685,8 @@ dtrace_probe::is_enabled () const
|
|||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
dtrace_probe::get_relocated_address (struct objfile *objfile)
|
dtrace_probe::get_relocated_address (struct objfile *objfile)
|
||||||
{
|
{
|
||||||
return this->get_address () + ANOFFSET (objfile->section_offsets,
|
return (this->get_address ()
|
||||||
SECT_OFF_DATA (objfile));
|
+ objfile->section_offsets[SECT_OFF_DATA (objfile)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implementation of the get_argument_count method. */
|
/* Implementation of the get_argument_count method. */
|
||||||
|
@ -384,8 +384,7 @@ execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr,
|
|||||||
fde->cie->ptr_size, insn_ptr,
|
fde->cie->ptr_size, insn_ptr,
|
||||||
&bytes_read, fde->initial_location);
|
&bytes_read, fde->initial_location);
|
||||||
/* Apply the objfile offset for relocatable objects. */
|
/* Apply the objfile offset for relocatable objects. */
|
||||||
fs->pc += ANOFFSET (fde->cie->unit->objfile->section_offsets,
|
fs->pc += fde->cie->unit->objfile->section_offsets[SECT_OFF_TEXT (fde->cie->unit->objfile)];
|
||||||
SECT_OFF_TEXT (fde->cie->unit->objfile));
|
|
||||||
insn_ptr += bytes_read;
|
insn_ptr += bytes_read;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1686,8 +1685,8 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, CORE_ADDR *out_offset)
|
|||||||
if (fde_table->num_entries == 0)
|
if (fde_table->num_entries == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
gdb_assert (objfile->section_offsets);
|
gdb_assert (!objfile->section_offsets.empty ());
|
||||||
offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
offset = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
gdb_assert (fde_table->num_entries > 0);
|
gdb_assert (fde_table->num_entries > 0);
|
||||||
if (*pc < offset + fde_table->entries[0]->initial_location)
|
if (*pc < offset + fde_table->entries[0]->initial_location)
|
||||||
|
@ -3170,7 +3170,7 @@ create_addrmap_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||||||
iter = index->address_table.data ();
|
iter = index->address_table.data ();
|
||||||
end = iter + index->address_table.size ();
|
end = iter + index->address_table.size ();
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
while (iter < end)
|
while (iter < end)
|
||||||
{
|
{
|
||||||
@ -3216,8 +3216,7 @@ create_addrmap_from_aranges (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||||||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||||
bfd *abfd = objfile->obfd;
|
bfd *abfd = objfile->obfd;
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||||
const CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
|
const CORE_ADDR baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
|
|
||||||
auto_obstack temp_obstack;
|
auto_obstack temp_obstack;
|
||||||
addrmap *mutable_map = addrmap_create_mutable (&temp_obstack);
|
addrmap *mutable_map = addrmap_create_mutable (&temp_obstack);
|
||||||
@ -5237,8 +5236,7 @@ dw2_find_pc_sect_compunit_symtab (struct objfile *objfile,
|
|||||||
if (!objfile->partial_symtabs->psymtabs_addrmap)
|
if (!objfile->partial_symtabs->psymtabs_addrmap)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
|
CORE_ADDR baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
data = (struct dwarf2_per_cu_data *) addrmap_find
|
data = (struct dwarf2_per_cu_data *) addrmap_find
|
||||||
(objfile->partial_symtabs->psymtabs_addrmap, pc - baseaddr);
|
(objfile->partial_symtabs->psymtabs_addrmap, pc - baseaddr);
|
||||||
if (!data)
|
if (!data)
|
||||||
@ -8068,7 +8066,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
|
|||||||
/* This must be done before calling dwarf2_build_include_psymtabs. */
|
/* This must be done before calling dwarf2_build_include_psymtabs. */
|
||||||
pst->dirname = dwarf2_string_attr (comp_unit_die, DW_AT_comp_dir, cu);
|
pst->dirname = dwarf2_string_attr (comp_unit_die, DW_AT_comp_dir, cu);
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
dwarf2_find_base_address (comp_unit_die, cu);
|
dwarf2_find_base_address (comp_unit_die, cu);
|
||||||
|
|
||||||
@ -8947,7 +8945,7 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu)
|
|||||||
const char *actual_name = NULL;
|
const char *actual_name = NULL;
|
||||||
CORE_ADDR baseaddr;
|
CORE_ADDR baseaddr;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
gdb::unique_xmalloc_ptr<char> built_actual_name
|
gdb::unique_xmalloc_ptr<char> built_actual_name
|
||||||
= partial_die_full_name (pdi, cu);
|
= partial_die_full_name (pdi, cu);
|
||||||
@ -9190,8 +9188,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
|
|||||||
CORE_ADDR this_highpc;
|
CORE_ADDR this_highpc;
|
||||||
CORE_ADDR this_lowpc;
|
CORE_ADDR this_lowpc;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets,
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
this_lowpc
|
this_lowpc
|
||||||
= (gdbarch_adjust_dwarf2_addr (gdbarch,
|
= (gdbarch_adjust_dwarf2_addr (gdbarch,
|
||||||
pdi->lowpc + baseaddr)
|
pdi->lowpc + baseaddr)
|
||||||
@ -10400,7 +10397,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
|
|||||||
struct block *static_block;
|
struct block *static_block;
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
/* Clear the list here in case something was left over. */
|
/* Clear the list here in case something was left over. */
|
||||||
cu->method_list.clear ();
|
cu->method_list.clear ();
|
||||||
@ -11602,7 +11599,7 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
CORE_ADDR baseaddr;
|
CORE_ADDR baseaddr;
|
||||||
|
|
||||||
prepare_one_comp_unit (cu, die, cu->language);
|
prepare_one_comp_unit (cu, die, cu->language);
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
get_scope_pc_bounds (die, &lowpc, &highpc, cu);
|
get_scope_pc_bounds (die, &lowpc, &highpc, cu);
|
||||||
|
|
||||||
@ -13716,7 +13713,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
name = dwarf2_name (die, cu);
|
name = dwarf2_name (die, cu);
|
||||||
|
|
||||||
@ -13895,7 +13892,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
struct die_info *child_die;
|
struct die_info *child_die;
|
||||||
CORE_ADDR baseaddr;
|
CORE_ADDR baseaddr;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
/* Ignore blocks with missing or invalid low and high pc attributes. */
|
/* Ignore blocks with missing or invalid low and high pc attributes. */
|
||||||
/* ??? Perhaps consider discontiguous blocks defined by DW_AT_ranges
|
/* ??? Perhaps consider discontiguous blocks defined by DW_AT_ranges
|
||||||
@ -13969,7 +13966,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
|
|||||||
int nparams;
|
int nparams;
|
||||||
struct die_info *child_die;
|
struct die_info *child_die;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
attr = dwarf2_attr (die, DW_AT_call_return_pc, cu);
|
attr = dwarf2_attr (die, DW_AT_call_return_pc, cu);
|
||||||
if (attr == NULL)
|
if (attr == NULL)
|
||||||
@ -14366,7 +14363,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
|
|||||||
}
|
}
|
||||||
buffer = dwarf2_per_objfile->rnglists.buffer + offset;
|
buffer = dwarf2_per_objfile->rnglists.buffer + offset;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -14534,7 +14531,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
|
|||||||
}
|
}
|
||||||
buffer = dwarf2_per_objfile->ranges.buffer + offset;
|
buffer = dwarf2_per_objfile->ranges.buffer + offset;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@ -14612,8 +14609,7 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
|
|||||||
{
|
{
|
||||||
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
|
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||||
const CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
|
const CORE_ADDR baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
int low_set = 0;
|
int low_set = 0;
|
||||||
CORE_ADDR low = 0;
|
CORE_ADDR low = 0;
|
||||||
CORE_ADDR high = 0;
|
CORE_ADDR high = 0;
|
||||||
@ -21382,7 +21378,7 @@ dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
|
|||||||
the line number program). */
|
the line number program). */
|
||||||
bool record_lines_p = !decode_for_pst_p;
|
bool record_lines_p = !decode_for_pst_p;
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
line_ptr = lh->statement_program_start;
|
line_ptr = lh->statement_program_start;
|
||||||
line_end = lh->statement_program_end;
|
line_end = lh->statement_program_end;
|
||||||
@ -21765,10 +21761,10 @@ var_decode_location (struct attribute *attr, struct symbol *sym,
|
|||||||
&dummy));
|
&dummy));
|
||||||
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
|
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
|
||||||
fixup_symbol_section (sym, objfile);
|
fixup_symbol_section (sym, objfile);
|
||||||
SET_SYMBOL_VALUE_ADDRESS (sym,
|
SET_SYMBOL_VALUE_ADDRESS
|
||||||
SYMBOL_VALUE_ADDRESS (sym)
|
(sym,
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
SYMBOL_VALUE_ADDRESS (sym)
|
||||||
SYMBOL_SECTION (sym)));
|
+ objfile->section_offsets[SYMBOL_SECTION (sym)]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21810,7 +21806,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
|||||||
|
|
||||||
int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
|
int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
|
||||||
|
|
||||||
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
name = dwarf2_name (die, cu);
|
name = dwarf2_name (die, cu);
|
||||||
if (name)
|
if (name)
|
||||||
@ -23608,8 +23604,7 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off,
|
|||||||
!= dwarf2_per_objfile->abstract_to_concrete.end ()))
|
!= dwarf2_per_objfile->abstract_to_concrete.end ()))
|
||||||
{
|
{
|
||||||
CORE_ADDR pc = (*get_frame_pc) (baton);
|
CORE_ADDR pc = (*get_frame_pc) (baton);
|
||||||
CORE_ADDR baseaddr
|
CORE_ADDR baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||||
|
|
||||||
for (const auto &cand_off
|
for (const auto &cand_off
|
||||||
@ -25626,7 +25621,7 @@ dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu)
|
|||||||
{
|
{
|
||||||
struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
|
struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
|
||||||
|
|
||||||
return ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
return objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a type that is a generic pointer type, the size of which matches
|
/* Return a type that is a generic pointer type, the size of which matches
|
||||||
|
@ -87,8 +87,7 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
|
|||||||
we have to do it ourselves. */
|
we have to do it ourselves. */
|
||||||
pltgot = extract_unsigned_integer (buf, sizeof buf,
|
pltgot = extract_unsigned_integer (buf, sizeof buf,
|
||||||
byte_order);
|
byte_order);
|
||||||
pltgot += ANOFFSET (sec->objfile->section_offsets,
|
pltgot += sec->objfile->section_offsets[SECT_OFF_TEXT (sec->objfile)];
|
||||||
SECT_OFF_TEXT (sec->objfile));
|
|
||||||
|
|
||||||
return pltgot;
|
return pltgot;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,7 @@ read_unwind_info (struct objfile *objfile)
|
|||||||
struct hppa_unwind_info *ui;
|
struct hppa_unwind_info *ui;
|
||||||
struct hppa_objfile_private *obj_private;
|
struct hppa_objfile_private *obj_private;
|
||||||
|
|
||||||
text_offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
text_offset = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
|
ui = (struct hppa_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
|
||||||
sizeof (struct hppa_unwind_info));
|
sizeof (struct hppa_unwind_info));
|
||||||
|
|
||||||
|
@ -2713,7 +2713,7 @@ ia64_find_unwind_table (struct objfile *objfile, unw_word_t ip,
|
|||||||
ehdr = elf_tdata (bfd)->elf_header;
|
ehdr = elf_tdata (bfd)->elf_header;
|
||||||
phdr = elf_tdata (bfd)->phdr;
|
phdr = elf_tdata (bfd)->phdr;
|
||||||
|
|
||||||
load_base = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
load_base = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
for (i = 0; i < ehdr->e_phnum; ++i)
|
for (i = 0; i < ehdr->e_phnum; ++i)
|
||||||
{
|
{
|
||||||
|
@ -907,12 +907,7 @@ macho_symfile_offsets (struct objfile *objfile,
|
|||||||
struct obj_section *osect;
|
struct obj_section *osect;
|
||||||
|
|
||||||
/* Allocate section_offsets. */
|
/* Allocate section_offsets. */
|
||||||
objfile->num_sections = bfd_count_sections (objfile->obfd);
|
objfile->section_offsets.assign (bfd_count_sections (objfile->obfd), 0);
|
||||||
objfile->section_offsets = (struct section_offsets *)
|
|
||||||
obstack_alloc (&objfile->objfile_obstack,
|
|
||||||
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
|
|
||||||
memset (objfile->section_offsets, 0,
|
|
||||||
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
|
|
||||||
|
|
||||||
/* This code is run when we first add the objfile with
|
/* This code is run when we first add the objfile with
|
||||||
symfile_add_with_addrs_or_offsets, when "addrs" not "offsets" are
|
symfile_add_with_addrs_or_offsets, when "addrs" not "offsets" are
|
||||||
|
@ -580,7 +580,7 @@ add_data_symbol (SYMR *sh, union aux_ext *ax, int bigend,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
||||||
struct section_offsets *section_offsets, struct objfile *objfile)
|
const section_offsets §ion_offsets, struct objfile *objfile)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||||
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
|
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
|
||||||
@ -610,18 +610,18 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
|||||||
The value of a stBlock symbol is the displacement from the
|
The value of a stBlock symbol is the displacement from the
|
||||||
procedure address. */
|
procedure address. */
|
||||||
if (sh->st != stEnd && sh->st != stBlock)
|
if (sh->st != stEnd && sh->st != stBlock)
|
||||||
sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
sh->value += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
break;
|
break;
|
||||||
case scData:
|
case scData:
|
||||||
case scSData:
|
case scSData:
|
||||||
case scRData:
|
case scRData:
|
||||||
case scPData:
|
case scPData:
|
||||||
case scXData:
|
case scXData:
|
||||||
sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
|
sh->value += section_offsets[SECT_OFF_DATA (objfile)];
|
||||||
break;
|
break;
|
||||||
case scBss:
|
case scBss:
|
||||||
case scSBss:
|
case scSBss:
|
||||||
sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
|
sh->value += section_offsets[SECT_OFF_BSS (objfile)];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2023,8 +2023,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
|
|||||||
/* GDB expects the absolute function start address for the
|
/* GDB expects the absolute function start address for the
|
||||||
procedure descriptor in e->pdr.adr.
|
procedure descriptor in e->pdr.adr.
|
||||||
As the address in the procedure descriptor is usually relative,
|
As the address in the procedure descriptor is usually relative,
|
||||||
we would have to relocate e->pdr.adr with cur_fdr->adr and
|
we would have to relocate e->pdr.adr with cur_fdr->adr.
|
||||||
ANOFFSET (pst->section_offsets, SECT_OFF_TEXT (pst->objfile)).
|
|
||||||
Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
|
Unfortunately cur_fdr->adr and e->pdr.adr are both absolute
|
||||||
in shared libraries on some systems, and on other systems
|
in shared libraries on some systems, and on other systems
|
||||||
e->pdr.adr is sometimes offset by a bogus value.
|
e->pdr.adr is sometimes offset by a bogus value.
|
||||||
@ -2060,11 +2059,8 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab,
|
|||||||
|
|
||||||
This routine clobbers top_stack->cur_block and ->cur_st. */
|
This routine clobbers top_stack->cur_block and ->cur_st. */
|
||||||
|
|
||||||
static void parse_external (EXTR *, int, struct section_offsets *,
|
|
||||||
struct objfile *);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_external (EXTR *es, int bigend, struct section_offsets *section_offsets,
|
parse_external (EXTR *es, int bigend, const section_offsets §ion_offsets,
|
||||||
struct objfile *objfile)
|
struct objfile *objfile)
|
||||||
{
|
{
|
||||||
union aux_ext *ax;
|
union aux_ext *ax;
|
||||||
@ -3862,7 +3858,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
|
|||||||
struct linetable *lines;
|
struct linetable *lines;
|
||||||
CORE_ADDR lowest_pdr_addr = 0;
|
CORE_ADDR lowest_pdr_addr = 0;
|
||||||
int last_symtab_ended = 0;
|
int last_symtab_ended = 0;
|
||||||
struct section_offsets *section_offsets = objfile->section_offsets;
|
const section_offsets §ion_offsets = objfile->section_offsets;
|
||||||
|
|
||||||
if (pst->readin)
|
if (pst->readin)
|
||||||
return;
|
return;
|
||||||
@ -3980,8 +3976,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
|
|||||||
&& previous_stab_code != (unsigned char) N_SO
|
&& previous_stab_code != (unsigned char) N_SO
|
||||||
&& *name == '\000')
|
&& *name == '\000')
|
||||||
{
|
{
|
||||||
valu += ANOFFSET (section_offsets,
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
previous_stab_code = N_SO;
|
previous_stab_code = N_SO;
|
||||||
cust = end_symtab (valu, SECT_OFF_TEXT (objfile));
|
cust = end_symtab (valu, SECT_OFF_TEXT (objfile));
|
||||||
end_stabs ();
|
end_stabs ();
|
||||||
@ -4028,8 +4023,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Handle encoded stab line number. */
|
/* Handle encoded stab line number. */
|
||||||
valu += ANOFFSET (section_offsets,
|
valu += section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
record_line (get_current_subfile (), sh.index,
|
record_line (get_current_subfile (), sh.index,
|
||||||
gdbarch_addr_bits_remove (gdbarch, valu));
|
gdbarch_addr_bits_remove (gdbarch, valu));
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
read_alphacoff_dynamic_symtab (minimal_symbol_reader &,
|
read_alphacoff_dynamic_symtab (minimal_symbol_reader &,
|
||||||
struct section_offsets *,
|
|
||||||
struct objfile *objfile);
|
struct objfile *objfile);
|
||||||
|
|
||||||
/* Initialize anything that needs initializing when a completely new
|
/* Initialize anything that needs initializing when a completely new
|
||||||
@ -84,7 +83,7 @@ mipscoff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
|
|||||||
|
|
||||||
/* Add alpha coff dynamic symbols. */
|
/* Add alpha coff dynamic symbols. */
|
||||||
|
|
||||||
read_alphacoff_dynamic_symtab (reader, objfile->section_offsets, objfile);
|
read_alphacoff_dynamic_symtab (reader, objfile);
|
||||||
|
|
||||||
/* Install any minimal symbols that have been collected as the current
|
/* Install any minimal symbols that have been collected as the current
|
||||||
minimal symbols for this objfile. */
|
minimal symbols for this objfile. */
|
||||||
@ -174,7 +173,6 @@ alphacoff_locate_sections (bfd *ignore_abfd, asection *sectp, void *sip)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
|
read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
|
||||||
struct section_offsets *section_offsets,
|
|
||||||
struct objfile *objfile)
|
struct objfile *objfile)
|
||||||
{
|
{
|
||||||
bfd *abfd = objfile->obfd;
|
bfd *abfd = objfile->obfd;
|
||||||
|
@ -391,9 +391,9 @@ entry_point_address_query (CORE_ADDR *entry_p)
|
|||||||
if (symfile_objfile == NULL || !symfile_objfile->per_bfd->ei.entry_point_p)
|
if (symfile_objfile == NULL || !symfile_objfile->per_bfd->ei.entry_point_p)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
int idx = symfile_objfile->per_bfd->ei.the_bfd_section_index;
|
||||||
*entry_p = (symfile_objfile->per_bfd->ei.entry_point
|
*entry_p = (symfile_objfile->per_bfd->ei.entry_point
|
||||||
+ ANOFFSET (symfile_objfile->section_offsets,
|
+ symfile_objfile->section_offsets[idx]);
|
||||||
symfile_objfile->per_bfd->ei.the_bfd_section_index));
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -626,7 +626,7 @@ objfile::~objfile ()
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
|
relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
|
||||||
struct section_offsets *delta)
|
const section_offsets &delta)
|
||||||
{
|
{
|
||||||
fixup_symbol_section (sym, objfile);
|
fixup_symbol_section (sym, objfile);
|
||||||
|
|
||||||
@ -640,7 +640,7 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
SET_SYMBOL_VALUE_ADDRESS (sym,
|
SET_SYMBOL_VALUE_ADDRESS (sym,
|
||||||
SYMBOL_VALUE_ADDRESS (sym)
|
SYMBOL_VALUE_ADDRESS (sym)
|
||||||
+ ANOFFSET (delta, SYMBOL_SECTION (sym)));
|
+ delta[SYMBOL_SECTION (sym)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,19 +650,16 @@ relocate_one_symbol (struct symbol *sym, struct objfile *objfile,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
objfile_relocate1 (struct objfile *objfile,
|
objfile_relocate1 (struct objfile *objfile,
|
||||||
const struct section_offsets *new_offsets)
|
const section_offsets &new_offsets)
|
||||||
{
|
{
|
||||||
struct section_offsets *delta =
|
section_offsets delta (objfile->section_offsets.size ());
|
||||||
((struct section_offsets *)
|
|
||||||
alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)));
|
|
||||||
|
|
||||||
int something_changed = 0;
|
int something_changed = 0;
|
||||||
|
|
||||||
for (int i = 0; i < objfile->num_sections; ++i)
|
for (int i = 0; i < objfile->section_offsets.size (); ++i)
|
||||||
{
|
{
|
||||||
delta->offsets[i] =
|
delta[i] = new_offsets[i] - objfile->section_offsets[i];
|
||||||
ANOFFSET (new_offsets, i) - ANOFFSET (objfile->section_offsets, i);
|
if (delta[i] != 0)
|
||||||
if (ANOFFSET (delta, i) != 0)
|
|
||||||
something_changed = 1;
|
something_changed = 1;
|
||||||
}
|
}
|
||||||
if (!something_changed)
|
if (!something_changed)
|
||||||
@ -681,9 +678,7 @@ objfile_relocate1 (struct objfile *objfile,
|
|||||||
if (l)
|
if (l)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < l->nitems; ++i)
|
for (int i = 0; i < l->nitems; ++i)
|
||||||
l->item[i].pc += ANOFFSET (delta,
|
l->item[i].pc += delta[COMPUNIT_BLOCK_LINE_SECTION (cust)];
|
||||||
COMPUNIT_BLOCK_LINE_SECTION
|
|
||||||
(cust));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -694,8 +689,7 @@ objfile_relocate1 (struct objfile *objfile,
|
|||||||
int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
|
int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
|
||||||
|
|
||||||
if (BLOCKVECTOR_MAP (bv))
|
if (BLOCKVECTOR_MAP (bv))
|
||||||
addrmap_relocate (BLOCKVECTOR_MAP (bv),
|
addrmap_relocate (BLOCKVECTOR_MAP (bv), delta[block_line_section]);
|
||||||
ANOFFSET (delta, block_line_section));
|
|
||||||
|
|
||||||
for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
||||||
{
|
{
|
||||||
@ -704,16 +698,14 @@ objfile_relocate1 (struct objfile *objfile,
|
|||||||
struct mdict_iterator miter;
|
struct mdict_iterator miter;
|
||||||
|
|
||||||
b = BLOCKVECTOR_BLOCK (bv, i);
|
b = BLOCKVECTOR_BLOCK (bv, i);
|
||||||
BLOCK_START (b) += ANOFFSET (delta, block_line_section);
|
BLOCK_START (b) += delta[block_line_section];
|
||||||
BLOCK_END (b) += ANOFFSET (delta, block_line_section);
|
BLOCK_END (b) += delta[block_line_section];
|
||||||
|
|
||||||
if (BLOCK_RANGES (b) != nullptr)
|
if (BLOCK_RANGES (b) != nullptr)
|
||||||
for (int j = 0; j < BLOCK_NRANGES (b); j++)
|
for (int j = 0; j < BLOCK_NRANGES (b); j++)
|
||||||
{
|
{
|
||||||
BLOCK_RANGE_START (b, j)
|
BLOCK_RANGE_START (b, j) += delta[block_line_section];
|
||||||
+= ANOFFSET (delta, block_line_section);
|
BLOCK_RANGE_END (b, j) += delta[block_line_section];
|
||||||
BLOCK_RANGE_END (b, j) += ANOFFSET (delta,
|
|
||||||
block_line_section);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We only want to iterate over the local symbols, not any
|
/* We only want to iterate over the local symbols, not any
|
||||||
@ -741,8 +733,8 @@ objfile_relocate1 (struct objfile *objfile,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < objfile->num_sections; ++i)
|
for (i = 0; i < objfile->section_offsets.size (); ++i)
|
||||||
(objfile->section_offsets)->offsets[i] = ANOFFSET (new_offsets, i);
|
objfile->section_offsets[i] = new_offsets[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rebuild section map next time we need it. */
|
/* Rebuild section map next time we need it. */
|
||||||
@ -773,7 +765,7 @@ objfile_relocate1 (struct objfile *objfile,
|
|||||||
|
|
||||||
void
|
void
|
||||||
objfile_relocate (struct objfile *objfile,
|
objfile_relocate (struct objfile *objfile,
|
||||||
const struct section_offsets *new_offsets)
|
const section_offsets &new_offsets)
|
||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
|
||||||
@ -792,15 +784,13 @@ objfile_relocate (struct objfile *objfile,
|
|||||||
|
|
||||||
addr_info_make_relative (&objfile_addrs, debug_objfile->obfd);
|
addr_info_make_relative (&objfile_addrs, debug_objfile->obfd);
|
||||||
|
|
||||||
gdb_assert (debug_objfile->num_sections
|
gdb_assert (debug_objfile->section_offsets.size ()
|
||||||
== gdb_bfd_count_sections (debug_objfile->obfd));
|
== gdb_bfd_count_sections (debug_objfile->obfd));
|
||||||
std::vector<struct section_offsets>
|
section_offsets new_debug_offsets
|
||||||
new_debug_offsets (SIZEOF_N_SECTION_OFFSETS (debug_objfile->num_sections));
|
(debug_objfile->section_offsets.size ());
|
||||||
relative_addr_info_to_section_offsets (new_debug_offsets.data (),
|
relative_addr_info_to_section_offsets (new_debug_offsets, objfile_addrs);
|
||||||
debug_objfile->num_sections,
|
|
||||||
objfile_addrs);
|
|
||||||
|
|
||||||
changed |= objfile_relocate1 (debug_objfile, new_debug_offsets.data ());
|
changed |= objfile_relocate1 (debug_objfile, new_debug_offsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Relocate breakpoints as necessary, after things are relocated. */
|
/* Relocate breakpoints as necessary, after things are relocated. */
|
||||||
@ -815,14 +805,7 @@ objfile_relocate (struct objfile *objfile,
|
|||||||
static int
|
static int
|
||||||
objfile_rebase1 (struct objfile *objfile, CORE_ADDR slide)
|
objfile_rebase1 (struct objfile *objfile, CORE_ADDR slide)
|
||||||
{
|
{
|
||||||
struct section_offsets *new_offsets =
|
section_offsets new_offsets (objfile->section_offsets.size (), slide);
|
||||||
((struct section_offsets *)
|
|
||||||
alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)));
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < objfile->num_sections; ++i)
|
|
||||||
new_offsets->offsets[i] = slide;
|
|
||||||
|
|
||||||
return objfile_relocate1 (objfile, new_offsets);
|
return objfile_relocate1 (objfile, new_offsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ struct obj_section
|
|||||||
|
|
||||||
/* Relocation offset applied to S. */
|
/* Relocation offset applied to S. */
|
||||||
#define obj_section_offset(s) \
|
#define obj_section_offset(s) \
|
||||||
(((s)->objfile->section_offsets)->offsets[gdb_bfd_section_index ((s)->objfile->obfd, (s)->the_bfd_section)])
|
(((s)->objfile->section_offsets)[gdb_bfd_section_index ((s)->objfile->obfd, (s)->the_bfd_section)])
|
||||||
|
|
||||||
/* The memory address of section S (vma + offset). */
|
/* The memory address of section S (vma + offset). */
|
||||||
#define obj_section_addr(s) \
|
#define obj_section_addr(s) \
|
||||||
@ -560,14 +560,12 @@ public:
|
|||||||
/* Set of relocation offsets to apply to each section.
|
/* Set of relocation offsets to apply to each section.
|
||||||
The table is indexed by the_bfd_section->index, thus it is generally
|
The table is indexed by the_bfd_section->index, thus it is generally
|
||||||
as large as the number of sections in the binary.
|
as large as the number of sections in the binary.
|
||||||
The table is stored on the objfile_obstack.
|
|
||||||
|
|
||||||
These offsets indicate that all symbols (including partial and
|
These offsets indicate that all symbols (including partial and
|
||||||
minimal symbols) which have been read have been relocated by this
|
minimal symbols) which have been read have been relocated by this
|
||||||
much. Symbols which are yet to be read need to be relocated by it. */
|
much. Symbols which are yet to be read need to be relocated by it. */
|
||||||
|
|
||||||
struct section_offsets *section_offsets = nullptr;
|
::section_offsets section_offsets;
|
||||||
int num_sections = 0;
|
|
||||||
|
|
||||||
/* Indexes in the section_offsets array. These are initialized by the
|
/* Indexes in the section_offsets array. These are initialized by the
|
||||||
*_symfile_offsets() family of functions (som_symfile_offsets,
|
*_symfile_offsets() family of functions (som_symfile_offsets,
|
||||||
@ -669,7 +667,7 @@ extern void build_objfile_section_table (struct objfile *);
|
|||||||
|
|
||||||
extern void free_objfile_separate_debug (struct objfile *);
|
extern void free_objfile_separate_debug (struct objfile *);
|
||||||
|
|
||||||
extern void objfile_relocate (struct objfile *, const struct section_offsets *);
|
extern void objfile_relocate (struct objfile *, const section_offsets &);
|
||||||
extern void objfile_rebase (struct objfile *, CORE_ADDR);
|
extern void objfile_rebase (struct objfile *, CORE_ADDR);
|
||||||
|
|
||||||
extern int objfile_has_partial_symbols (struct objfile *objfile);
|
extern int objfile_has_partial_symbols (struct objfile *objfile);
|
||||||
|
@ -55,8 +55,7 @@ struct partial_symbol
|
|||||||
the offsets provided in OBJFILE. */
|
the offsets provided in OBJFILE. */
|
||||||
CORE_ADDR address (const struct objfile *objfile) const
|
CORE_ADDR address (const struct objfile *objfile) const
|
||||||
{
|
{
|
||||||
return (ginfo.value.address
|
return ginfo.value.address + objfile->section_offsets[ginfo.section];
|
||||||
+ ANOFFSET (objfile->section_offsets, ginfo.section));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the address of this partial symbol. The address must be
|
/* Set the address of this partial symbol. The address must be
|
||||||
@ -120,15 +119,13 @@ struct partial_symtab
|
|||||||
/* Return the relocated low text address of this partial_symtab. */
|
/* Return the relocated low text address of this partial_symtab. */
|
||||||
CORE_ADDR text_low (struct objfile *objfile) const
|
CORE_ADDR text_low (struct objfile *objfile) const
|
||||||
{
|
{
|
||||||
return m_text_low + ANOFFSET (objfile->section_offsets,
|
return m_text_low + objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the relocated high text address of this partial_symtab. */
|
/* Return the relocated high text address of this partial_symtab. */
|
||||||
CORE_ADDR text_high (struct objfile *objfile) const
|
CORE_ADDR text_high (struct objfile *objfile) const
|
||||||
{
|
{
|
||||||
return m_text_high + ANOFFSET (objfile->section_offsets,
|
return m_text_high + objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the low text address of this partial_symtab. */
|
/* Set the low text address of this partial_symtab. */
|
||||||
|
@ -316,8 +316,7 @@ find_pc_sect_psymtab (struct objfile *objfile, CORE_ADDR pc,
|
|||||||
if (objfile->partial_symtabs->psymtabs != NULL
|
if (objfile->partial_symtabs->psymtabs != NULL
|
||||||
&& objfile->partial_symtabs->psymtabs_addrmap != NULL)
|
&& objfile->partial_symtabs->psymtabs_addrmap != NULL)
|
||||||
{
|
{
|
||||||
CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
|
CORE_ADDR baseaddr = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
|
|
||||||
struct partial_symtab *pst
|
struct partial_symtab *pst
|
||||||
= ((struct partial_symtab *)
|
= ((struct partial_symtab *)
|
||||||
|
12
gdb/remote.c
12
gdb/remote.c
@ -4049,7 +4049,6 @@ remote_target::get_offsets ()
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
int lose, num_segments = 0, do_sections, do_segments;
|
int lose, num_segments = 0, do_sections, do_segments;
|
||||||
CORE_ADDR text_addr, data_addr, bss_addr, segments[2];
|
CORE_ADDR text_addr, data_addr, bss_addr, segments[2];
|
||||||
struct section_offsets *offs;
|
|
||||||
struct symfile_segment_data *data;
|
struct symfile_segment_data *data;
|
||||||
|
|
||||||
if (symfile_objfile == NULL)
|
if (symfile_objfile == NULL)
|
||||||
@ -4128,10 +4127,7 @@ remote_target::get_offsets ()
|
|||||||
else if (*ptr != '\0')
|
else if (*ptr != '\0')
|
||||||
warning (_("Target reported unsupported offsets: %s"), buf);
|
warning (_("Target reported unsupported offsets: %s"), buf);
|
||||||
|
|
||||||
offs = ((struct section_offsets *)
|
section_offsets offs = symfile_objfile->section_offsets;
|
||||||
alloca (SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections)));
|
|
||||||
memcpy (offs, symfile_objfile->section_offsets,
|
|
||||||
SIZEOF_N_SECTION_OFFSETS (symfile_objfile->num_sections));
|
|
||||||
|
|
||||||
data = get_symfile_segment_data (symfile_objfile->obfd);
|
data = get_symfile_segment_data (symfile_objfile->obfd);
|
||||||
do_segments = (data != NULL);
|
do_segments = (data != NULL);
|
||||||
@ -4184,15 +4180,15 @@ remote_target::get_offsets ()
|
|||||||
|
|
||||||
if (do_sections)
|
if (do_sections)
|
||||||
{
|
{
|
||||||
offs->offsets[SECT_OFF_TEXT (symfile_objfile)] = text_addr;
|
offs[SECT_OFF_TEXT (symfile_objfile)] = text_addr;
|
||||||
|
|
||||||
/* This is a temporary kludge to force data and bss to use the
|
/* This is a temporary kludge to force data and bss to use the
|
||||||
same offsets because that's what nlmconv does now. The real
|
same offsets because that's what nlmconv does now. The real
|
||||||
solution requires changes to the stub and remote.c that I
|
solution requires changes to the stub and remote.c that I
|
||||||
don't have time to do right now. */
|
don't have time to do right now. */
|
||||||
|
|
||||||
offs->offsets[SECT_OFF_DATA (symfile_objfile)] = data_addr;
|
offs[SECT_OFF_DATA (symfile_objfile)] = data_addr;
|
||||||
offs->offsets[SECT_OFF_BSS (symfile_objfile)] = data_addr;
|
offs[SECT_OFF_BSS (symfile_objfile)] = data_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
objfile_relocate (symfile_objfile, offs);
|
objfile_relocate (symfile_objfile, offs);
|
||||||
|
@ -390,19 +390,15 @@ solib_aix_clear_solib (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Compute and return the OBJFILE's section_offset array, using
|
/* Compute and return the OBJFILE's section_offset array, using
|
||||||
the associated loader info (INFO).
|
the associated loader info (INFO). */
|
||||||
|
|
||||||
The resulting array is computed on the heap and must be
|
static section_offsets
|
||||||
deallocated after use. */
|
|
||||||
|
|
||||||
static gdb::unique_xmalloc_ptr<struct section_offsets>
|
|
||||||
solib_aix_get_section_offsets (struct objfile *objfile,
|
solib_aix_get_section_offsets (struct objfile *objfile,
|
||||||
lm_info_aix *info)
|
lm_info_aix *info)
|
||||||
{
|
{
|
||||||
bfd *abfd = objfile->obfd;
|
bfd *abfd = objfile->obfd;
|
||||||
|
|
||||||
gdb::unique_xmalloc_ptr<struct section_offsets> offsets
|
section_offsets offsets (objfile->section_offsets.size ());
|
||||||
(XCNEWVEC (struct section_offsets, objfile->num_sections));
|
|
||||||
|
|
||||||
/* .text */
|
/* .text */
|
||||||
|
|
||||||
@ -411,7 +407,7 @@ solib_aix_get_section_offsets (struct objfile *objfile,
|
|||||||
struct bfd_section *sect
|
struct bfd_section *sect
|
||||||
= objfile->sections[objfile->sect_index_text].the_bfd_section;
|
= objfile->sections[objfile->sect_index_text].the_bfd_section;
|
||||||
|
|
||||||
offsets->offsets[objfile->sect_index_text]
|
offsets[objfile->sect_index_text]
|
||||||
= info->text_addr + sect->filepos - bfd_section_vma (sect);
|
= info->text_addr + sect->filepos - bfd_section_vma (sect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +418,7 @@ solib_aix_get_section_offsets (struct objfile *objfile,
|
|||||||
struct bfd_section *sect
|
struct bfd_section *sect
|
||||||
= objfile->sections[objfile->sect_index_data].the_bfd_section;
|
= objfile->sections[objfile->sect_index_data].the_bfd_section;
|
||||||
|
|
||||||
offsets->offsets[objfile->sect_index_data]
|
offsets[objfile->sect_index_data]
|
||||||
= info->data_addr - bfd_section_vma (sect);
|
= info->data_addr - bfd_section_vma (sect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,8 +431,8 @@ solib_aix_get_section_offsets (struct objfile *objfile,
|
|||||||
if (objfile->sect_index_bss != -1
|
if (objfile->sect_index_bss != -1
|
||||||
&& objfile->sect_index_data != -1)
|
&& objfile->sect_index_data != -1)
|
||||||
{
|
{
|
||||||
offsets->offsets[objfile->sect_index_bss]
|
offsets[objfile->sect_index_bss]
|
||||||
= (offsets->offsets[objfile->sect_index_data]
|
= (offsets[objfile->sect_index_data]
|
||||||
+ solib_aix_bss_data_overlap (abfd));
|
+ solib_aix_bss_data_overlap (abfd));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,10 +464,10 @@ solib_aix_solib_create_inferior_hook (int from_tty)
|
|||||||
lm_info_aix &exec_info = (*library_list)[0];
|
lm_info_aix &exec_info = (*library_list)[0];
|
||||||
if (symfile_objfile != NULL)
|
if (symfile_objfile != NULL)
|
||||||
{
|
{
|
||||||
gdb::unique_xmalloc_ptr<struct section_offsets> offsets
|
section_offsets offsets
|
||||||
= solib_aix_get_section_offsets (symfile_objfile, &exec_info);
|
= solib_aix_get_section_offsets (symfile_objfile, &exec_info);
|
||||||
|
|
||||||
objfile_relocate (symfile_objfile, offsets.get ());
|
objfile_relocate (symfile_objfile, offsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,8 +911,7 @@ dsbt_relocate_main_executable (void)
|
|||||||
info->main_executable_lm_info = new lm_info_dsbt;
|
info->main_executable_lm_info = new lm_info_dsbt;
|
||||||
info->main_executable_lm_info->map = ldm;
|
info->main_executable_lm_info->map = ldm;
|
||||||
|
|
||||||
gdb::unique_xmalloc_ptr<struct section_offsets> new_offsets
|
section_offsets new_offsets (symfile_objfile->section_offsets.size ());
|
||||||
(XCNEWVEC (struct section_offsets, symfile_objfile->num_sections));
|
|
||||||
changed = 0;
|
changed = 0;
|
||||||
|
|
||||||
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
|
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
|
||||||
@ -926,7 +925,7 @@ dsbt_relocate_main_executable (void)
|
|||||||
/* Current address of section. */
|
/* Current address of section. */
|
||||||
addr = obj_section_addr (osect);
|
addr = obj_section_addr (osect);
|
||||||
/* Offset from where this section started. */
|
/* Offset from where this section started. */
|
||||||
offset = ANOFFSET (symfile_objfile->section_offsets, osect_idx);
|
offset = symfile_objfile->section_offsets[osect_idx];
|
||||||
/* Original address prior to any past relocations. */
|
/* Original address prior to any past relocations. */
|
||||||
orig_addr = addr - offset;
|
orig_addr = addr - offset;
|
||||||
|
|
||||||
@ -935,10 +934,10 @@ dsbt_relocate_main_executable (void)
|
|||||||
if (ldm->segs[seg].p_vaddr <= orig_addr
|
if (ldm->segs[seg].p_vaddr <= orig_addr
|
||||||
&& orig_addr < ldm->segs[seg].p_vaddr + ldm->segs[seg].p_memsz)
|
&& orig_addr < ldm->segs[seg].p_vaddr + ldm->segs[seg].p_memsz)
|
||||||
{
|
{
|
||||||
new_offsets->offsets[osect_idx]
|
new_offsets[osect_idx]
|
||||||
= ldm->segs[seg].addr - ldm->segs[seg].p_vaddr;
|
= ldm->segs[seg].addr - ldm->segs[seg].p_vaddr;
|
||||||
|
|
||||||
if (new_offsets->offsets[osect_idx] != offset)
|
if (new_offsets[osect_idx] != offset)
|
||||||
changed = 1;
|
changed = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -946,7 +945,7 @@ dsbt_relocate_main_executable (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
objfile_relocate (symfile_objfile, new_offsets.get ());
|
objfile_relocate (symfile_objfile, new_offsets);
|
||||||
|
|
||||||
/* Now that symfile_objfile has been relocated, we can compute the
|
/* Now that symfile_objfile has been relocated, we can compute the
|
||||||
GOT value and stash it away. */
|
GOT value and stash it away. */
|
||||||
|
@ -785,8 +785,7 @@ frv_relocate_main_executable (void)
|
|||||||
main_executable_lm_info = new lm_info_frv;
|
main_executable_lm_info = new lm_info_frv;
|
||||||
main_executable_lm_info->map = ldm;
|
main_executable_lm_info->map = ldm;
|
||||||
|
|
||||||
gdb::unique_xmalloc_ptr<struct section_offsets> new_offsets
|
section_offsets new_offsets (symfile_objfile->section_offsets.size ());
|
||||||
(XCNEWVEC (struct section_offsets, symfile_objfile->num_sections));
|
|
||||||
changed = 0;
|
changed = 0;
|
||||||
|
|
||||||
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
|
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
|
||||||
@ -800,7 +799,7 @@ frv_relocate_main_executable (void)
|
|||||||
/* Current address of section. */
|
/* Current address of section. */
|
||||||
addr = obj_section_addr (osect);
|
addr = obj_section_addr (osect);
|
||||||
/* Offset from where this section started. */
|
/* Offset from where this section started. */
|
||||||
offset = ANOFFSET (symfile_objfile->section_offsets, osect_idx);
|
offset = symfile_objfile->section_offsets[osect_idx];
|
||||||
/* Original address prior to any past relocations. */
|
/* Original address prior to any past relocations. */
|
||||||
orig_addr = addr - offset;
|
orig_addr = addr - offset;
|
||||||
|
|
||||||
@ -809,10 +808,10 @@ frv_relocate_main_executable (void)
|
|||||||
if (ldm->segs[seg].p_vaddr <= orig_addr
|
if (ldm->segs[seg].p_vaddr <= orig_addr
|
||||||
&& orig_addr < ldm->segs[seg].p_vaddr + ldm->segs[seg].p_memsz)
|
&& orig_addr < ldm->segs[seg].p_vaddr + ldm->segs[seg].p_memsz)
|
||||||
{
|
{
|
||||||
new_offsets->offsets[osect_idx]
|
new_offsets[osect_idx]
|
||||||
= ldm->segs[seg].addr - ldm->segs[seg].p_vaddr;
|
= ldm->segs[seg].addr - ldm->segs[seg].p_vaddr;
|
||||||
|
|
||||||
if (new_offsets->offsets[osect_idx] != offset)
|
if (new_offsets[osect_idx] != offset)
|
||||||
changed = 1;
|
changed = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -820,7 +819,7 @@ frv_relocate_main_executable (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
objfile_relocate (symfile_objfile, new_offsets.get ());
|
objfile_relocate (symfile_objfile, new_offsets);
|
||||||
|
|
||||||
/* Now that symfile_objfile has been relocated, we can compute the
|
/* Now that symfile_objfile has been relocated, we can compute the
|
||||||
GOT value and stash it away. */
|
GOT value and stash it away. */
|
||||||
|
@ -2273,8 +2273,7 @@ enable_break (struct svr4_info *info, int from_tty)
|
|||||||
CORE_ADDR load_addr;
|
CORE_ADDR load_addr;
|
||||||
|
|
||||||
tmp_bfd = os->objfile->obfd;
|
tmp_bfd = os->objfile->obfd;
|
||||||
load_addr = ANOFFSET (os->objfile->section_offsets,
|
load_addr = os->objfile->section_offsets[SECT_OFF_TEXT (os->objfile)];
|
||||||
SECT_OFF_TEXT (os->objfile));
|
|
||||||
|
|
||||||
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
|
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
|
||||||
if (interp_sect)
|
if (interp_sect)
|
||||||
@ -2975,15 +2974,8 @@ svr4_relocate_main_executable (void)
|
|||||||
|
|
||||||
if (symfile_objfile)
|
if (symfile_objfile)
|
||||||
{
|
{
|
||||||
struct section_offsets *new_offsets;
|
section_offsets new_offsets (symfile_objfile->section_offsets.size (),
|
||||||
int i;
|
displacement);
|
||||||
|
|
||||||
new_offsets = XALLOCAVEC (struct section_offsets,
|
|
||||||
symfile_objfile->num_sections);
|
|
||||||
|
|
||||||
for (i = 0; i < symfile_objfile->num_sections; i++)
|
|
||||||
new_offsets->offsets[i] = displacement;
|
|
||||||
|
|
||||||
objfile_relocate (symfile_objfile, new_offsets);
|
objfile_relocate (symfile_objfile, new_offsets);
|
||||||
}
|
}
|
||||||
else if (exec_bfd)
|
else if (exec_bfd)
|
||||||
|
@ -46,7 +46,7 @@ struct lm_info_target : public lm_info_base
|
|||||||
|
|
||||||
/* The cached offsets for each section of this shared library,
|
/* The cached offsets for each section of this shared library,
|
||||||
determined from SEGMENT_BASES, or SECTION_BASES. */
|
determined from SEGMENT_BASES, or SECTION_BASES. */
|
||||||
gdb::unique_xmalloc_ptr<section_offsets> offsets;
|
section_offsets offsets;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<std::unique_ptr<lm_info_target>> lm_info_vector;
|
typedef std::vector<std::unique_ptr<lm_info_target>> lm_info_vector;
|
||||||
@ -305,12 +305,11 @@ solib_target_relocate_section_addresses (struct so_list *so,
|
|||||||
|
|
||||||
/* Build the offset table only once per object file. We can not do
|
/* Build the offset table only once per object file. We can not do
|
||||||
it any earlier, since we need to open the file first. */
|
it any earlier, since we need to open the file first. */
|
||||||
if (li->offsets == NULL)
|
if (li->offsets.empty ())
|
||||||
{
|
{
|
||||||
int num_sections = gdb_bfd_count_sections (so->abfd);
|
int num_sections = gdb_bfd_count_sections (so->abfd);
|
||||||
|
|
||||||
li->offsets.reset ((struct section_offsets *)
|
li->offsets.assign (num_sections, 0);
|
||||||
xzalloc (SIZEOF_N_SECTION_OFFSETS (num_sections)));
|
|
||||||
|
|
||||||
if (!li->section_bases.empty ())
|
if (!li->section_bases.empty ())
|
||||||
{
|
{
|
||||||
@ -355,7 +354,7 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
|
|||||||
gdb_assert (so->addr_low <= so->addr_high);
|
gdb_assert (so->addr_low <= so->addr_high);
|
||||||
found_range = 1;
|
found_range = 1;
|
||||||
}
|
}
|
||||||
li->offsets->offsets[i] = li->section_bases[bases_index];
|
li->offsets[i] = li->section_bases[bases_index];
|
||||||
bases_index++;
|
bases_index++;
|
||||||
}
|
}
|
||||||
if (!found_range)
|
if (!found_range)
|
||||||
@ -377,7 +376,7 @@ Could not relocate shared library \"%s\": no segments"), so->so_name);
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!symfile_map_offsets_to_segments (so->abfd, data,
|
if (!symfile_map_offsets_to_segments (so->abfd, data,
|
||||||
li->offsets.get (),
|
li->offsets,
|
||||||
li->segment_bases.size (),
|
li->segment_bases.size (),
|
||||||
li->segment_bases.data ()))
|
li->segment_bases.data ()))
|
||||||
warning (_("\
|
warning (_("\
|
||||||
@ -414,9 +413,8 @@ Could not relocate shared library \"%s\": bad offsets"), so->so_name);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = li->offsets->offsets[gdb_bfd_section_index
|
offset = li->offsets[gdb_bfd_section_index (sec->the_bfd_section->owner,
|
||||||
(sec->the_bfd_section->owner,
|
sec->the_bfd_section)];
|
||||||
sec->the_bfd_section)];
|
|
||||||
sec->addr += offset;
|
sec->addr += offset;
|
||||||
sec->endaddr += offset;
|
sec->endaddr += offset;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ extern struct partial_symtab *dbx_end_psymtab
|
|||||||
int textlow_not_set);
|
int textlow_not_set);
|
||||||
|
|
||||||
extern void process_one_symbol (int, int, CORE_ADDR, const char *,
|
extern void process_one_symbol (int, int, CORE_ADDR, const char *,
|
||||||
const struct section_offsets *,
|
const section_offsets &,
|
||||||
struct objfile *, enum language);
|
struct objfile *, enum language);
|
||||||
|
|
||||||
extern void elfstab_build_psymtabs (struct objfile *objfile,
|
extern void elfstab_build_psymtabs (struct objfile *objfile,
|
||||||
|
@ -1290,8 +1290,7 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
|
|||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
relocate_address (CORE_ADDR address, struct objfile *objfile)
|
relocate_address (CORE_ADDR address, struct objfile *objfile)
|
||||||
{
|
{
|
||||||
return address + ANOFFSET (objfile->section_offsets,
|
return address + objfile->section_offsets[SECT_OFF_DATA (objfile)];
|
||||||
SECT_OFF_DATA (objfile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implementation of the get_relocated_address method. */
|
/* Implementation of the get_relocated_address method. */
|
||||||
|
@ -269,7 +269,7 @@ build_section_addr_info_from_objfile (const struct objfile *objfile)
|
|||||||
{
|
{
|
||||||
int sectindex = sap[i].sectindex;
|
int sectindex = sap[i].sectindex;
|
||||||
|
|
||||||
sap[i].addr += objfile->section_offsets->offsets[sectindex];
|
sap[i].addr += objfile->section_offsets[sectindex];
|
||||||
}
|
}
|
||||||
return sap;
|
return sap;
|
||||||
}
|
}
|
||||||
@ -315,14 +315,14 @@ init_objfile_sect_indices (struct objfile *objfile)
|
|||||||
later, e.g. by the remote qOffsets packet, and then this will
|
later, e.g. by the remote qOffsets packet, and then this will
|
||||||
be wrong! That's why we try segments first. */
|
be wrong! That's why we try segments first. */
|
||||||
|
|
||||||
for (i = 0; i < objfile->num_sections; i++)
|
for (i = 0; i < objfile->section_offsets.size (); i++)
|
||||||
{
|
{
|
||||||
if (ANOFFSET (objfile->section_offsets, i) != 0)
|
if (objfile->section_offsets[i] != 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == objfile->num_sections)
|
if (i == objfile->section_offsets.size ())
|
||||||
{
|
{
|
||||||
if (objfile->sect_index_text == -1)
|
if (objfile->sect_index_text == -1)
|
||||||
objfile->sect_index_text = 0;
|
objfile->sect_index_text = 0;
|
||||||
@ -339,7 +339,7 @@ init_objfile_sect_indices (struct objfile *objfile)
|
|||||||
|
|
||||||
struct place_section_arg
|
struct place_section_arg
|
||||||
{
|
{
|
||||||
struct section_offsets *offsets;
|
section_offsets *offsets;
|
||||||
CORE_ADDR lowest;
|
CORE_ADDR lowest;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -350,7 +350,8 @@ static void
|
|||||||
place_section (bfd *abfd, asection *sect, void *obj)
|
place_section (bfd *abfd, asection *sect, void *obj)
|
||||||
{
|
{
|
||||||
struct place_section_arg *arg = (struct place_section_arg *) obj;
|
struct place_section_arg *arg = (struct place_section_arg *) obj;
|
||||||
CORE_ADDR *offsets = arg->offsets->offsets, start_addr;
|
section_offsets &offsets = *arg->offsets;
|
||||||
|
CORE_ADDR start_addr;
|
||||||
int done;
|
int done;
|
||||||
ULONGEST align = ((ULONGEST) 1) << bfd_section_alignment (sect);
|
ULONGEST align = ((ULONGEST) 1) << bfd_section_alignment (sect);
|
||||||
|
|
||||||
@ -408,17 +409,15 @@ place_section (bfd *abfd, asection *sect, void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Store section_addr_info as prepared (made relative and with SECTINDEX
|
/* Store section_addr_info as prepared (made relative and with SECTINDEX
|
||||||
filled-in) by addr_info_make_relative into SECTION_OFFSETS of NUM_SECTIONS
|
filled-in) by addr_info_make_relative into SECTION_OFFSETS. */
|
||||||
entries. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
relative_addr_info_to_section_offsets (struct section_offsets *section_offsets,
|
relative_addr_info_to_section_offsets (section_offsets §ion_offsets,
|
||||||
int num_sections,
|
|
||||||
const section_addr_info &addrs)
|
const section_addr_info &addrs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset (section_offsets, 0, SIZEOF_N_SECTION_OFFSETS (num_sections));
|
section_offsets.assign (section_offsets.size (), 0);
|
||||||
|
|
||||||
/* Now calculate offsets for section that were specified by the caller. */
|
/* Now calculate offsets for section that were specified by the caller. */
|
||||||
for (i = 0; i < addrs.size (); i++)
|
for (i = 0; i < addrs.size (); i++)
|
||||||
@ -432,7 +431,7 @@ relative_addr_info_to_section_offsets (struct section_offsets *section_offsets,
|
|||||||
/* Record all sections in offsets. */
|
/* Record all sections in offsets. */
|
||||||
/* The section_offsets in the objfile are here filled in using
|
/* The section_offsets in the objfile are here filled in using
|
||||||
the BFD index. */
|
the BFD index. */
|
||||||
section_offsets->offsets[osp->sectindex] = osp->addr;
|
section_offsets[osp->sectindex] = osp->addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,12 +635,8 @@ void
|
|||||||
default_symfile_offsets (struct objfile *objfile,
|
default_symfile_offsets (struct objfile *objfile,
|
||||||
const section_addr_info &addrs)
|
const section_addr_info &addrs)
|
||||||
{
|
{
|
||||||
objfile->num_sections = gdb_bfd_count_sections (objfile->obfd);
|
objfile->section_offsets.resize (gdb_bfd_count_sections (objfile->obfd));
|
||||||
objfile->section_offsets = (struct section_offsets *)
|
relative_addr_info_to_section_offsets (objfile->section_offsets, addrs);
|
||||||
obstack_alloc (&objfile->objfile_obstack,
|
|
||||||
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
|
|
||||||
relative_addr_info_to_section_offsets (objfile->section_offsets,
|
|
||||||
objfile->num_sections, addrs);
|
|
||||||
|
|
||||||
/* For relocatable files, all loadable sections will start at zero.
|
/* For relocatable files, all loadable sections will start at zero.
|
||||||
The zero is meaningless, so try to pick arbitrary addresses such
|
The zero is meaningless, so try to pick arbitrary addresses such
|
||||||
@ -662,11 +657,11 @@ default_symfile_offsets (struct objfile *objfile,
|
|||||||
|
|
||||||
if (cur_sec == NULL)
|
if (cur_sec == NULL)
|
||||||
{
|
{
|
||||||
CORE_ADDR *offsets = objfile->section_offsets->offsets;
|
section_offsets &offsets = objfile->section_offsets;
|
||||||
|
|
||||||
/* Pick non-overlapping offsets for sections the user did not
|
/* Pick non-overlapping offsets for sections the user did not
|
||||||
place explicitly. */
|
place explicitly. */
|
||||||
arg.offsets = objfile->section_offsets;
|
arg.offsets = &objfile->section_offsets;
|
||||||
arg.lowest = 0;
|
arg.lowest = 0;
|
||||||
bfd_map_over_sections (objfile->obfd, place_section, &arg);
|
bfd_map_over_sections (objfile->obfd, place_section, &arg);
|
||||||
|
|
||||||
@ -902,7 +897,7 @@ init_entry_point_info (struct objfile *objfile)
|
|||||||
(as gleaned by GDB's shared library code). We convert each address
|
(as gleaned by GDB's shared library code). We convert each address
|
||||||
into an offset from the section VMA's as it appears in the object
|
into an offset from the section VMA's as it appears in the object
|
||||||
file, and then call the file's sym_offsets function to convert this
|
file, and then call the file's sym_offsets function to convert this
|
||||||
into a format-specific offset table --- a `struct section_offsets'.
|
into a format-specific offset table --- a `section_offsets'.
|
||||||
The sectindex field is used to control the ordering of sections
|
The sectindex field is used to control the ordering of sections
|
||||||
with the same name. Upon return, it is updated to contain the
|
with the same name. Upon return, it is updated to contain the
|
||||||
corresponding BFD section index, or -1 if the section was not found.
|
corresponding BFD section index, or -1 if the section was not found.
|
||||||
@ -926,13 +921,8 @@ syms_from_objfile_1 (struct objfile *objfile,
|
|||||||
/* No symbols to load, but we still need to make sure
|
/* No symbols to load, but we still need to make sure
|
||||||
that the section_offsets table is allocated. */
|
that the section_offsets table is allocated. */
|
||||||
int num_sections = gdb_bfd_count_sections (objfile->obfd);
|
int num_sections = gdb_bfd_count_sections (objfile->obfd);
|
||||||
size_t size = SIZEOF_N_SECTION_OFFSETS (num_sections);
|
|
||||||
|
|
||||||
objfile->num_sections = num_sections;
|
objfile->section_offsets.assign (num_sections, 0);
|
||||||
objfile->section_offsets
|
|
||||||
= (struct section_offsets *) obstack_alloc (&objfile->objfile_obstack,
|
|
||||||
size);
|
|
||||||
memset (objfile->section_offsets, 0, size);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2164,8 +2154,7 @@ set_objfile_default_section_offset (struct objfile *objf,
|
|||||||
CORE_ADDR offset)
|
CORE_ADDR offset)
|
||||||
{
|
{
|
||||||
/* Add OFFSET to all sections by default. */
|
/* Add OFFSET to all sections by default. */
|
||||||
std::vector<struct section_offsets> offsets (objf->num_sections,
|
section_offsets offsets (objf->section_offsets.size (), offset);
|
||||||
{ { offset } });
|
|
||||||
|
|
||||||
/* Create sorted lists of all sections in ADDRS as well as all
|
/* Create sorted lists of all sections in ADDRS as well as all
|
||||||
sections in OBJF. */
|
sections in OBJF. */
|
||||||
@ -2203,11 +2192,11 @@ set_objfile_default_section_offset (struct objfile *objf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmp == 0)
|
if (cmp == 0)
|
||||||
offsets[objf_sect->sectindex].offsets[0] = 0;
|
offsets[objf_sect->sectindex] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply the new section offsets. */
|
/* Apply the new section offsets. */
|
||||||
objfile_relocate (objf, offsets.data ());
|
objfile_relocate (objf, offsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function allows the addition of incrementally linked object files.
|
/* This function allows the addition of incrementally linked object files.
|
||||||
@ -2479,9 +2468,6 @@ reread_symbols (void)
|
|||||||
new_modtime = new_statbuf.st_mtime;
|
new_modtime = new_statbuf.st_mtime;
|
||||||
if (new_modtime != objfile->mtime)
|
if (new_modtime != objfile->mtime)
|
||||||
{
|
{
|
||||||
struct section_offsets *offsets;
|
|
||||||
int num_offsets;
|
|
||||||
|
|
||||||
printf_filtered (_("`%s' has changed; re-reading symbols.\n"),
|
printf_filtered (_("`%s' has changed; re-reading symbols.\n"),
|
||||||
objfile_name (objfile));
|
objfile_name (objfile));
|
||||||
|
|
||||||
@ -2556,14 +2542,6 @@ reread_symbols (void)
|
|||||||
error (_("Can't read symbols from %s: %s."), objfile_name (objfile),
|
error (_("Can't read symbols from %s: %s."), objfile_name (objfile),
|
||||||
bfd_errmsg (bfd_get_error ()));
|
bfd_errmsg (bfd_get_error ()));
|
||||||
|
|
||||||
/* Save the offsets, we will nuke them with the rest of the
|
|
||||||
objfile_obstack. */
|
|
||||||
num_offsets = objfile->num_sections;
|
|
||||||
offsets = ((struct section_offsets *)
|
|
||||||
alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets)));
|
|
||||||
memcpy (offsets, objfile->section_offsets,
|
|
||||||
SIZEOF_N_SECTION_OFFSETS (num_offsets));
|
|
||||||
|
|
||||||
objfile->reset_psymtabs ();
|
objfile->reset_psymtabs ();
|
||||||
|
|
||||||
/* NB: after this call to obstack_free, objfiles_changed
|
/* NB: after this call to obstack_free, objfiles_changed
|
||||||
@ -2595,15 +2573,6 @@ reread_symbols (void)
|
|||||||
|
|
||||||
build_objfile_section_table (objfile);
|
build_objfile_section_table (objfile);
|
||||||
|
|
||||||
/* We use the same section offsets as from last time. I'm not
|
|
||||||
sure whether that is always correct for shared libraries. */
|
|
||||||
objfile->section_offsets = (struct section_offsets *)
|
|
||||||
obstack_alloc (&objfile->objfile_obstack,
|
|
||||||
SIZEOF_N_SECTION_OFFSETS (num_offsets));
|
|
||||||
memcpy (objfile->section_offsets, offsets,
|
|
||||||
SIZEOF_N_SECTION_OFFSETS (num_offsets));
|
|
||||||
objfile->num_sections = num_offsets;
|
|
||||||
|
|
||||||
/* What the hell is sym_new_init for, anyway? The concept of
|
/* What the hell is sym_new_init for, anyway? The concept of
|
||||||
distinguishing between the main file and additional files
|
distinguishing between the main file and additional files
|
||||||
in this way seems rather dubious. */
|
in this way seems rather dubious. */
|
||||||
@ -3705,7 +3674,7 @@ free_symfile_segment_data (struct symfile_segment_data *data)
|
|||||||
int
|
int
|
||||||
symfile_map_offsets_to_segments (bfd *abfd,
|
symfile_map_offsets_to_segments (bfd *abfd,
|
||||||
const struct symfile_segment_data *data,
|
const struct symfile_segment_data *data,
|
||||||
struct section_offsets *offsets,
|
section_offsets &offsets,
|
||||||
int num_segment_bases,
|
int num_segment_bases,
|
||||||
const CORE_ADDR *segment_bases)
|
const CORE_ADDR *segment_bases)
|
||||||
{
|
{
|
||||||
@ -3737,8 +3706,7 @@ symfile_map_offsets_to_segments (bfd *abfd,
|
|||||||
if (which > num_segment_bases)
|
if (which > num_segment_bases)
|
||||||
which = num_segment_bases;
|
which = num_segment_bases;
|
||||||
|
|
||||||
offsets->offsets[i] = (segment_bases[which - 1]
|
offsets[i] = segment_bases[which - 1] - data->segment_bases[which - 1];
|
||||||
- data->segment_bases[which - 1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -373,8 +373,7 @@ extern section_addr_info
|
|||||||
build_section_addr_info_from_objfile (const struct objfile *objfile);
|
build_section_addr_info_from_objfile (const struct objfile *objfile);
|
||||||
|
|
||||||
extern void relative_addr_info_to_section_offsets
|
extern void relative_addr_info_to_section_offsets
|
||||||
(struct section_offsets *section_offsets, int num_sections,
|
(section_offsets §ion_offsets, const section_addr_info &addrs);
|
||||||
const section_addr_info &addrs);
|
|
||||||
|
|
||||||
extern void addr_info_make_relative (section_addr_info *addrs,
|
extern void addr_info_make_relative (section_addr_info *addrs,
|
||||||
bfd *abfd);
|
bfd *abfd);
|
||||||
@ -515,7 +514,7 @@ extern bfd_byte *symfile_relocate_debug_section (struct objfile *, asection *,
|
|||||||
|
|
||||||
extern int symfile_map_offsets_to_segments (bfd *,
|
extern int symfile_map_offsets_to_segments (bfd *,
|
||||||
const struct symfile_segment_data *,
|
const struct symfile_segment_data *,
|
||||||
struct section_offsets *,
|
section_offsets &,
|
||||||
int, const CORE_ADDR *);
|
int, const CORE_ADDR *);
|
||||||
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
|
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
|
||||||
void free_symfile_segment_data (struct symfile_segment_data *data);
|
void free_symfile_segment_data (struct symfile_segment_data *data);
|
||||||
|
@ -240,8 +240,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
|
|||||||
/* Use the relocated address as shown in the symbol here -- do
|
/* Use the relocated address as shown in the symbol here -- do
|
||||||
not try to respect copy relocations. */
|
not try to respect copy relocations. */
|
||||||
CORE_ADDR addr = (msymbol->value.address
|
CORE_ADDR addr = (msymbol->value.address
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[msymbol->section]);
|
||||||
msymbol->section));
|
|
||||||
fputs_filtered (paddress (gdbarch, addr), outfile);
|
fputs_filtered (paddress (gdbarch, addr), outfile);
|
||||||
fprintf_filtered (outfile, " %s", msymbol->linkage_name ());
|
fprintf_filtered (outfile, " %s", msymbol->linkage_name ());
|
||||||
if (section)
|
if (section)
|
||||||
|
14
gdb/symtab.c
14
gdb/symtab.c
@ -1687,11 +1687,10 @@ fixup_section (struct general_symbol_info *ginfo,
|
|||||||
|
|
||||||
So, instead, search the section table when lookup by name has
|
So, instead, search the section table when lookup by name has
|
||||||
failed. The ``addr'' and ``endaddr'' fields may have already
|
failed. The ``addr'' and ``endaddr'' fields may have already
|
||||||
been relocated. If so, the relocation offset (i.e. the
|
been relocated. If so, the relocation offset needs to be
|
||||||
ANOFFSET value) needs to be subtracted from these values when
|
subtracted from these values when performing the comparison.
|
||||||
performing the comparison. We unconditionally subtract it,
|
We unconditionally subtract it, because, when no relocation
|
||||||
because, when no relocation has been performed, the ANOFFSET
|
has been performed, the value will simply be zero.
|
||||||
value will simply be zero.
|
|
||||||
|
|
||||||
The address of the symbol whose section we're fixing up HAS
|
The address of the symbol whose section we're fixing up HAS
|
||||||
NOT BEEN adjusted (relocated) yet. It can't have been since
|
NOT BEEN adjusted (relocated) yet. It can't have been since
|
||||||
@ -1717,7 +1716,7 @@ fixup_section (struct general_symbol_info *ginfo,
|
|||||||
ALL_OBJFILE_OSECTIONS (objfile, s)
|
ALL_OBJFILE_OSECTIONS (objfile, s)
|
||||||
{
|
{
|
||||||
int idx = s - objfile->sections;
|
int idx = s - objfile->sections;
|
||||||
CORE_ADDR offset = ANOFFSET (objfile->section_offsets, idx);
|
CORE_ADDR offset = objfile->section_offsets[idx];
|
||||||
|
|
||||||
if (fallback == -1)
|
if (fallback == -1)
|
||||||
fallback = idx;
|
fallback = idx;
|
||||||
@ -6373,8 +6372,7 @@ get_msymbol_address (struct objfile *objf, const struct minimal_symbol *minsym)
|
|||||||
return BMSYMBOL_VALUE_ADDRESS (found);
|
return BMSYMBOL_VALUE_ADDRESS (found);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (minsym->value.address
|
return minsym->value.address + objf->section_offsets[minsym->section];
|
||||||
+ ANOFFSET (objf->section_offsets, minsym->section));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
25
gdb/symtab.h
25
gdb/symtab.h
@ -726,7 +726,7 @@ extern CORE_ADDR get_msymbol_address (struct objfile *objf,
|
|||||||
#define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \
|
#define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \
|
||||||
(((symbol)->maybe_copied) ? get_msymbol_address (objfile, symbol) \
|
(((symbol)->maybe_copied) ? get_msymbol_address (objfile, symbol) \
|
||||||
: ((symbol)->value.address \
|
: ((symbol)->value.address \
|
||||||
+ ANOFFSET ((objfile)->section_offsets, ((symbol)->section))))
|
+ (objfile)->section_offsets[(symbol)->section]))
|
||||||
/* For a bound minsym, we can easily compute the address directly. */
|
/* For a bound minsym, we can easily compute the address directly. */
|
||||||
#define BMSYMBOL_VALUE_ADDRESS(symbol) \
|
#define BMSYMBOL_VALUE_ADDRESS(symbol) \
|
||||||
MSYMBOL_VALUE_ADDRESS ((symbol).objfile, (symbol).minsym)
|
MSYMBOL_VALUE_ADDRESS ((symbol).objfile, (symbol).minsym)
|
||||||
@ -1309,30 +1309,11 @@ struct linetable
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* How to relocate the symbols from each section in a symbol file.
|
/* How to relocate the symbols from each section in a symbol file.
|
||||||
Each struct contains an array of offsets.
|
|
||||||
The ordering and meaning of the offsets is file-type-dependent;
|
The ordering and meaning of the offsets is file-type-dependent;
|
||||||
typically it is indexed by section numbers or symbol types or
|
typically it is indexed by section numbers or symbol types or
|
||||||
something like that.
|
something like that. */
|
||||||
|
|
||||||
To give us flexibility in changing the internal representation
|
typedef std::vector<CORE_ADDR> section_offsets;
|
||||||
of these offsets, the ANOFFSET macro must be used to insert and
|
|
||||||
extract offset values in the struct. */
|
|
||||||
|
|
||||||
struct section_offsets
|
|
||||||
{
|
|
||||||
CORE_ADDR offsets[1]; /* As many as needed. */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define ANOFFSET(secoff, whichone) \
|
|
||||||
((whichone == -1) \
|
|
||||||
? (internal_error (__FILE__, __LINE__, \
|
|
||||||
_("Section index is uninitialized")), -1) \
|
|
||||||
: secoff->offsets[whichone])
|
|
||||||
|
|
||||||
/* The size of a section_offsets table for N sections. */
|
|
||||||
#define SIZEOF_N_SECTION_OFFSETS(n) \
|
|
||||||
(sizeof (struct section_offsets) \
|
|
||||||
+ sizeof (((struct section_offsets *) 0)->offsets) * ((n)-1))
|
|
||||||
|
|
||||||
/* Each source file or header is represented by a struct symtab.
|
/* Each source file or header is represented by a struct symtab.
|
||||||
The name "symtab" is historical, another name for it is "filetab".
|
The name "symtab" is historical, another name for it is "filetab".
|
||||||
|
@ -864,7 +864,7 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset,
|
|||||||
addr = (int_lnno.l_lnno
|
addr = (int_lnno.l_lnno
|
||||||
? int_lnno.l_addr.l_paddr
|
? int_lnno.l_addr.l_paddr
|
||||||
: read_symbol_nvalue (int_lnno.l_addr.l_symndx));
|
: read_symbol_nvalue (int_lnno.l_addr.l_symndx));
|
||||||
addr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
|
addr += objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
|
|
||||||
if (addr < startaddr || (endaddr && addr >= endaddr))
|
if (addr < startaddr || (endaddr && addr >= endaddr))
|
||||||
return;
|
return;
|
||||||
@ -1232,8 +1232,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
file_start_addr =
|
file_start_addr =
|
||||||
cs->c_value + ANOFFSET (objfile->section_offsets,
|
cs->c_value + objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
|
file_end_addr = file_start_addr + CSECT_LEN (&main_aux);
|
||||||
|
|
||||||
if (cs->c_name && (cs->c_name[0] == '.' || cs->c_name[0] == '@'))
|
if (cs->c_name && (cs->c_name[0] == '.' || cs->c_name[0] == '@'))
|
||||||
@ -1355,8 +1354,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
|||||||
case C_FCN:
|
case C_FCN:
|
||||||
if (strcmp (cs->c_name, ".bf") == 0)
|
if (strcmp (cs->c_name, ".bf") == 0)
|
||||||
{
|
{
|
||||||
CORE_ADDR off = ANOFFSET (objfile->section_offsets,
|
CORE_ADDR off = objfile->section_offsets[SECT_OFF_TEXT (objfile)];
|
||||||
SECT_OFF_TEXT (objfile));
|
|
||||||
|
|
||||||
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
bfd_coff_swap_aux_in (abfd, raw_auxptr, cs->c_type, cs->c_sclass,
|
||||||
0, cs->c_naux, &main_aux);
|
0, cs->c_naux, &main_aux);
|
||||||
@ -1400,8 +1398,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
|||||||
NULL, cstk.start_addr,
|
NULL, cstk.start_addr,
|
||||||
(fcn_cs_saved.c_value
|
(fcn_cs_saved.c_value
|
||||||
+ fcn_aux_saved.x_sym.x_misc.x_fsize
|
+ fcn_aux_saved.x_sym.x_misc.x_fsize
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
|
||||||
SECT_OFF_TEXT (objfile))));
|
|
||||||
within_function = 0;
|
within_function = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1468,8 +1465,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
|||||||
depth++;
|
depth++;
|
||||||
newobj = push_context (depth,
|
newobj = push_context (depth,
|
||||||
(cs->c_value
|
(cs->c_value
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
|
||||||
SECT_OFF_TEXT (objfile))));
|
|
||||||
}
|
}
|
||||||
else if (strcmp (cs->c_name, ".eb") == 0)
|
else if (strcmp (cs->c_name, ".eb") == 0)
|
||||||
{
|
{
|
||||||
@ -1491,8 +1487,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
|||||||
cstk.old_blocks, NULL,
|
cstk.old_blocks, NULL,
|
||||||
cstk.start_addr,
|
cstk.start_addr,
|
||||||
(cs->c_value
|
(cs->c_value
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[SECT_OFF_TEXT (objfile)]));
|
||||||
SECT_OFF_TEXT (objfile))));
|
|
||||||
}
|
}
|
||||||
*get_local_symbols () = cstk.locals;
|
*get_local_symbols () = cstk.locals;
|
||||||
}
|
}
|
||||||
@ -1554,7 +1549,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sec = secnum_to_section (cs->c_secnum, objfile);
|
sec = secnum_to_section (cs->c_secnum, objfile);
|
||||||
off = ANOFFSET (objfile->section_offsets, sec);
|
off = objfile->section_offsets[sec];
|
||||||
}
|
}
|
||||||
|
|
||||||
name = cs->c_name;
|
name = cs->c_name;
|
||||||
@ -1657,8 +1652,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
|
|||||||
if (*pp == 'V' && !within_function)
|
if (*pp == 'V' && !within_function)
|
||||||
*pp = 'S';
|
*pp = 'S';
|
||||||
sym = define_symbol ((cs->c_value
|
sym = define_symbol ((cs->c_value
|
||||||
+ ANOFFSET (objfile->section_offsets,
|
+ objfile->section_offsets[static_block_section]),
|
||||||
static_block_section)),
|
|
||||||
cs->c_name, 0, 0, objfile);
|
cs->c_name, 0, 0, objfile);
|
||||||
if (sym != NULL)
|
if (sym != NULL)
|
||||||
{
|
{
|
||||||
@ -3024,7 +3018,7 @@ xcoff_symfile_offsets (struct objfile *objfile,
|
|||||||
us to test whether the associated section exists or not, and then
|
us to test whether the associated section exists or not, and then
|
||||||
access it quickly (without searching it again). */
|
access it quickly (without searching it again). */
|
||||||
|
|
||||||
if (objfile->num_sections == 0)
|
if (objfile->section_offsets.empty ())
|
||||||
return; /* Is that even possible? Better safe than sorry. */
|
return; /* Is that even possible? Better safe than sorry. */
|
||||||
|
|
||||||
first_section_name = bfd_section_name (objfile->sections[0].the_bfd_section);
|
first_section_name = bfd_section_name (objfile->sections[0].the_bfd_section);
|
||||||
|
Loading…
Reference in New Issue
Block a user