]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Diagnose reference mismatches with more detail.
authorRoland McGrath <roland@redhat.com>
Thu, 20 Aug 2009 05:03:58 +0000 (22:03 -0700)
committerRoland McGrath <roland@redhat.com>
Thu, 20 Aug 2009 05:03:58 +0000 (22:03 -0700)
src/ChangeLog
src/dwarfcmp.cc

index 25d50f6401f88f226276ea655cf101c3901a2c89..feecbf29737e9f6c6ecec1f583f30142e80f6f79 100644 (file)
@@ -1,5 +1,9 @@
 2009-08-19  Roland McGrath  <roland@redhat.com>
 
+       Diagnose reference mismatches with more detail.
+       * dwarfcmp.cc (talker::reference_mismatch): New method.
+       (talker::mismatch): Call it.
+
        * dwarfcmp.cc (talker): Update constructor for tracker changes.
 
 2009-08-16  Roland McGrath  <roland@redhat.com>
index 91081587768e16f557fced0639707f72500ff505..d62a2edeea758da922b331d19d8d06248e47e4f0 100644 (file)
@@ -207,9 +207,33 @@ struct talker : public dwarf_ref_tracker<dwarf1, dwarf2>
       for (location () << " missing attributes:"; it1 != end1; ++it1)
        cout << " " << to_string (*it1);
     else
-      location () << to_string (*it1) << " vs " << to_string (*it2);
+      {
+       location () << to_string (*it1) << " vs " << to_string (*it2);
+       if ((*it1).second.what_space () == dwarf::VS_reference
+           && (*it2).second.what_space () == dwarf::VS_reference)
+         reference_mismatch ((*it1).second.reference (),
+                             (*it2).second.reference ());
+      }
     cout << endl;
   }
+
+  inline void reference_mismatch (const die1 &ref1, const die2 &ref2)
+  {
+    dwarf_comparator<dwarf1, dwarf2, false, _tracker> cmp (*(_tracker *) this);
+    if (cmp.equals (*ref1, *ref2))
+      cout << " (identical but contexts mismatch)";
+    else
+      {
+       _base notracker;
+       dwarf_comparator<dwarf1, dwarf2, true> cmp_norefs (notracker);
+       if (cmp_norefs.equals (*ref1, *ref2))
+         cout << " (" << ref1->to_string () << " with reference mismatches)";
+       else
+         cout << " (" << ref1->to_string ()
+              << " != " << ref2->to_string ()
+              << ")";
+      }
+  }
 };
 
 template<class dwarf1, class dwarf2, class tracker>