示例#1
0
        internal MethodEntry(MonoSymbolFile file, MyBinaryReader reader, int index)
        {
            this.SymbolFile = file;
            this.index      = index;

            Token                 = reader.ReadInt32();
            DataOffset            = reader.ReadInt32();
            LineNumberTableOffset = reader.ReadInt32();

            long old_pos = reader.BaseStream.Position;

            reader.BaseStream.Position = DataOffset;

            CompileUnitIndex         = reader.ReadLeb128();
            LocalVariableTableOffset = reader.ReadLeb128();
            NamespaceID = reader.ReadLeb128();

            CodeBlockTableOffset     = reader.ReadLeb128();
            ScopeVariableTableOffset = reader.ReadLeb128();

            RealNameOffset = reader.ReadLeb128();

            flags = (Flags)reader.ReadLeb128();

            reader.BaseStream.Position = old_pos;

            CompileUnit = file.GetCompileUnit(CompileUnitIndex);
        }
示例#2
0
        internal CompileUnitEntry(MonoSymbolFile file, MyBinaryReader reader)
        {
            this.file = file;

            Index      = reader.ReadInt32();
            DataOffset = reader.ReadInt32();
        }
示例#3
0
        internal SourceFileEntry(MonoSymbolFile file, MyBinaryReader reader)
        {
            this.file = file;

            Index      = reader.ReadInt32();
            DataOffset = reader.ReadInt32();

            int old_pos = (int)reader.BaseStream.Position;

            reader.BaseStream.Position = DataOffset;

            file_name      = reader.ReadString();
            guid           = reader.ReadBytes(16);
            hash           = reader.ReadBytes(16);
            auto_generated = reader.ReadByte() == 1;

            reader.BaseStream.Position = old_pos;
        }
示例#4
0
        MonoSymbolFile(Stream stream)
        {
            reader = new MyBinaryReader(stream);

            try {
                long magic         = reader.ReadInt64();
                int  major_version = reader.ReadInt32();
                int  minor_version = reader.ReadInt32();

                if (magic != OffsetTable.Magic)
                {
                    throw new MonoSymbolFileException("Symbol file is not a valid");
                }
                if (major_version != OffsetTable.MajorVersion)
                {
                    throw new MonoSymbolFileException(
                              "Symbol file has version {0} but expected {1}", major_version, OffsetTable.MajorVersion);
                }
                if (minor_version != OffsetTable.MinorVersion)
                {
                    throw new MonoSymbolFileException("Symbol file has version {0}.{1} but expected {2}.{3}",
                                                      major_version, minor_version,
                                                      OffsetTable.MajorVersion, OffsetTable.MinorVersion);
                }

                MajorVersion = major_version;
                MinorVersion = minor_version;
                guid         = new Guid(reader.ReadBytes(16));

                ot = new OffsetTable(reader, major_version, minor_version);
            } catch (Exception e) {
                throw new MonoSymbolFileException("Cannot read symbol file", e);
            }

            source_file_hash  = new Dictionary <int, SourceFileEntry> ();
            compile_unit_hash = new Dictionary <int, CompileUnitEntry> ();
        }