open_symbol_file_object (int from_tty)
{
CORE_ADDR lm, l_name;
- gdb::unique_xmalloc_ptr<char> filename;
- int errcode;
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
struct type *ptr_type = builtin_type (target_gdbarch ())->builtin_data_ptr;
int l_name_size = TYPE_LENGTH (ptr_type);
return 0; /* No filename. */
/* Now fetch the filename from target memory. */
- target_read_string (l_name, &filename, SO_NAME_MAX_PATH_SIZE - 1, &errcode);
+ gdb::unique_xmalloc_ptr<char> filename
+ = target_read_string (l_name, SO_NAME_MAX_PATH_SIZE - 1);
- if (errcode)
+ if (filename == nullptr)
{
- warning (_("failed to read exec filename from attached file: %s"),
- safe_strerror (errcode));
+ warning (_("failed to read exec filename from attached file"));
return 0;
}
for (; lm != 0; prev_lm = lm, lm = next_lm)
{
- int errcode;
- gdb::unique_xmalloc_ptr<char> buffer;
-
so_list_up newobj (XCNEW (struct so_list));
lm_info_svr4 *li = lm_info_read (lm).release ();
}
/* Extract this shared object's name. */
- target_read_string (li->l_name, &buffer, SO_NAME_MAX_PATH_SIZE - 1,
- &errcode);
- if (errcode != 0)
+ gdb::unique_xmalloc_ptr<char> buffer
+ = target_read_string (li->l_name, SO_NAME_MAX_PATH_SIZE - 1);
+ if (buffer == nullptr)
{
/* If this entry's l_name address matches that of the
inferior executable, then this is not a normal shared
object, but (most likely) a vDSO. In this case, silently
skip it; otherwise emit a warning. */
if (first_l_name == 0 || li->l_name != first_l_name)
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
+ warning (_("Can't read pathname for load map."));
continue;
}
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 = 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));
}
}
+void _initialize_svr4_solib ();
void
-_initialize_svr4_solib (void)
+_initialize_svr4_solib ()
{
solib_svr4_data = gdbarch_data_register_pre_init (solib_svr4_init);