-\f
-
-/* A range adapter that makes it possible to iterate over all
- minimal symbols of an objfile. */
-
-class objfile_msymbols
-{
-public:
-
- explicit objfile_msymbols (struct objfile *objfile)
- : m_objfile (objfile)
- {
- }
-
- struct iterator
- {
- typedef iterator self_type;
- typedef struct minimal_symbol *value_type;
- typedef struct minimal_symbol *&reference;
- typedef struct minimal_symbol **pointer;
- typedef std::forward_iterator_tag iterator_category;
- typedef int difference_type;
-
- explicit iterator (struct objfile *objfile)
- : m_msym (objfile->per_bfd->msymbols)
- {
- /* Make sure to properly handle the case where there are no
- minsyms. */
- if (MSYMBOL_LINKAGE_NAME (m_msym) == nullptr)
- m_msym = nullptr;
- }
-
- iterator ()
- : m_msym (nullptr)
- {
- }
-
- value_type operator* () const
- {
- return m_msym;
- }
-
- bool operator== (const self_type &other) const
- {
- return m_msym == other.m_msym;
- }
-
- bool operator!= (const self_type &other) const
- {
- return m_msym != other.m_msym;
- }
-
- self_type &operator++ ()
- {
- if (m_msym != nullptr)
- {
- ++m_msym;
- if (MSYMBOL_LINKAGE_NAME (m_msym) == nullptr)
- m_msym = nullptr;
- }
- return *this;
- }
-
- private:
- struct minimal_symbol *m_msym;
- };
-
- iterator begin () const
- {
- return iterator (m_objfile);
- }
-
- iterator end () const
- {
- return iterator ();
- }
-
-private:
-
- struct objfile *m_objfile;
-};
-
-/* A range adapter that makes it possible to iterate over all
- psymtabs in one objfile. */
-
-class objfile_psymtabs : public next_adapter<struct partial_symtab>
-{
-public:
-
- explicit objfile_psymtabs (struct objfile *objfile)
- : next_adapter<struct partial_symtab> (objfile->partial_symtabs->psymtabs)
- {
- }
-};
-
-#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
- for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
- if (osect->the_bfd_section == NULL) \
- { \
- /* Nothing. */ \
- } \
- else
-
-#define SECT_OFF_DATA(objfile) \
- ((objfile->sect_index_data == -1) \
- ? (internal_error (__FILE__, __LINE__, \
- _("sect_index_data not initialized")), -1) \
- : objfile->sect_index_data)
-
-#define SECT_OFF_RODATA(objfile) \
- ((objfile->sect_index_rodata == -1) \
- ? (internal_error (__FILE__, __LINE__, \
- _("sect_index_rodata not initialized")), -1) \
- : objfile->sect_index_rodata)
-
-#define SECT_OFF_TEXT(objfile) \
- ((objfile->sect_index_text == -1) \
- ? (internal_error (__FILE__, __LINE__, \
- _("sect_index_text not initialized")), -1) \
- : objfile->sect_index_text)
-
-/* Sometimes the .bss section is missing from the objfile, so we don't
- want to die here. Let the users of SECT_OFF_BSS deal with an
- uninitialized section index. */
-#define SECT_OFF_BSS(objfile) (objfile)->sect_index_bss
-
-/* Answer whether there is more than one object file loaded. */
-
-#define MULTI_OBJFILE_P() (object_files && object_files->next)