예제 #1
0
파일: heapbase.cs 프로젝트: tomasr/clrmd
 public HeapBase(RuntimeBase runtime)
 {
     _canWalkHeap = runtime.CanWalkHeap;
     if (runtime.DataReader.CanReadAsync)
         MemoryReader = new AsyncMemoryReader(runtime.DataReader, 0x10000);
     else
         MemoryReader = new MemoryReader(runtime.DataReader, 0x10000);
     _pointerSize = runtime.PointerSize;
 }
예제 #2
0
        public void WalkObject(ulong addr, ulong size, MemoryReader cache, Action<ulong, int> refCallback)
        {
            Debug.Assert(size >= (ulong)IntPtr.Size);

            int series = GetNumSeries();
            int highest = GetHighestSeries();
            int curr = highest;

            if (series > 0)
            {
                int lowest = GetLowestSeries();
                do
                {
                    ulong ptr = addr + GetSeriesOffset(curr);
                    ulong stop = (ulong)((long)ptr + (long)GetSeriesSize(curr) + (long)size);

                    while (ptr < stop)
                    {
                        ulong ret;
                        if (cache.ReadPtr(ptr, out ret) && ret != 0)
                            refCallback(ret, (int)(ptr - addr));

                        ptr += (ulong)IntPtr.Size;
                    }

                    curr -= GCDescSize;
                } while (curr >= lowest);
            }
            else
            {
                ulong ptr = addr + GetSeriesOffset(curr);

                while (ptr < (addr + size - (ulong)IntPtr.Size))
                {
                    for (int i = 0; i > series; i--)
                    {
                        uint nptrs = GetPointers(curr, i);
                        uint skip = GetSkip(curr, i);

                        ulong stop = ptr + (ulong)(nptrs * IntPtr.Size);
                        do
                        {
                            ulong ret;
                            if (cache.ReadPtr(ptr, out ret) && ret != 0)
                                refCallback(ret, (int)(ptr - addr));

                            ptr += (ulong)IntPtr.Size;
                        } while (ptr < stop);

                        ptr += skip;
                    }
                }
            }
        }
예제 #3
0
 public ulong ReadPointer(ulong address) => MemoryReader.ReadPointer(address);
예제 #4
0
 public HeapBase(RuntimeBase runtime)
 {
     _canWalkHeap = runtime.CanWalkHeap;
     MemoryReader = new MemoryReader(runtime.DataReader, 0x10000);
     _pointerSize = runtime.PointerSize;
 }
예제 #5
0
 public bool ReadPointer(ulong address, out ulong value) => MemoryReader.ReadPointer(address, out value);
예제 #6
0
 public T Read <T>(ulong address) where T : unmanaged => MemoryReader.Read <T>(address);
예제 #7
0
 public bool Read <T>(ulong address, out T value) where T : unmanaged => MemoryReader.Read(address, out value);
예제 #8
0
 public int Read(ulong address, Span <byte> buffer) => MemoryReader.Read(address, buffer);
 public HeapBase(RuntimeBase runtime)
 {
     _canWalkHeap = runtime.CanWalkHeap;
     MemoryReader = new MemoryReader(runtime.DataReader, 0x10000);
     _pointerSize = runtime.PointerSize;
 }