38#include "gdbsupport/gdb_obstack.h"
53#include "gdbsupport/pathstuff.h"
176 return htab_hash_pointer (e->
block);
214 gdb_assert (*slot == NULL);
217 entry->block =
block;
219 *slot = (
void *) entry;
240 gdb_assert (entry->block ==
block);
241 return entry->static_link;
261 aflag = bfd_section_flags (asect);
262 if (!(aflag & SEC_ALLOC))
318 const char *expanded_name;
320 std::string name_holder;
323 gdb_assert (
obfd ==
nullptr);
325 expanded_name =
"<<anonymous objfile>>";
329 expanded_name =
name;
332 name_holder = gdb_abspath (
name);
333 expanded_name = name_holder.c_str ();
376 error (_(
"Entry point address is not known."));
416 gdb_assert (res !=
nullptr);
432 gdb_assert (
objfile && parent);
453 if (parent !=
nullptr)
605 int something_changed = 0;
611 something_changed = 1;
613 if (!something_changed)
622 if (bv->
map () !=
nullptr)
627 b->set_start (b->start () + delta[block_line_section]);
628 b->set_end (b->end () + delta[block_line_section]);
632 r.set_start (r.start () + delta[block_line_section]);
633 r.set_end (r.end () + delta[block_line_section]);
638 for (
struct symbol *sym : b->multidict_symbols ())
696 gdb_assert (debug_objfile->section_offsets.size ()
699 (debug_objfile->section_offsets.size ());
767 if (ofp->has_partial_symbols ())
816 if (ofp->per_bfd->minimal_symbol_count > 0)
829 const CORE_ADDR sect1_addr = sect1->
addr ();
830 const CORE_ADDR sect2_addr = sect2->
addr ();
832 if (sect1_addr < sect2_addr)
834 else if (sect1_addr > sect2_addr)
862 if (objfile1 == objfile2)
875 else if (osect == sect1)
879 gdb_assert_not_reached (
"section not found");
892 gdb_assert_not_reached (
"objfile not found");
897 gdb_assert_not_reached (
"unexpected code path");
910 gdb_assert (a->
addr () == b->
addr ());
926 const struct bfd_section *section)
928 const bfd_vma lma = bfd_section_lma (section);
931 && (bfd_get_file_flags (abfd) & BFD_IN_MEMORY) == 0)
936 if ((bfd_section_flags (section) & SEC_THREAD_LOCAL) != 0)
939 if (bfd_section_size (section) == 0)
958 for (i = 0, j = 0; i < map_size - 1; i++)
964 const CORE_ADDR sect1_addr = sect1->
addr ();
965 const CORE_ADDR sect2_addr = sect2->
addr ();
967 if (sect1_addr == sect2_addr
980 gdb_assert (i == map_size - 1);
985 gdb_assert (map_size / 2 <= j);
1000 for (i = 0, j = 0; i < map_size - 1; )
1005 for (k = i + 1; k < map_size; k++)
1009 const CORE_ADDR sect1_addr = sect1->
addr ();
1010 const CORE_ADDR sect2_addr = sect2->
addr ();
1011 const CORE_ADDR sect1_endaddr = sect1->
endaddr ();
1013 gdb_assert (sect1_addr <= sect2_addr);
1015 if (sect1_endaddr <= sect2_addr)
1027 const CORE_ADDR sect2_endaddr = sect2->
endaddr ();
1031 complaint (_(
"unexpected overlap between:\n"
1032 " (A) section `%s' from `%s' [%s, %s)\n"
1033 " (B) section `%s' from `%s' [%s, %s).\n"
1034 "Will ignore section B"),
1048 gdb_assert (i == map_size - 1);
1064 int alloc_size, map_size, i;
1081 if (alloc_size == 0)
1096 std::sort (map, map + alloc_size,
sort_cmp);
1100 if (map_size < alloc_size)
1102 map = XRESIZEVEC (
struct obj_section *, map, map_size);
1104 gdb_assert (alloc_size == map_size);
1107 *pmap_size = map_size;
1115 const CORE_ADDR pc = *(CORE_ADDR *) key;
1118 if (pc < section->
addr ())
1178 return (s !=
nullptr
1196scoped_restore_tmpl<int>
1199 return scoped_restore_tmpl<int>
1216 if (osect->addr () <=
addr &&
addr < osect->endaddr ())
1292 return bfd_flavour_name (bfd_get_flavour (
objfile->
obfd.get ()));
1301 struct type *int_type;
1304#define TRY_TYPE(F) \
1305 int_type = (unsigned_p \
1306 ? builtin_type (of)->builtin_unsigned_ ## F \
1307 : builtin_type (of)->builtin_ ## F); \
1308 if (int_type != NULL && int_type->length () == size_in_bytes) \
1319 gdb_assert_not_reached (
"unable to find suitable integer type");
void * xcalloc(size_t number, size_t size)
struct gdbarch * gdbarch_from_bfd(bfd *abfd)
void clear_pc_function_cache(void)
void breakpoint_re_set(void)
void breakpoint_free_objfile(struct objfile *objfile)
void btrace_free_objfile(struct objfile *objfile)
void set(unsigned key, void *datum)
separate_debug_iterator & operator++()
struct objfile * m_objfile
struct objfile * m_parent
#define complaint(FMT,...)
void exec_set_section_address(const char *filename, int index, CORE_ADDR address)
int gdb_bfd_section_index(bfd *abfd, asection *section)
int gdb_bfd_requires_relocations(bfd *abfd)
int gdb_bfd_count_sections(bfd *abfd)
int is_target_filename(const char *name)
gdb::ref_ptr< struct bfd, gdb_bfd_ref_policy > gdb_bfd_ref_ptr
static gdb_bfd_section_range gdb_bfd_sections(bfd *abfd)
gdb::function_view< bool(objfile *)> iterate_over_objfiles_in_search_order_cb_ftype
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
observable< struct objfile * > free_objfile
const char * objfile_flavour_name(struct objfile *objfile)
int objfile_has_full_symbols(struct objfile *objfile)
static int bsearch_cmp(const void *key, const void *elt)
void objfiles_changed(void)
void set_objfile_main_name(struct objfile *objfile, const char *name, enum language lang)
static int objfile_relocate1(struct objfile *objfile, const section_offsets &new_offsets)
bool shared_objfile_contains_address_p(struct program_space *pspace, CORE_ADDR address)
static struct objfile_pspace_info * get_objfile_pspace_data(struct program_space *pspace)
const char * objfile_debug_name(const struct objfile *objfile)
static void update_section_map(struct program_space *pspace, struct obj_section ***pmap, int *pmap_size)
int objfile_has_symbols(struct objfile *objfile)
void objfile_purge_solibs(void)
static void relocate_one_symbol(struct symbol *sym, struct objfile *objfile, const section_offsets &delta)
void default_iterate_over_objfiles_in_search_order(gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, objfile *current_objfile)
int have_minimal_symbols(void)
struct type * objfile_int_type(struct objfile *of, int size_in_bytes, bool unsigned_p)
static int filter_overlapping_sections(struct obj_section **map, int map_size)
static void add_to_objfile_sections(struct bfd *abfd, struct bfd_section *asect, struct objfile *objfile, int force)
scoped_restore_tmpl< int > inhibit_section_map_updates(struct program_space *pspace)
static int static_link_htab_entry_eq(const void *p1, const void *p2)
void objfile_relocate(struct objfile *objfile, const section_offsets &new_offsets)
struct obj_section * find_pc_section(CORE_ADDR pc)
static hashval_t static_link_htab_entry_hash(const void *p)
const struct dynamic_prop * objfile_lookup_static_link(struct objfile *objfile, const struct block *block)
static int objfile_rebase1(struct objfile *objfile, CORE_ADDR slide)
bool is_addr_in_objfile(CORE_ADDR addr, const struct objfile *objfile)
void objfile_rebase(struct objfile *objfile, CORE_ADDR slide)
CORE_ADDR entry_point_address(void)
static int insert_section_p(const struct bfd *abfd, const struct bfd_section *section)
static bool sort_cmp(const struct obj_section *sect1, const obj_section *sect2)
int have_partial_symbols(void)
int entry_point_address_query(CORE_ADDR *entry_p)
static void add_separate_debug_objfile(struct objfile *objfile, struct objfile *parent)
void free_objfile_separate_debug(struct objfile *objfile)
static int filter_debuginfo_sections(struct obj_section **map, int map_size)
bool pc_in_section(CORE_ADDR pc, const char *name)
const char * objfile_name(const struct objfile *objfile)
static struct obj_section * preferred_obj_section(struct obj_section *a, struct obj_section *b)
static const registry< program_space >::key< objfile_pspace_info > objfiles_pspace_data
const char * objfile_filename(const struct objfile *objfile)
static const registry< bfd >::key< objfile_per_bfd_storage > objfiles_bfd_data
int have_full_symbols(void)
void objfile_register_static_link(struct objfile *objfile, const struct block *block, const struct dynamic_prop *static_link)
void build_objfile_section_table(struct objfile *objfile)
void set_objfile_per_bfd(struct objfile *objfile)
void build_objfile_section_table(struct objfile *)
#define SECT_OFF_TEXT(objfile)
void set_objfile_per_bfd(struct objfile *obj)
void free_objfile_separate_debug(struct objfile *)
struct program_space * current_program_space
struct symtab_and_line get_current_source_symtab_and_line(void)
void clear_current_source_symtab_and_line(void)
virtual void relocate(CORE_ADDR offset)=0
gdb::array_view< struct block * > blocks()
struct objfile * objfile() const
int the_bfd_section_index
short section_index() const
CORE_ADDR endaddr() const
struct bfd_section * the_bfd_section
objfile_per_bfd_storage(bfd *bfd)
enum language language_of_main
auto_obstack storage_obstack
~objfile_per_bfd_storage()
const char * name_of_main
int new_objfiles_available
objfile_pspace_info()=default
struct obj_section ** sections
struct obj_section * sections_start
void forget_cached_source_info()
const char * original_name
iterator_range< section_iterator > sections()
const struct sym_fns * sf
struct obj_section * sections_end
struct compunit_symtab * compunit_symtabs
struct objfile * separate_debug_objfile_backlink
struct program_space * pspace
struct objfile * separate_debug_objfile_link
struct objfile * separate_debug_objfile
struct gdbarch * arch() const
struct objfile_per_bfd_storage * per_bfd
static objfile * make(gdb_bfd_ref_ptr bfd_, const char *name_, objfile_flags flags_, objfile *parent=nullptr)
objfile(gdb_bfd_ref_ptr, const char *, objfile_flags)
compunit_symtab_range compunits()
std::unique_ptr< objfile_per_bfd_storage > per_bfd_storage
auto_obstack objfile_obstack
separate_debug_range separate_debug_objfiles()
struct symbol * template_symbols
::section_offsets section_offsets
objfiles_safe_range objfiles_safe()
objfiles_range objfiles()
void remove_objfile(struct objfile *objfile)
void add_objfile(std::unique_ptr< objfile > &&objfile, struct objfile *before)
struct objfile * symfile_object_file
const struct block * block
const struct dynamic_prop * static_link
void(* sym_finish)(struct objfile *)
address_class aclass() const
void set_value_address(CORE_ADDR address)
CORE_ADDR value_address() const
struct compunit_symtab * compunit() const
section_addr_info build_section_addr_info_from_objfile(const struct objfile *objfile)
int section_is_mapped(struct obj_section *osect)
struct obj_section * find_pc_mapped_section(CORE_ADDR pc)
void addr_info_make_relative(section_addr_info *addrs, bfd *abfd)
void relative_addr_info_to_section_offsets(section_offsets §ion_offsets, const section_addr_info &addrs)
int section_is_overlay(struct obj_section *section)
enum overlay_debugging_state overlay_debugging
std::vector< other_sections > section_addr_info
std::vector< CORE_ADDR > section_offsets
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
void preserve_values(struct objfile *objfile)