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 -= s_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;
                    }
                }
            }
        }
Пример #2
0
        public override bool ReadPointer(ulong addr, out ulong value)
        {
            if (MemoryReader.Contains(addr))
            {
                return(MemoryReader.ReadPtr(addr, out value));
            }

            return(Runtime.ReadPointer(addr, out value));
        }
Пример #3
0
        private ulong ReadPointer(MemoryReader reader, ulong addr)
        {
            if (reader.ReadPtr(addr, out ulong result))
            {
                return(result);
            }

            return(0);
        }
Пример #4
0
        public override ulong GetMethodTable(ulong obj)
        {
            if (MemoryReader.ReadPtr(obj, out ulong mt))
            {
                return(mt);
            }

            return(0);
        }
Пример #5
0
        public override bool ReadPointer(Address addr, out Address value)
        {
            if (MemoryReader.Contains(addr))
            {
                return(MemoryReader.ReadPtr(addr, out value));
            }

            return(GetRuntime().ReadPointer(addr, out value));
        }
Пример #6
0
        public override ulong GetMethodTable(ulong obj)
        {
            ulong mt;

            if (!MemoryReader.ReadPtr(obj, out mt))
            {
                return(0);
            }

            return(mt & ~(ulong)1);
        }
Пример #7
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;
                    }
                }
            }
        }