/* Create the per-BFD storage object for OBJFILE. If ABFD is not
NULL, and it already has a per-BFD storage object, use that.
- Otherwise, allocate a new per-BFD storage object. Note that it is
- not safe to call this multiple times for a given OBJFILE -- it can
- only be called when allocating or re-initializing OBJFILE. */
+ Otherwise, allocate a new per-BFD storage object. */
static struct objfile_per_bfd_storage *
-get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
+get_objfile_bfd_data (bfd *abfd)
{
struct objfile_per_bfd_storage *storage = NULL;
if (storage == NULL)
{
- storage = new objfile_per_bfd_storage;
+ storage = new objfile_per_bfd_storage (abfd);
/* If the object requires gdb to do relocations, we simply fall
back to not sharing data across users. These cases are rare
enough that this seems reasonable. */
void
set_objfile_per_bfd (struct objfile *objfile)
{
- objfile->per_bfd = get_objfile_bfd_data (objfile, objfile->obfd);
+ objfile->per_bfd = get_objfile_bfd_data (objfile->obfd);
}
/* Set the objfile's per-BFD notion of the "main" name and
objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
: flags (flags_),
pspace (current_program_space),
- partial_symtabs (new psymtab_storage ()),
obfd (abfd)
{
const char *expanded_name;
build_objfile_section_table (this);
}
- per_bfd = get_objfile_bfd_data (this, abfd);
+ per_bfd = get_objfile_bfd_data (abfd);
}
/* If there is a valid and known entry point, function fills *ENTRY_P with it
}
}
- /* This stores relocated addresses and so must be cleared. This
- will cause it to be recreated on demand. */
- objfile->psymbol_map.clear ();
+ /* Notify the quick symbol object. */
+ for (const auto &iter : objfile->qf)
+ iter->relocated ();
/* Relocate isolated symbols. */
{
int idx = s - objfile->sections;
exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
- obj_section_addr (s));
+ s->addr ());
}
/* Data changed. */
static bool
sort_cmp (const struct obj_section *sect1, const obj_section *sect2)
{
- const CORE_ADDR sect1_addr = obj_section_addr (sect1);
- const CORE_ADDR sect2_addr = obj_section_addr (sect2);
+ const CORE_ADDR sect1_addr = sect1->addr ();
+ const CORE_ADDR sect2_addr = sect2->addr ();
if (sect1_addr < sect2_addr)
return true;
static struct obj_section *
preferred_obj_section (struct obj_section *a, struct obj_section *b)
{
- gdb_assert (obj_section_addr (a) == obj_section_addr (b));
+ gdb_assert (a->addr () == b->addr ());
gdb_assert ((a->objfile->separate_debug_objfile == b->objfile)
|| (b->objfile->separate_debug_objfile == a->objfile));
gdb_assert ((a->objfile->separate_debug_objfile_backlink == b->objfile)
struct obj_section *const sect2 = map[i + 1];
const struct objfile *const objfile1 = sect1->objfile;
const struct objfile *const objfile2 = sect2->objfile;
- const CORE_ADDR sect1_addr = obj_section_addr (sect1);
- const CORE_ADDR sect2_addr = obj_section_addr (sect2);
+ const CORE_ADDR sect1_addr = sect1->addr ();
+ const CORE_ADDR sect2_addr = sect2->addr ();
if (sect1_addr == sect2_addr
&& (objfile1->separate_debug_objfile == objfile2
{
struct obj_section *const sect1 = map[i];
struct obj_section *const sect2 = map[k];
- const CORE_ADDR sect1_addr = obj_section_addr (sect1);
- const CORE_ADDR sect2_addr = obj_section_addr (sect2);
- const CORE_ADDR sect1_endaddr = obj_section_endaddr (sect1);
+ const CORE_ADDR sect1_addr = sect1->addr ();
+ const CORE_ADDR sect2_addr = sect2->addr ();
+ const CORE_ADDR sect1_endaddr = sect1->endaddr ();
gdb_assert (sect1_addr <= sect2_addr);
const struct bfd_section *const bfds1 = sect1->the_bfd_section;
const struct bfd_section *const bfds2 = sect2->the_bfd_section;
- const CORE_ADDR sect2_endaddr = obj_section_endaddr (sect2);
+ const CORE_ADDR sect2_endaddr = sect2->endaddr ();
struct gdbarch *const gdbarch = objf1->arch ();
const CORE_ADDR pc = *(CORE_ADDR *) key;
const struct obj_section *section = *(const struct obj_section **) elt;
- if (pc < obj_section_addr (section))
+ if (pc < section->addr ())
return -1;
- if (pc < obj_section_endaddr (section))
+ if (pc < section->endaddr ())
return 0;
return 1;
}
if (section_is_overlay (osect) && !section_is_mapped (osect))
continue;
- if (obj_section_addr (osect) <= addr
- && addr < obj_section_endaddr (osect))
+ if (osect->addr () <= addr && addr < osect->endaddr ())
return true;
}
return false;