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; }
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; } } } }
public ulong ReadPointer(ulong address) => MemoryReader.ReadPointer(address);
public HeapBase(RuntimeBase runtime) { _canWalkHeap = runtime.CanWalkHeap; MemoryReader = new MemoryReader(runtime.DataReader, 0x10000); _pointerSize = runtime.PointerSize; }
public bool ReadPointer(ulong address, out ulong value) => MemoryReader.ReadPointer(address, out value);
public T Read <T>(ulong address) where T : unmanaged => MemoryReader.Read <T>(address);
public bool Read <T>(ulong address, out T value) where T : unmanaged => MemoryReader.Read(address, out value);
public int Read(ulong address, Span <byte> buffer) => MemoryReader.Read(address, buffer);