/* Handle FR-V (FDPIC) shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
+ Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of GDB.
this in the list of shared objects. */
if (got_addr != mgot)
{
- int errcode;
- gdb::unique_xmalloc_ptr<char> name_buf;
struct int_elf32_fdpic_loadmap *loadmap;
struct so_list *sop;
CORE_ADDR addr;
addr = extract_unsigned_integer (lm_buf.l_name,
sizeof (lm_buf.l_name),
byte_order);
- target_read_string (addr, &name_buf, SO_NAME_MAX_PATH_SIZE - 1,
- &errcode);
+ gdb::unique_xmalloc_ptr<char> name_buf
+ = target_read_string (addr, SO_NAME_MAX_PATH_SIZE - 1);
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog, "current_sos: name = %s\n",
name_buf.get ());
- if (errcode != 0)
- warning (_("Can't read pathname for link map entry: %s."),
- safe_strerror (errcode));
+ if (name_buf == nullptr)
+ warning (_("Can't read pathname for link map entry."));
else
{
strncpy (sop->so_name, name_buf.get (),
main_executable_lm_info = new lm_info_frv;
main_executable_lm_info->map = ldm;
- gdb::unique_xmalloc_ptr<struct section_offsets> new_offsets
- (XCNEWVEC (struct section_offsets, symfile_objfile->num_sections));
+ section_offsets new_offsets (symfile_objfile->section_offsets.size ());
changed = 0;
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect)
/* Current address of section. */
addr = obj_section_addr (osect);
/* 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. */
orig_addr = addr - offset;
if (ldm->segs[seg].p_vaddr <= orig_addr
&& 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;
- if (new_offsets->offsets[osect_idx] != offset)
+ if (new_offsets[osect_idx] != offset)
changed = 1;
break;
}
}
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
GOT value and stash it away. */
CORE_ADDR
frv_fdpic_find_global_pointer (CORE_ADDR addr)
{
- struct so_list *so;
-
- so = master_so_list ();
- while (so)
+ for (struct so_list *so : current_program_space->solibs ())
{
int seg;
lm_info_frv *li = (lm_info_frv *) so->lm_info;
&& addr < map->segs[seg].addr + map->segs[seg].p_memsz)
return li->got_value;
}
-
- so = so->next;
}
/* Didn't find it in any of the shared objects. So assume it's in the
if (sym == 0)
name = 0;
else
- name = SYMBOL_LINKAGE_NAME (sym);
+ name = sym->linkage_name ();
/* Check the main executable. */
addr = find_canonical_descriptor_in_load_object
in list of shared objects. */
if (addr == 0)
{
- struct so_list *so;
-
- so = master_so_list ();
- while (so)
+ for (struct so_list *so : current_program_space->solibs ())
{
lm_info_frv *li = (lm_info_frv *) so->lm_info;
if (addr != 0)
break;
-
- so = so->next;
}
}
CORE_ADDR
frv_fetch_objfile_link_map (struct objfile *objfile)
{
- struct so_list *so;
-
/* Cause frv_current_sos() to be run if it hasn't been already. */
if (main_lm_addr == 0)
solib_add (0, 0, 1);
/* 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 ())
{
lm_info_frv *li = (lm_info_frv *) so->lm_info;
struct target_so_ops frv_so_ops;
+void _initialize_frv_solib ();
void
-_initialize_frv_solib (void)
+_initialize_frv_solib ()
{
frv_so_ops.relocate_section_addresses = frv_relocate_section_addresses;
frv_so_ops.free_so = frv_free_so;