예제 #1
0
        private IEnumerable <ulong> EnumerateObjectsOfType(ulong start, ulong stop, string typeName)
        {
            ClrHeap heap = _runtime.Heap;

            foreach (ulong ptr in EnumeratePointersInRange(start, stop))
            {
                if (_runtime.ReadPointer(ptr, out ulong obj))
                {
                    if (heap.IsInHeap(obj))
                    {
                        ClrType type = heap.GetObjectType(obj);


                        int sanity = 0;
                        while (type != null)
                        {
                            if (type.Name == typeName)
                            {
                                yield return(obj);

                                break;
                            }

                            type = type.BaseType;

                            if (sanity++ == 16)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        IEnumerable <ulong> EnumerateObjectsOfTypes(ulong start, ulong stop, HashSet <string> types)
        {
            ClrHeap heap = m_runtime.GetHeap();

            foreach (ulong ptr in EnumeratePointersInRange(start, stop))
            {
                ulong obj;
                if (m_runtime.ReadPointer(ptr, out obj))
                {
                    if (heap.IsInHeap(obj))
                    {
                        ClrType type = heap.GetObjectType(obj);

                        int sanity = 0;
                        while (type != null)
                        {
                            if (types.Contains(type.Name))
                            {
                                yield return(obj);

                                break;
                            }

                            type = type.BaseType;

                            if (sanity++ == 16)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
 /// <summary>
 ///     Returns true if the given address resides somewhere on the managed heap.
 /// </summary>
 /// <param name="address">The address.</param>
 /// <returns><c>true</c> if [is in heap] [the specified address]; otherwise, <c>false</c>.</returns>
 /// <inheritdoc />
 public bool IsInHeap(ulong address) => Heap.IsInHeap(address);