public:
inline const_iterator (const const_iterator &i)
: _m_die (i._m_die), _m_base (i._m_base),
- _m_begin (i._m_begin), _m_end (i._m_begin),
+ _m_begin (i._m_begin), _m_end (i._m_end),
_m_offset (i._m_offset) {}
inline value_type operator* () const
{
return !(*this == other);
}
+
+ class arange_list
+ : public std::set<std::pair< ::Dwarf_Addr, ::Dwarf_Addr> >
+ {
+ private:
+ typedef std::set<std::pair< ::Dwarf_Addr, ::Dwarf_Addr> > _base;
+
+ public:
+ typedef _base::key_type key_type;
+ typedef _base::value_type value_type;
+ typedef _base::iterator iterator;
+ typedef _base::const_iterator const_iterator;
+
+ arange_list () {}
+ arange_list (const arange_list &other)
+ : _base (static_cast<const _base &> (other)) {}
+
+ std::string to_string () const;
+ };
+
+ private:
+ struct arange_less
+ : public std::binary_function<compile_unit, compile_unit, bool>
+ {
+ inline bool operator() (const compile_unit &a, const compile_unit &b)
+ const
+ {
+ return a.offset () < b.offset ();
+ }
+ };
+
+ public:
+ typedef std::map<compile_unit, arange_list, arange_less> aranges_map;
+
+ aranges_map aranges () const;
};
inline class dwarf::debug_info_entry::raw_children
hex_string (Dwarf_Word value, const char *before = "", const char *after = "")
{
std::ostringstream os;
- os.setf(std::ios::hex, std::ios::basefield);
+ os.setf (std::ios::hex, std::ios::basefield);
+ os.setf (std::ios::showbase);
os << before << value << after;
return os.str ();
}
__libdw_ranges_to_string (const container &c)
{
std::ostringstream os;
- os.setf(std::ios::hex, std::ios::basefield);
+ os.setf (std::ios::hex, std::ios::basefield);
+ os.setf (std::ios::showbase);
os << "<";
bool first = true;
for (typename container::const_iterator i = c.begin (); i != c.end (); ++i)
{
- typename container::value_type range = *i;
+ const typename container::value_type range = *i;
if (!first)
os << ",";
os << range.first << "-" << range.second;
{
return __libdw_ranges_to_string (*this);
}
+
+string
+dwarf::arange_list::to_string () const
+{
+ return __libdw_ranges_to_string (*this);
+}
+
+dwarf::aranges_map
+dwarf::aranges () const
+{
+ Dwarf_Aranges *these;
+ xif (dwarf_getaranges (_m_dw, &these, NULL) < 0);
+
+ if (these == NULL)
+ return aranges_map ();
+
+ aranges_map result;
+ for (const Dwarf_Aranges_s::Dwarf_Arange_s *r = &these->info[0];
+ r < &these->info[these->naranges];
+ ++r)
+ result[compile_unit (debug_info_entry (_m_dw, r->offset))].insert
+ (arange_list::value_type (r->addr, r->addr + r->length));
+
+ return result;
+}