+2020-10-29 Tom Tromey <tom@tromey.com>
+
+ * windows-tdep.c (windows_solib_create_inferior_hook): Update.
+ * target.c (info_target_command): Update.
+ * symfile.c (syms_from_objfile_1, finish_new_objfile)
+ (symbol_file_clear, reread_symbols): Update.
+ * symfile-mem.c (add_symbol_file_from_memory_command): Update.
+ * stabsread.c (scan_file_globals): Update.
+ * solib.c (update_solib_list): Update.
+ * solib-svr4.c (elf_locate_base, open_symbol_file_object)
+ (svr4_fetch_objfile_link_map, enable_break)
+ (svr4_relocate_main_executable)
+ (svr4_iterate_over_objfiles_in_search_order): Update.
+ * solib-frv.c (lm_base, enable_break)
+ (frv_relocate_main_executable): Update.
+ (main_got, frv_fdpic_find_canonical_descriptor): Update.
+ (frv_fetch_objfile_link_map): Update.
+ * solib-dsbt.c (lm_base, dsbt_relocate_main_executable): Update.
+ * solib-darwin.c (darwin_solib_create_inferior_hook): Update.
+ * solib-aix.c (solib_aix_solib_create_inferior_hook): Update.
+ * remote.c (remote_target::get_offsets): Update.
+ (remote_target::start_remote)
+ (extended_remote_target::post_attach): Update.
+ * objfiles.c (entry_point_address_query): Update.
+ * nto-procfs.c (nto_procfs_target::create_inferior): Update.
+ * minsyms.c (get_symbol_leading_char): Update.
+ * frame.c (inside_main_func): Update.
+ * progspace.h (symfile_objfile): Remove macro.
+
2020-10-29 Tom Tromey <tom@tromey.com>
* exec.c (exec_file_attach): Update.
static bool
inside_main_func (frame_info *this_frame)
{
- if (symfile_objfile == nullptr)
+ if (current_program_space->symfile_object_file == nullptr)
return false;
CORE_ADDR sym_addr;
const char *name = main_name ();
bound_minimal_symbol msymbol
- = lookup_minimal_symbol (name, NULL, symfile_objfile);
+ = lookup_minimal_symbol (name, NULL,
+ current_program_space->symfile_object_file);
if (msymbol.minsym == nullptr)
{
/* In some language (for example Fortran) there will be no minimal
{
if (abfd != NULL)
return bfd_get_symbol_leading_char (abfd);
- if (symfile_objfile != NULL && symfile_objfile->obfd != NULL)
- return bfd_get_symbol_leading_char (symfile_objfile->obfd);
+ if (current_program_space->symfile_object_file != NULL)
+ {
+ objfile *objf = current_program_space->symfile_object_file;
+ if (objf->obfd != NULL)
+ return bfd_get_symbol_leading_char (objf->obfd);
+ }
return 0;
}
target_terminal::init ();
if (current_program_space->exec_bfd () != NULL
- || (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
+ || (current_program_space->symfile_object_file != NULL
+ && current_program_space->symfile_object_file->obfd != NULL))
solib_create_inferior_hook (0);
}
int
entry_point_address_query (CORE_ADDR *entry_p)
{
- if (symfile_objfile == NULL || !symfile_objfile->per_bfd->ei.entry_point_p)
+ objfile *objf = current_program_space->symfile_object_file;
+ if (objf == NULL || !objf->per_bfd->ei.entry_point_p)
return 0;
- int idx = symfile_objfile->per_bfd->ei.the_bfd_section_index;
- *entry_p = (symfile_objfile->per_bfd->ei.entry_point
- + symfile_objfile->section_offsets[idx]);
+ int idx = objf->per_bfd->ei.the_bfd_section_index;
+ *entry_p = objf->per_bfd->ei.entry_point + objf->section_offsets[idx];
return 1;
}
REGISTRY_FIELDS;
};
-/* The object file that the main symbol table was loaded from (e.g. the
- argument to the "symbol-file" or "file" command). */
-
-#define symfile_objfile current_program_space->symfile_object_file
-
/* The list of all program spaces. There's always at least one. */
extern std::vector<struct program_space *>program_spaces;
int lose, num_segments = 0, do_sections, do_segments;
CORE_ADDR text_addr, data_addr, bss_addr, segments[2];
- if (symfile_objfile == NULL)
+ if (current_program_space->symfile_object_file == NULL)
return;
putpkt ("qOffsets");
else if (*ptr != '\0')
warning (_("Target reported unsupported offsets: %s"), buf);
- section_offsets offs = symfile_objfile->section_offsets;
+ objfile *objf = current_program_space->symfile_object_file;
+ section_offsets offs = objf->section_offsets;
- symfile_segment_data_up data
- = get_symfile_segment_data (symfile_objfile->obfd);
+ symfile_segment_data_up data = get_symfile_segment_data (objf->obfd);
do_segments = (data != NULL);
do_sections = num_segments == 0;
if (do_segments)
{
- int ret = symfile_map_offsets_to_segments (symfile_objfile->obfd,
+ int ret = symfile_map_offsets_to_segments (objf->obfd,
data.get (), offs,
num_segments, segments);
if (do_sections)
{
- offs[SECT_OFF_TEXT (symfile_objfile)] = text_addr;
+ offs[SECT_OFF_TEXT (objf)] = text_addr;
/* This is a temporary kludge to force data and bss to use the
same offsets because that's what nlmconv does now. The real
solution requires changes to the stub and remote.c that I
don't have time to do right now. */
- offs[SECT_OFF_DATA (symfile_objfile)] = data_addr;
- offs[SECT_OFF_BSS (symfile_objfile)] = data_addr;
+ offs[SECT_OFF_DATA (objf)] = data_addr;
+ offs[SECT_OFF_BSS (objf)] = data_addr;
}
- objfile_relocate (symfile_objfile, offs);
+ objfile_relocate (objf, offs);
}
/* Send interrupt_sequence to remote target. */
/* If we connected to a live target, do some additional setup. */
if (target_has_execution ())
{
- if (symfile_objfile) /* No use without a symbol-file. */
+ /* No use without a symbol-file. */
+ if (current_program_space->symfile_object_file)
remote_check_symbols ();
}
binary is not using shared libraries, the vsyscall page is not
present (on Linux) and the binary itself hadn't changed since the
debugging process was started. */
- if (symfile_objfile != NULL)
+ if (current_program_space->symfile_object_file != NULL)
remote_check_symbols();
}
}
lm_info_aix &exec_info = (*library_list)[0];
- if (symfile_objfile != NULL)
+ if (current_program_space->symfile_object_file != NULL)
{
- section_offsets offsets
- = solib_aix_get_section_offsets (symfile_objfile, &exec_info);
+ objfile *objf = current_program_space->symfile_object_file;
+ section_offsets offsets = solib_aix_get_section_offsets (objf,
+ &exec_info);
- objfile_relocate (symfile_objfile, offsets);
+ objfile_relocate (objf, offsets);
}
}
load_addr = darwin_read_exec_load_addr_at_init (info);
}
- if (load_addr != 0 && symfile_objfile != NULL)
+ if (load_addr != 0 && current_program_space->symfile_object_file != NULL)
{
CORE_ADDR vmaddr;
/* Relocate. */
if (vmaddr != load_addr)
- objfile_rebase (symfile_objfile, load_addr - vmaddr);
+ objfile_rebase (current_program_space->symfile_object_file,
+ load_addr - vmaddr);
}
/* Set solib notifier (to reload list of shared libraries). */
return info->lm_base_cache;
got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
- symfile_objfile);
+ current_program_space->symfile_object_file);
if (got_sym.minsym != 0)
{
info->main_executable_lm_info = new lm_info_dsbt;
info->main_executable_lm_info->map = ldm;
- section_offsets new_offsets (symfile_objfile->section_offsets.size ());
+ objfile *objf = current_program_space->symfile_object_file;
+ section_offsets new_offsets (objf->section_offsets.size ());
changed = 0;
- ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
+ ALL_OBJFILE_OSECTIONS (objf, osect)
{
CORE_ADDR orig_addr, addr, offset;
int osect_idx;
int seg;
- osect_idx = osect - symfile_objfile->sections;
+ osect_idx = osect - objf->sections;
/* Current address of section. */
addr = obj_section_addr (osect);
/* Offset from where this section started. */
- offset = symfile_objfile->section_offsets[osect_idx];
+ offset = objf->section_offsets[osect_idx];
/* Original address prior to any past relocations. */
orig_addr = addr - offset;
}
if (changed)
- objfile_relocate (symfile_objfile, new_offsets);
+ objfile_relocate (objf, new_offsets);
- /* Now that symfile_objfile has been relocated, we can compute the
- GOT value and stash it away. */
+ /* Now that OBJF has been relocated, we can compute the GOT value
+ and stash it away. */
}
/* When gdb starts up the inferior, it nurses it along (through the
return lm_base_cache;
got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
- symfile_objfile);
+ current_program_space->symfile_object_file);
if (got_sym.minsym == 0)
{
if (solib_frv_debug)
asection *interp_sect;
CORE_ADDR entry_point;
- if (symfile_objfile == NULL)
+ if (current_program_space->symfile_object_file == NULL)
{
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
main_executable_lm_info = new lm_info_frv;
main_executable_lm_info->map = ldm;
- section_offsets new_offsets (symfile_objfile->section_offsets.size ());
+ objfile *objf = current_program_space->symfile_object_file;
+ section_offsets new_offsets (objf->section_offsets.size ());
changed = 0;
- ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
+ ALL_OBJFILE_OSECTIONS (objf, osect)
{
CORE_ADDR orig_addr, addr, offset;
int osect_idx;
int seg;
- osect_idx = osect - symfile_objfile->sections;
+ osect_idx = osect - objf->sections;
/* Current address of section. */
addr = obj_section_addr (osect);
/* Offset from where this section started. */
- offset = symfile_objfile->section_offsets[osect_idx];
+ offset = objf->section_offsets[osect_idx];
/* Original address prior to any past relocations. */
orig_addr = addr - offset;
}
if (changed)
- objfile_relocate (symfile_objfile, new_offsets);
+ objfile_relocate (objf, new_offsets);
- /* Now that symfile_objfile has been relocated, we can compute the
- GOT value and stash it away. */
+ /* Now that OBJF has been relocated, we can compute the GOT value
+ and stash it away. */
main_executable_lm_info->got_value = main_got ();
}
{
struct bound_minimal_symbol got_sym;
- got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_",
- NULL, symfile_objfile);
+ objfile *objf = current_program_space->symfile_object_file;
+ got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, objf);
if (got_sym.minsym == 0)
return 0;
name = sym->linkage_name ();
/* Check the main executable. */
+ objfile *objf = current_program_space->symfile_object_file;
addr = find_canonical_descriptor_in_load_object
- (entry_point, got_value, name, symfile_objfile->obfd,
+ (entry_point, got_value, name, objf->obfd,
main_executable_lm_info);
/* If descriptor not found via main executable, check each load object
solib_add (0, 0, 1);
/* frv_current_sos() will set main_lm_addr for the main executable. */
- if (objfile == symfile_objfile)
+ if (objfile == current_program_space->symfile_object_file)
return main_lm_addr;
/* The other link map addresses may be found by examining the list
/* This may be a static executable. Look for the symbol
conventionally named _r_debug, as a last resort. */
- msymbol = lookup_minimal_symbol ("_r_debug", NULL, symfile_objfile);
+ msymbol = lookup_minimal_symbol ("_r_debug", NULL,
+ current_program_space->symfile_object_file);
if (msymbol.minsym != NULL)
return BMSYMBOL_VALUE_ADDRESS (msymbol);
if (from_tty)
add_flags |= SYMFILE_VERBOSE;
- if (symfile_objfile)
+ if (current_program_space->symfile_object_file)
if (!query (_("Attempt to reload symbols from process? ")))
return 0;
solib_add (NULL, 0, auto_solib_add);
/* svr4_current_sos() will set main_lm_addr for the main executable. */
- if (objfile == symfile_objfile)
+ if (objfile == current_program_space->symfile_object_file)
return info->main_lm_addr;
/* If OBJFILE is a separate debug object file, look for the
/* Scan through the lists of symbols, trying to look up the symbol and
set a breakpoint there. Terminate loop when we/if we succeed. */
+ objfile *objf = current_program_space->symfile_object_file;
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
- msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
+ msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf);
if ((msymbol.minsym != NULL)
&& (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0))
{
{
for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
{
- msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
+ msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf);
if ((msymbol.minsym != NULL)
&& (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0))
{
/* Even DISPLACEMENT 0 is a valid new difference of in-memory vs. in-file
addresses. */
- if (symfile_objfile)
+ objfile *objf = current_program_space->symfile_object_file;
+ if (objf)
{
- section_offsets new_offsets (symfile_objfile->section_offsets.size (),
+ section_offsets new_offsets (objf->section_offsets.size (),
displacement);
- objfile_relocate (symfile_objfile, new_offsets);
+ objfile_relocate (objf, new_offsets);
}
else if (current_program_space->exec_bfd ())
{
if (current_objfile->separate_debug_objfile_backlink != nullptr)
current_objfile = current_objfile->separate_debug_objfile_backlink;
- if (current_objfile == symfile_objfile)
+ if (current_objfile == current_program_space->symfile_object_file)
abfd = current_program_space->exec_bfd ();
else
abfd = current_objfile->obfd;
/* If we are attaching to a running process for which we
have not opened a symbol file, we may be able to get its
symbols now! */
- if (inf->attach_flag && symfile_objfile == NULL)
+ if (inf->attach_flag
+ && current_program_space->symfile_object_file == NULL)
{
try
{
If we are scanning the symbols for a shared library, try to resolve
them from the minimal symbols of the main executable first. */
- if (symfile_objfile && objfile != symfile_objfile)
- resolve_objfile = symfile_objfile;
+ if (current_program_space->symfile_object_file
+ && objfile != current_program_space->symfile_object_file)
+ resolve_objfile = current_program_space->symfile_object_file;
else
resolve_objfile = objfile;
addr = parse_and_eval_address (args);
/* We need some representative bfd to know the target we are looking at. */
- if (symfile_objfile != NULL)
- templ = symfile_objfile->obfd;
+ if (current_program_space->symfile_object_file != NULL)
+ templ = current_program_space->symfile_object_file->obfd;
else
templ = current_program_space->exec_bfd ();
if (templ == NULL)
/* Since no error yet, throw away the old symbol table. */
- if (symfile_objfile != NULL)
+ if (current_program_space->symfile_object_file != NULL)
{
- symfile_objfile->unlink ();
- gdb_assert (symfile_objfile == NULL);
+ current_program_space->symfile_object_file->unlink ();
+ gdb_assert (current_program_space->symfile_object_file == NULL);
}
/* Currently we keep symbols from the add-symbol-file command.
if (add_flags & SYMFILE_MAINLINE)
{
/* OK, make it the "real" symbol file. */
- symfile_objfile = objfile;
+ current_program_space->symfile_object_file = objfile;
clear_symtab_users (add_flags);
}
{
if ((have_full_symbols () || have_partial_symbols ())
&& from_tty
- && (symfile_objfile
+ && (current_program_space->symfile_object_file
? !query (_("Discard symbol table from `%s'? "),
- objfile_name (symfile_objfile))
+ objfile_name (current_program_space->symfile_object_file))
: !query (_("Discard symbol table? "))))
error (_("Not confirmed."));
clear_symtab_users (0);
- gdb_assert (symfile_objfile == NULL);
+ gdb_assert (current_program_space->symfile_object_file == NULL);
if (from_tty)
printf_filtered (_("No symbol file now.\n"));
}
/* What the hell is sym_new_init for, anyway? The concept of
distinguishing between the main file and additional files
in this way seems rather dubious. */
- if (objfile == symfile_objfile)
+ if (objfile == current_program_space->symfile_object_file)
{
(*objfile->sf->sym_new_init) (objfile);
}
{
int has_all_mem = 0;
- if (symfile_objfile != NULL)
- printf_unfiltered (_("Symbols from \"%s\".\n"),
- objfile_name (symfile_objfile));
+ if (current_program_space->symfile_object_file != NULL)
+ {
+ objfile *objf = current_program_space->symfile_object_file;
+ printf_unfiltered (_("Symbols from \"%s\".\n"),
+ objfile_name (objf));
+ }
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{
}
/* Rebase executable if the base address changed because of ASLR. */
- if (symfile_objfile != nullptr && exec_base != 0)
+ if (current_program_space->symfile_object_file != nullptr && exec_base != 0)
{
CORE_ADDR vmaddr
= pe_data (current_program_space->exec_bfd ())->pe_opthdr.ImageBase;
if (vmaddr != exec_base)
- objfile_rebase (symfile_objfile, exec_base - vmaddr);
+ objfile_rebase (current_program_space->symfile_object_file,
+ exec_base - vmaddr);
}
}