Esempio n. 1
0
        public int AddHandle(ulong addr, ulong obj, int hndType, uint refCnt, uint dependentTarget, ulong appDomain)
        {
            // If we fail to get the MT of this object, just skip it and keep going
            if (!GetMethodTables(obj, out ulong mt, out ulong cmt))
            {
                return(_max-- > 0 ? 1 : 0);
            }

            ClrHandle handle = new ClrHandle()
            {
                Address         = addr,
                Object          = obj,
                Type            = _heap.GetObjectType(obj),
                HandleType      = (HandleType)hndType,
                RefCount        = refCnt,
                AppDomain       = _runtime.GetAppDomainByAddress(appDomain),
                DependentTarget = dependentTarget
            };

            if (dependentTarget != 0)
            {
                handle.DependentType = _heap.GetObjectType(dependentTarget);
            }

            Handles.Add(handle);
            handle = handle.GetInteriorHandle();
            if (handle != null)
            {
                Handles.Add(handle);
            }

            // Stop if we have too many handles (likely infinite loop in dac due to
            // inconsistent data).
            return(_max-- > 0 ? 1 : 0);
        }
Esempio n. 2
0
        public int AddHandle(ulong addr, ulong obj, int hndType, uint refCnt, uint dependentTarget, ulong appDomain)
        {
            ulong mt;
            ulong cmt;

            // If we fail to get the MT of this object, just skip it and keep going
            if (!GetMethodTables(obj, out mt, out cmt))
                return _max-- > 0 ? 1 : 0;

            ClrHandle handle = new ClrHandle();
            handle.Address = addr;
            handle.Object = obj;
            handle.Type = _heap.GetObjectType(obj);
            handle.HandleType = (HandleType)hndType;
            handle.RefCount = refCnt;
            handle.AppDomain = _runtime.GetAppDomainByAddress(appDomain);
            handle.DependentTarget = dependentTarget;

            if (dependentTarget != 0)
                handle.DependentType = _heap.GetObjectType(dependentTarget);

            Handles.Add(handle);
            handle = handle.GetInteriorHandle();
            if (handle != null)
                Handles.Add(handle);

            // Stop if we have too many handles (likely infinite loop in dac due to
            // inconsistent data).
            return _max-- > 0 ? 1 : 0;
        }