]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Use the subtracker/subcomparator for attributes too.
authorRoland McGrath <roland@redhat.com>
Wed, 30 Sep 2009 23:16:02 +0000 (16:16 -0700)
committerRoland McGrath <roland@redhat.com>
Wed, 30 Sep 2009 23:16:02 +0000 (16:16 -0700)
libdw/ChangeLog
libdw/c++/dwarf_comparator

index 498e6ef32a8f14a26b29269f4bba8cef771d0e26..dbd97019e8c17415b4be0a1a1e66d316af1d80e7 100644 (file)
@@ -1,5 +1,8 @@
 2009-09-30  Roland McGrath  <roland@redhat.com>
 
+       * c++/dwarf_comparator (dwarf_comparator::reference_match): Use the
+       subtracker/subcomparator for attributes too.
+
        * c++/subr.hh (subr::sharing_stack::clear): New method.
 
        * c++/values.cc (dwarf::attr_value::what_space):
index 87c1bf37768bccaa98a68ac00ea21196cf51cfc0..88f656f504a4478ebc241bff5b8ee39038a10d69 100644 (file)
@@ -521,20 +521,28 @@ namespace elfutils
         contents and contexts in ascending order of costliness of a check.  */
       if (_m_tracker.context_quick_mismatch (lhs, rhs))
        return nomatch (a, b, "quick context");
-      if (!match (a.attributes (), b.attributes ()))
-       return nomatch (a, b, "attribute");
-      if (!_m_tracker.context_match (lhs, rhs))
-       return nomatch (a, b, "context");
 
       /* To compare the children, we have to clone the tracker and use a
         new one, in case of any reference attributes in their subtrees.
         The new tracker jump-starts its walk to the referenced DIE from
-        the root of the CU.  */
+        the root of the CU.
+
+        We use the subtracker and subcomparator for the attributes as well,
+        in case the main tracker has side-effects like printing.  */
+
+      typename tracker::subtracker t (_m_tracker, matched, lhs, rhs);
+      subcomparator cmp (t);
+
+      if (!cmp.equals (a.attributes (), b.attributes ()))
+       return nomatch (a, b, "attribute");
+
+      if (!_m_tracker.context_match (lhs, rhs))
+       return nomatch (a, b, "context");
+
       bool result = !has_children;
       if (has_children)
        {
-         typename tracker::subtracker t (_m_tracker, matched, lhs, rhs);
-         result = subcomparator (t).equals (a.children (), b.children ());
+         result = cmp.equals (a.children (), b.children ());
          if (!result)
            result = nomatch (a, b, "children");
        }