]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Track containing DIE tag in C++ reader attr_value interface.
authorRoland McGrath <roland@redhat.com>
Fri, 27 Feb 2009 00:38:20 +0000 (16:38 -0800)
committerRoland McGrath <roland@redhat.com>
Fri, 27 Feb 2009 00:38:20 +0000 (16:38 -0800)
libdw/ChangeLog
libdw/c++/dwarf
libdw/c++/values.cc

index cbd457dfca2a711c3ae3f4ad45fa967b3f8244f9..fc0817645512466cb2d811d838693f3dc38f6d1b 100644 (file)
@@ -1,3 +1,10 @@
+2009-02-26  Roland McGrath  <roland@redhat.com>
+
+       * c++/dwarf (dwarf::attr_value): Add _m_tag private member.
+       (dwarf::attr_value, dwarf::attribute): Update initializers.
+       (dwarf::raw_attributes::const_iterator): Update caller.
+       * c++/values.cc (attr_value::what_space): Use it.
+
 2009-02-01  Roland McGrath  <roland@redhat.com>
 
        * c++/edit-values.cc: New file.
index 69127aa09c22743ea1bd25803ca5d0eec3d4194a..862b9a14666516e8dd0370ae142a782e578ff418 100644 (file)
@@ -670,7 +670,7 @@ namespace elfutils
        {
          if (unlikely (_m_offset == 1))
            throw std::runtime_error ("dereferencing end iterator");
-         return attribute (_m_attr);
+         return attribute (_m_die, _m_attr);
        }
       };
       inline const_iterator begin () const
@@ -1027,13 +1027,15 @@ namespace elfutils
       friend class location_attr;
       friend class range_list;
     private:
+      const int _m_tag;
       ::Dwarf_Attribute _m_attr;
       inline ::Dwarf_Attribute *thisattr () const
       {
        return const_cast< ::Dwarf_Attribute *> (&_m_attr);
       }
 
-      attr_value (const ::Dwarf_Attribute &attr) : _m_attr (attr) {}
+      attr_value (int tag, const ::Dwarf_Attribute &attr)
+       : _m_tag (tag), _m_attr (attr) {}
 
       inline bool same (const attr_value &other) const
       {
@@ -1757,8 +1759,8 @@ namespace elfutils
        }
       };
 
-      attribute (const ::Dwarf_Attribute &attr)
-       : first (*this), second (attr) {}
+      attribute (const debug_info_entry &die, const ::Dwarf_Attribute &attr)
+       : first (*this), second (die.tag (), attr) {}
 
     public:
       lhs first;
index 335b80d19abf09f8f5d9cb76d647d072b1e1f2e3..0c31d5b3f3be37cec042eb7b8809e0a759c9502c 100644 (file)
@@ -120,9 +120,8 @@ dwarf::attr_value::what_space () const
       throw std::runtime_error ("XXX bad form");
     }
 
-  unsigned int expected = expected_value_space
-    (dwarf_whatattr (thisattr ()), 0); // XXX need tag!
-
+  unsigned int expected = expected_value_space (dwarf_whatattr (thisattr ()),
+                                               _m_tag);
   if (unlikely ((expected & possible) == 0))
     {
       if (expected == 0 && possible == (VS(unit_reference) | VS(reference)))