/* Handle SVR4 shared libraries for GDB, the GNU Debugger.
- Copyright (C) 1990-2019 Free Software Foundation, Inc.
+ Copyright (C) 1990-2020 Free Software Foundation, Inc.
This file is part of GDB.
CORE_ADDR
svr4_fetch_objfile_link_map (struct objfile *objfile)
{
- struct so_list *so;
struct svr4_info *info = get_svr4_info (objfile->pspace);
/* Cause svr4_current_sos() to be run if it hasn't been already. */
/* The other link map addresses may be found by examining the list
of shared libraries. */
- for (so = master_so_list (); so; so = so->next)
+ for (struct so_list *so : current_program_space->solibs ())
if (so->objfile == objfile)
{
lm_info_svr4 *li = (lm_info_svr4 *) so->lm_info;
CORE_ADDR load_addr;
tmp_bfd = os->objfile->obfd;
- load_addr = ANOFFSET (os->objfile->section_offsets,
- SECT_OFF_TEXT (os->objfile));
+ load_addr = os->objfile->text_section_offset ();
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
if (interp_sect)
CORE_ADDR load_addr = 0;
int load_addr_found = 0;
int loader_found_in_list = 0;
- struct so_list *so;
struct target_ops *tmp_bfd_target;
sym_addr = 0;
/* On a running target, we can get the dynamic linker's base
address from the shared library table. */
- so = master_so_list ();
- while (so)
+ for (struct so_list *so : current_program_space->solibs ())
{
if (svr4_same_1 (interp_name, so->so_original_name))
{
load_addr = lm_addr_check (so, tmp_bfd.get ());
break;
}
- so = so->next;
}
/* If we were not able to find the base address of the loader
if (!load_addr_found)
{
struct regcache *regcache
- = get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
+ = get_thread_arch_regcache (current_inferior ()->process_target (),
+ inferior_ptid, target_gdbarch ());
load_addr = (regcache_read_pc (regcache)
- exec_entry_point (tmp_bfd.get (), tmp_bfd_target));
if (symfile_objfile)
{
- struct section_offsets *new_offsets;
- int i;
-
- new_offsets = XALLOCAVEC (struct section_offsets,
- symfile_objfile->num_sections);
-
- for (i = 0; i < symfile_objfile->num_sections; i++)
- new_offsets->offsets[i] = displacement;
-
+ section_offsets new_offsets (symfile_objfile->section_offsets.size (),
+ displacement);
objfile_relocate (symfile_objfile, new_offsets);
}
else if (exec_bfd)
}
}
+void _initialize_svr4_solib ();
void
-_initialize_svr4_solib (void)
+_initialize_svr4_solib ()
{
solib_svr4_data = gdbarch_data_register_pre_init (solib_svr4_init);