]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Adjust location_attribute::const_iterator to changes in range_list iterator
authorPetr Machata <pmachata@redhat.com>
Fri, 25 Feb 2011 11:05:16 +0000 (12:05 +0100)
committerPetr Machata <pmachata@redhat.com>
Fri, 25 Feb 2011 11:14:00 +0000 (12:14 +0100)
libdw/c++/dwarf
libdw/c++/values.cc

index ece9df9e9d9c9f50475ac2f04dad83d8002a308b..8342dc7823a0c2f8049adbd9faa00b5d5e8c82a4 100644 (file)
@@ -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 ()
        {}
 
index 64e4d24662a0d49955deedc4e46c9103becc1ab3..7330d32919d4bef77c106abb201900ab78f37c2a 100644 (file)
@@ -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 ();
     }