Example #1
0
        public DebugInfo(byte[] image, int offset, Machine machine)
        {
            _machine = machine;

            // Get the id of the runtime function from the NativeArray
            uint lookback        = 0;
            uint debugInfoOffset = NativeReader.DecodeUnsigned(image, (uint)offset, ref lookback);

            if (lookback != 0)
            {
                System.Diagnostics.Debug.Assert(0 < lookback && lookback < offset);
                debugInfoOffset = (uint)offset - lookback;
            }

            NibbleReader reader             = new NibbleReader(image, (int)debugInfoOffset);
            uint         boundsByteCount    = reader.ReadUInt();
            uint         variablesByteCount = reader.ReadUInt();
            int          boundsOffset       = reader.GetNextByteOffset();
            int          variablesOffset    = (int)(boundsOffset + boundsByteCount);

            if (boundsByteCount > 0)
            {
                ParseBounds(image, boundsOffset);
            }

            if (variablesByteCount > 0)
            {
                ParseNativeVarInfo(image, variablesOffset);
            }
        }
Example #2
0
        private void EnsureInitialized()
        {
            if (_boundsList != null)
            {
                return;
            }
            ReadyToRunReader _readyToRunReader = _runtimeFunction.ReadyToRunReader;
            int offset = _offset;

            _boundsList    = new List <DebugInfoBoundsEntry>();
            _variablesList = new List <NativeVarInfo>();
            Machine machine = _readyToRunReader.Machine;

            byte[] image = _readyToRunReader.Image;
            _machine = machine;

            // Get the id of the runtime function from the NativeArray
            uint lookback        = 0;
            uint debugInfoOffset = NativeReader.DecodeUnsigned(image, (uint)offset, ref lookback);

            if (lookback != 0)
            {
                System.Diagnostics.Debug.Assert(0 < lookback && lookback < offset);
                debugInfoOffset = (uint)offset - lookback;
            }

            NibbleReader reader             = new NibbleReader(image, (int)debugInfoOffset);
            uint         boundsByteCount    = reader.ReadUInt();
            uint         variablesByteCount = reader.ReadUInt();
            int          boundsOffset       = reader.GetNextByteOffset();
            int          variablesOffset    = (int)(boundsOffset + boundsByteCount);

            if (boundsByteCount > 0)
            {
                ParseBounds(image, boundsOffset);
            }

            if (variablesByteCount > 0)
            {
                ParseNativeVarInfo(image, variablesOffset);
            }
        }