Introduce a separate debug objfile iterator
This introduces a new iterator and range adapter for iteration over the separate debug files of a given objfile. As in the current approach, the requested objfile is returned first, followed by the separate debug objfiles. gdb/ChangeLog 2019-04-10 Tom Tromey <tom@tromey.com> * symtab.c (lookup_global_symbol_from_objfile) (lookup_symbol_in_objfile_from_linkage_name): Use the iterator. * objfiles.h (class separate_debug_iterator): New. (class separate_debug_range): New. (struct objfile) <separate_debug_objfiles>: New method. (objfile_separate_debug_iterate): Don't declare. * objfiles.c (separate_debug_iterator::operator++): Rename from objfile_separate_debug_iterate. (objfile_relocate, objfile_rebase, objfile_has_symbols): Use the iterator. * minsyms.c (lookup_minimal_symbol_by_pc_section): Use the iterator.
This commit is contained in:
parent
ee3711344b
commit
e9ad22ee5f
5 changed files with 121 additions and 54 deletions
|
@ -318,6 +318,63 @@ struct objfile_per_bfd_storage
|
|||
std::bitset<nr_languages> demangled_hash_languages;
|
||||
};
|
||||
|
||||
/* An iterator that first returns a parent objfile, and then each
|
||||
separate debug objfile. */
|
||||
|
||||
class separate_debug_iterator
|
||||
{
|
||||
public:
|
||||
|
||||
explicit separate_debug_iterator (struct objfile *objfile)
|
||||
: m_objfile (objfile),
|
||||
m_parent (objfile)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator!= (const separate_debug_iterator &other)
|
||||
{
|
||||
return m_objfile != other.m_objfile;
|
||||
}
|
||||
|
||||
separate_debug_iterator &operator++ ();
|
||||
|
||||
struct objfile *operator* ()
|
||||
{
|
||||
return m_objfile;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct objfile *m_objfile;
|
||||
struct objfile *m_parent;
|
||||
};
|
||||
|
||||
/* A range adapter wrapping separate_debug_iterator. */
|
||||
|
||||
class separate_debug_range
|
||||
{
|
||||
public:
|
||||
|
||||
explicit separate_debug_range (struct objfile *objfile)
|
||||
: m_objfile (objfile)
|
||||
{
|
||||
}
|
||||
|
||||
separate_debug_iterator begin ()
|
||||
{
|
||||
return separate_debug_iterator (m_objfile);
|
||||
}
|
||||
|
||||
separate_debug_iterator end ()
|
||||
{
|
||||
return separate_debug_iterator (nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct objfile *m_objfile;
|
||||
};
|
||||
|
||||
/* Master structure for keeping track of each file from which
|
||||
gdb reads symbols. There are several ways these get allocated: 1.
|
||||
The main symbol file, symfile_objfile, set by the symbol-file command,
|
||||
|
@ -396,6 +453,14 @@ struct objfile
|
|||
return msymbols_range (this);
|
||||
}
|
||||
|
||||
/* Return a range adapter for iterating over all the separate debug
|
||||
objfiles of this objfile. */
|
||||
|
||||
separate_debug_range separate_debug_objfiles ()
|
||||
{
|
||||
return separate_debug_range (this);
|
||||
}
|
||||
|
||||
|
||||
/* All struct objfile's are chained together by their next pointers.
|
||||
The program space field "objfiles" (frequently referenced via
|
||||
|
@ -563,9 +628,6 @@ extern CORE_ADDR entry_point_address (void);
|
|||
|
||||
extern void build_objfile_section_table (struct objfile *);
|
||||
|
||||
extern struct objfile *objfile_separate_debug_iterate (const struct objfile *,
|
||||
const struct objfile *);
|
||||
|
||||
extern void put_objfile_before (struct objfile *, struct objfile *);
|
||||
|
||||
extern void add_separate_debug_objfile (struct objfile *, struct objfile *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue