Add temporary debugging code to help figure out top crash bug 500105, part 1. r=dbaron.
authorPeter Van der Beken <peterv@propagandism.org>
Tue, 27 Oct 2009 13:38:18 +0100
changeset 32702 297f674eb90f
parent 32701 7347a2572f1d
child 32703 6b79d9973d7b
push id546
push userpvanderbeken@mozilla.com
push dateTue, 03 Nov 2009 13:34:16 +0000
reviewersdbaron
bugs500105
milestone1.9.2b2pre
Add temporary debugging code to help figure out top crash bug 500105, part 1. r=dbaron.
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -1016,19 +1016,29 @@ struct nsCycleCollector
     void DestroyReversedEdges();
     void ShouldBeFreed(nsISupports *n);
     void WasFreed(nsISupports *n);
     PointerSet mExpectedGarbage;
 #endif
 };
 
 
+struct DoWalkDebugInfo
+{
+    PtrInfo *mCurrentPI;
+    EdgePool::Iterator mFirstChild;
+    EdgePool::Iterator mLastChild;
+    EdgePool::Iterator mCurrentChild;
+};
+
 class GraphWalker
 {
 private:
+    DoWalkDebugInfo *mDebugInfo;
+
     void DoWalk(nsDeque &aQueue);
 
 public:
     void Walk(PtrInfo *s0);
     void WalkFromRoots(GCGraph &aGraph);
 
     // Provided by concrete walker subtypes.
     virtual PRBool ShouldVisitNode(PtrInfo const *pi) = 0;
@@ -1221,24 +1231,31 @@ GraphWalker::WalkFromRoots(GCGraph& aGra
     DoWalk(queue);
 }
 
 void
 GraphWalker::DoWalk(nsDeque &aQueue)
 {
     // Use a aQueue to match the breadth-first traversal used when we
     // built the graph, for hopefully-better locality.
+    DoWalkDebugInfo debugInfo;
+    mDebugInfo = &debugInfo;
+
     while (aQueue.GetSize() > 0) {
         PtrInfo *pi = static_cast<PtrInfo*>(aQueue.PopFront());
 
+        debugInfo.mCurrentPI = pi;
         if (this->ShouldVisitNode(pi)) {
             this->VisitNode(pi);
+            debugInfo.mFirstChild = pi->mFirstChild;
+            debugInfo.mLastChild = pi->mLastChild;
+            debugInfo.mCurrentChild = pi->mFirstChild;
             for (EdgePool::Iterator child = pi->mFirstChild,
                                 child_end = pi->mLastChild;
-                 child != child_end; ++child) {
+                 child != child_end; ++child, debugInfo.mCurrentChild = child) {
                 aQueue.Push(*child);
             }
         }
     };
 
 #ifdef DEBUG_CC
     sCollector->mStats.mWalkedGraph++;
 #endif