/* Handle TIC6X (DSBT) shared libraries for GDB, the GNU Debugger.
- Copyright (C) 2010-2020 Free Software Foundation, Inc.
+ Copyright (C) 2010-2021 Free Software Foundation, Inc.
This file is part of GDB.
Elf32_External_Dyn *x_dynp_32;
Elf64_External_Dyn *x_dynp_64;
struct bfd_section *sect;
- struct target_section *target_section;
if (abfd == NULL)
return 0;
if (sect == NULL)
return 0;
- for (target_section = current_target_sections->sections;
- target_section < current_target_sections->sections_end;
- target_section++)
- if (sect == target_section->the_bfd_section)
- break;
- if (target_section < current_target_sections->sections_end)
- dyn_addr = target_section->addr;
- else
+ bool found = false;
+ for (const target_section &target_section
+ : current_program_space->target_sections ())
+ if (sect == target_section.the_bfd_section)
+ {
+ dyn_addr = target_section.addr;
+ found = true;
+ break;
+ }
+ if (!found)
{
/* ABFD may come from OBJFILE acting only as a symbol file without being
loaded into the target (see add_symbol_file_command). This case is
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)
{
"lm_base: get addr %x by _GLOBAL_OFFSET_TABLE_.\n",
(unsigned int) addr);
}
- else if (scan_dyntag (DT_PLTGOT, exec_bfd, &addr))
+ else if (scan_dyntag (DT_PLTGOT, current_program_space->exec_bfd (), &addr))
{
struct int_elf32_dsbt_loadmap *ldm;
this in the list of shared objects. */
if (dsbt_index != 0)
{
- int errcode;
- gdb::unique_xmalloc_ptr<char> name_buf;
struct int_elf32_dsbt_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 (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
{
if (solib_dsbt_debug)
asection *interp_sect;
struct dsbt_info *info;
- if (exec_bfd == NULL)
+ if (current_program_space->exec_bfd () == NULL)
return 0;
- if (!target_has_execution)
+ if (!target_has_execution ())
return 0;
info = get_dsbt_info ();
/* Find the .interp section; if not found, warn the user and drop
into the old breakpoint at symbol code. */
- interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
+ interp_sect = bfd_get_section_by_name (current_program_space->exec_bfd (),
+ ".interp");
if (interp_sect)
{
unsigned int interp_sect_size;
the contents specify the dynamic linker this program uses. */
interp_sect_size = bfd_section_size (interp_sect);
buf = (char *) alloca (interp_sect_size);
- bfd_get_section_contents (exec_bfd, interp_sect,
- buf, 0, interp_sect_size);
+ bfd_get_section_contents (current_program_space->exec_bfd (),
+ interp_sect, buf, 0, interp_sect_size);
/* Now we need to figure out where the dynamic linker was
loaded so that we can load its symbols and place a breakpoint
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