Exemplo n.º 1
0
        /// <summary>
        ///     Converts the specified handle.
        /// </summary>
        /// <param name="handle">The handle.</param>
        /// <returns>IClrHandle.</returns>
        public IClrHandle Convert(ClrMd.ClrHandle handle)
        {
            if (handle == null)
            {
                return(null);
            }
            var item = new HandleAdapter(this, handle);

            return(Cache.GetOrAdd <IClrHandle>(handle, () => item, () => item.Setup()));
        }
Exemplo n.º 2
0
        private ClrRoot GetHandleRoot(ClrHandle handle)
        {
            GCRootKind kind = GCRootKind.Strong;

            switch (handle.HandleType)
            {
            case HandleType.Pinned:
                kind = GCRootKind.Pinning;
                break;

            case HandleType.AsyncPinned:
                kind = GCRootKind.AsyncPinning;
                break;
            }

            return(new HandleRoot(handle.Address, handle.Object, handle.Type, handle.HandleType, kind, handle.AppDomain));
        }
Exemplo n.º 3
0
        internal ClrHandle GetInteriorHandle()
        {
            if (HandleType != HandleType.AsyncPinned)
            {
                return(null);
            }

            if (Type == null)
            {
                return(null);
            }

            var field = this.Type.GetFieldByName("m_userObject");

            if (field == null)
            {
                return(null);
            }

            ulong  obj;
            object tmp = field.GetValue(this.Object);

            if (!(tmp is ulong) || (obj = (ulong)tmp) == 0)
            {
                return(null);
            }

            ClrType type = Type.Heap.GetObjectType(obj);

            if (type == null)
            {
                return(null);
            }

            ClrHandle result = new ClrHandle()
            {
                Object     = obj,
                Type       = type,
                Address    = Address,
                AppDomain  = AppDomain,
                HandleType = HandleType
            };

            return(result);
        }
Exemplo n.º 4
0
        private Task <Tuple <LinkedList <ClrObject>, ClrRoot> > PathToParallel(ObjectSet seen, Dictionary <ulong, LinkedListNode <ClrObject> > knownEndPoints, ClrHandle handle, ulong target, bool unique, CancellationToken cancelToken)
        {
            Debug.Assert(IsFullyCached);

            Task <Tuple <LinkedList <ClrObject>, ClrRoot> > t = new Task <Tuple <LinkedList <ClrObject>, ClrRoot> >(() =>
            {
                LinkedList <ClrObject> path = PathTo(seen, knownEndPoints, ClrObject.Create(handle.Object, handle.Type), target, unique, true, cancelToken).FirstOrDefault();
                return(new Tuple <LinkedList <ClrObject>, ClrRoot>(path, path != null ? GetHandleRoot(handle) : null));
            });

            t.Start();
            return(t);
        }
Exemplo n.º 5
0
        internal ClrHandle GetInteriorHandle()
        {
            if (this.HandleType != HandleType.AsyncPinned)
                return null;

            if (this.Type == null)
                return null;

            var field = this.Type.GetFieldByName("m_userObject");
            if (field == null)
                return null;

            ulong obj;
            object tmp = field.GetValue(this.Object);
            if (!(tmp is ulong) || (obj = (ulong)tmp) == 0)
                return null;

            ClrType type = this.Type.Heap.GetObjectType(obj);
            if (type == null)
                return null;

            ClrHandle result = new ClrHandle();
            result.Object = obj;
            result.Type = type;
            result.Address = this.Address;
            result.AppDomain = this.AppDomain;
            result.HandleType = this.HandleType;

            return result;
        }
Exemplo n.º 6
0
 public HandleInformation(ClrDump clrDump, ClrHandle clrHandle)
 {
     this.clrHandle = clrHandle;
 }
Exemplo n.º 7
0
 public MDHandle(ClrHandle handle)
 {
     m_handle = handle;
 }