Example #1
0
        /// <summary>
        ///     Converts the specified root.
        /// </summary>
        /// <param name="root">The root.</param>
        /// <returns>IClrRoot.</returns>
        public IClrRoot Convert(ClrMd.ClrRoot root)
        {
            if (root == null)
            {
                return(null);
            }
            var item = new ClrRootAdapter(this, root);

            return(Cache.GetOrAdd <IClrRoot>(root, () => item, () => item.Setup()));
        }
 public StackInstanceInformation(ClrDump clrDump, ClrRoot clrRoot)
 {
     ClrDump = clrDump;
     ClrRoot = clrRoot;
 }
Example #3
0
        private Task <Tuple <LinkedList <ClrObject>, ClrRoot> > PathToParallel(ObjectSet seen, Dictionary <ulong, LinkedListNode <ClrObject> > knownEndPoints, ClrRoot root, ulong target, bool unique, CancellationToken cancelToken)
        {
            Debug.Assert(IsFullyCached);

            Task <Tuple <LinkedList <ClrObject>, ClrRoot> > t = new Task <Tuple <LinkedList <ClrObject>, ClrRoot> >(() => new Tuple <LinkedList <ClrObject>, ClrRoot>(PathTo(seen, knownEndPoints, ClrObject.Create(root.Object, root.Type), target, unique, true, cancelToken).FirstOrDefault(), root));

            t.Start();
            return(t);
        }
Example #4
0
        private Node TryFindPathToTarget(ClrRoot root)
        {
            ClrType type = _heap.GetObjectType(root.Object);
            if (type == null)
                return null;

            List<ulong> refList = new List<ulong>();
            List<int> offsetList = new List<int>();

            Node curr = new Node(root.Object, type);
            while (curr != null)
            {
                if (curr.Children == null)
                {
                    refList.Clear();
                    offsetList.Clear();

                    curr.Type.EnumerateRefsOfObject(curr.Object, (child, offset) =>
                    {
                        if (child != 0)
                        {
                            refList.Add(child);
                            offsetList.Add(offset);
                        }
                    });

                    curr.Children = refList.ToArray();
                    curr.Offsets = offsetList.ToArray();
                }
                else
                {
                    if (curr.Curr < curr.Children.Length)
                    {
                        ulong nextObj = curr.Children[curr.Curr];
                        int offset = curr.Offsets[curr.Curr];
                        curr.Curr++;

                        if (_visitedObjects.Contains(nextObj))
                            continue;

                        _visitedObjects.Add(nextObj);

                        Node next = null;
                        if (_targets.TryGetValue(nextObj, out next))
                        {
                            curr.Next = next;
                            next.Prev = curr;
                            next.Offset = offset;

                            while (curr.Prev != null)
                            {
                                _targets[curr.Object] = curr;
                                curr = curr.Prev;
                            }

                            _targets[curr.Object] = curr;
                            return curr;
                        }

                        type = _heap.GetObjectType(nextObj);
                        if (type != null && type.ContainsPointers)
                        {
                            curr = new Node(nextObj, type, curr);
                            curr.Offset = offset;
                        }
                    }
                    else
                    {
                        curr = curr.Prev;

                        if (curr != null)
                            curr.Next = null;
                    }
                }
            }

            return null;
        }
Example #5
0
 public SimplifiedRoot(ClrRoot root)
 {
     Address = root.Address;
     Object = root.Object;
     Kind = root.Kind;
     DisplayText = root.BetterToString();
 }
Example #6
0
 public MDRoot(ClrRoot root)
 {
     m_root = root;
 }
 public ClrRootsInformation(ClrDump clrDump, ClrRoot clrRoot)
 {
     ClrDump = clrDump;
     ClrRoot = clrRoot;
 }