コード例 #1
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 -= 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
ファイル: internal.cs プロジェクト: FrenchData/dotnetsamples
        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;
                    }
                }
            }
        }