} // For deserialization internal ICorDebugGCHeapRoot(string name, GCRootKind kind, Address heapReference, Address addressOfRoot, ICorDebugGCHeapType type, string appDomainName) { m_kind = kind; m_name = name; m_type = type; m_heapReference = heapReference; m_addressOfRoot = addressOfRoot; m_appDomain = new ICorDebugAD(appDomainName); }
internal ICorDebugGCHeapRoot(ref COR_GC_REFERENCE root, ICorDebugGCHeap heap, StringBuilder buffer) { Address address; Address objRef = 0; root.Location.GetAddress(out address); m_addressOfRoot = address; string adName = ""; if (root.Domain != null) { uint nameSize; root.Domain.GetName((uint)buffer.Capacity, out nameSize, buffer); adName = buffer.ToString(); } m_appDomain = new ICorDebugAD(adName); var asRef = root.Location as ICorDebugReferenceValue; if (asRef != null) { asRef.GetValue(out objRef); m_heapReference = objRef; } else if (root.Location != null) { root.Location.GetAddress(out objRef); m_heapReference = objRef; } else { Console.WriteLine("ERROR! could not fetch value from root 0x{0:x}", address); } Debug.Assert(Object == 0 || heap.IsInHeap(Object)); m_type = null; if (root.Type == CorGCReferenceType.CorHandleStrong) { m_kind = GCRootKind.Strong; m_name = "Strong Handle"; } else if (root.Type == CorGCReferenceType.CorHandleStrongPinning) { m_kind = GCRootKind.Pinning; m_name = "Pinning Handle"; } else if (root.Type == CorGCReferenceType.CorHandleWeakShort) { m_kind = GCRootKind.Weak; m_name = "Weak Handle"; } else if (root.Type == CorGCReferenceType.CorReferenceStack) { m_kind = GCRootKind.LocalVar; m_name = "Local Variable"; } else if (root.Type == CorGCReferenceType.CorReferenceFinalizer) { m_kind = GCRootKind.Finalizer; m_name = "Finalization"; } else if (root.Type == CorGCReferenceType.CorHandleStrongAsyncPinned) { m_kind = GCRootKind.AsyncPinning; m_name = "Async Pinning"; } else { m_kind = GCRootKind.Strong; // TODO FIX NOW complete the enumeration. m_name = "Other Handle"; } }