From: Petr Machata Date: Fri, 25 Feb 2011 11:05:16 +0000 (+0100) Subject: Adjust location_attribute::const_iterator to changes in range_list iterator X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1b6af047ae701e2835dacceba53edc6a5544d9c;p=thirdparty%2Felfutils.git Adjust location_attribute::const_iterator to changes in range_list iterator --- diff --git a/libdw/c++/dwarf b/libdw/c++/dwarf index ece9df9e9..8342dc782 100644 --- a/libdw/c++/dwarf +++ b/libdw/c++/dwarf @@ -1327,8 +1327,8 @@ namespace elfutils ::Dwarf_CU *_m_cu; unsigned char *_m_readptr; - static unsigned char *formptr (Dwarf_Attribute *); - const_iterator (Dwarf_Attribute *, unsigned char *readptr); + static unsigned char *formptr (int secndx, Dwarf_Attribute *); + const_iterator (int secndx, Dwarf_Attribute *, unsigned char *readptr); public: // Default constructor: only valid for operator=. @@ -1376,14 +1376,10 @@ namespace elfutils } }; - const_iterator begin () const - { - const_iterator it (_m_attr.thisattr (), 0); - return ++it; - } + const_iterator begin () const; const_iterator end () const { - return const_iterator (_m_attr.thisattr (), (unsigned char *)-1); + return const_iterator (-1, _m_attr.thisattr (), (unsigned char *)-1); } const_iterator find (const key_type &match) const @@ -1503,7 +1499,7 @@ namespace elfutils // For end iterator. inline explicit const_iterator (Dwarf_Attribute *attr) - : dwarf::range_list::const_iterator (attr, (unsigned char *)-1) + : dwarf::range_list::const_iterator (-1, attr, (unsigned char *)-1) , _m_block () {} diff --git a/libdw/c++/values.cc b/libdw/c++/values.cc index 64e4d2466..7330d3291 100644 --- a/libdw/c++/values.cc +++ b/libdw/c++/values.cc @@ -388,23 +388,31 @@ namespace elfutils // dwarf::range_list unsigned char * -dwarf::range_list::const_iterator::formptr (Dwarf_Attribute *attr) +dwarf::range_list::const_iterator::formptr (int secndx, Dwarf_Attribute *attr) { - unsigned char *readptr = __libdw_formptr (attr, IDX_debug_ranges, + unsigned char *readptr = __libdw_formptr (attr, secndx, DWARF_E_NO_DEBUG_RANGES, NULL, NULL); xif (attr, readptr == NULL); return readptr; } -dwarf::range_list::const_iterator::const_iterator (Dwarf_Attribute *attr, +dwarf::range_list::const_iterator +dwarf::range_list::begin () const +{ + const_iterator it (IDX_debug_ranges, _m_attr.thisattr (), 0); + return ++it; +} + +dwarf::range_list::const_iterator::const_iterator (int secndx, + Dwarf_Attribute *attr, unsigned char *readptr) : _m_base (-1), _m_begin (0), _m_end (0), _m_cu (attr->cu) , _m_readptr (readptr) { if (_m_readptr == NULL) { - _m_readptr = formptr (attr); + _m_readptr = formptr (secndx, attr); xif (attr, _m_readptr == NULL); } } @@ -607,7 +615,8 @@ dwarf::location_attr::begin () const const_iterator i (_m_attr.thisattr ()); if (is_list ()) { - i._m_readptr = const_iterator::formptr (_m_attr.thisattr ()); + i._m_readptr = const_iterator::formptr (IDX_debug_loc, + _m_attr.thisattr ()); xif (_m_attr.thisattr (), i._m_readptr == NULL); i.advance (); }