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); }
internal CompileUnitEntry(MonoSymbolFile file, MyBinaryReader reader) { this.file = file; Index = reader.ReadInt32(); DataOffset = reader.ReadInt32(); }
MonoSymbolFile(string filename) { this.FileName = filename; FileStream stream; try { stream = new FileStream(filename, FileMode.Open, FileAccess.Read); reader = new MyBinaryReader(stream); } catch (IOException ex) { throw new MonoSymbolFileException( "Cannot read symbol file `{0}': {1}", filename, ex.Message); } try { long magic = reader.ReadInt64(); int major_version = reader.ReadInt32(); int minor_version = reader.ReadInt32(); if (magic != OffsetTable.Magic) { throw new MonoSymbolFileException( "Symbol file `{0}' is not a valid " + "Mono symbol file", filename); } if (major_version != OffsetTable.MajorVersion) { throw new MonoSymbolFileException( "Symbol file `{0}' has version {1}, " + "but expected {2}", filename, major_version, OffsetTable.MajorVersion); } if (minor_version != OffsetTable.MinorVersion) { throw new MonoSymbolFileException( "Symbol file `{0}' has version {1}.{2}, " + "but expected {3}.{4}", filename, 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 { throw new MonoSymbolFileException( "Cannot read symbol file `{0}'", filename); } source_file_hash = new Hashtable(); compile_unit_hash = new Hashtable(); }
//internal void WriteData(MyBinaryWriter bw) //{ // this.DataOffset = (int)bw.BaseStream.Position; // bw.Write(this.file_name); // if (this.guid == null) // { // this.guid = Guid.NewGuid().ToByteArray(); // try // { // using (FileStream fs = new FileStream(this.file_name, FileMode.Open, FileAccess.Read)) // { // MD5 md5 = MD5.Create(); // this.hash = md5.ComputeHash(fs); // } // } // catch // { // this.hash = new byte[16]; // } // } // bw.Write(this.guid); // bw.Write(this.hash); // bw.Write(this.auto_generated ? 1 : 0); //} //internal void Write(BinaryWriter bw) //{ // bw.Write(this.Index); // bw.Write(this.DataOffset); //} internal SourceFileEntry(MonoSymbolFile file, MyBinaryReader reader) { this.file = file; this.Index = reader.ReadInt32(); this.DataOffset = reader.ReadInt32(); int old_pos = (int)reader.BaseStream.Position; reader.BaseStream.Position = (long)this.DataOffset; this.file_name = reader.ReadString(); //??this.guid = reader.ReadBytes(16); this.hash = reader.ReadBytes(16); this.auto_generated = (reader.ReadByte() == 1); reader.BaseStream.Position = (long)old_pos; }
//internal void WriteData(MyBinaryWriter bw) //{ // this.DataOffset = (int)bw.BaseStream.Position; // bw.Write(this.file_name); // if (this.guid == null) // { // this.guid = Guid.NewGuid().ToByteArray(); // try // { // using (FileStream fs = new FileStream(this.file_name, FileMode.Open, FileAccess.Read)) // { // MD5 md5 = MD5.Create(); // this.hash = md5.ComputeHash(fs); // } // } // catch // { // this.hash = new byte[16]; // } // } // bw.Write(this.guid); // bw.Write(this.hash); // bw.Write(this.auto_generated ? 1 : 0); //} //internal void Write(BinaryWriter bw) //{ // bw.Write(this.Index); // bw.Write(this.DataOffset); //} internal SourceFileEntry(MonoSymbolFile file, MyBinaryReader reader) { this.file = file; this.Index = reader.ReadInt32(); this.DataOffset = reader.ReadInt32(); int old_pos = (int)reader.BaseStream.Position; reader.BaseStream.Position = (long)this.DataOffset; this.file_name = reader.ReadString(); this.guid = reader.ReadBytes(16); this.hash = reader.ReadBytes(16); this.auto_generated = (reader.ReadByte() == 1); reader.BaseStream.Position = (long)old_pos; }
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; }
internal MethodEntry(MonoSymbolFile file, MyBinaryReader reader, int index) { this.SymbolFile = file; this.index = index; this.Token = reader.ReadInt32(); this.DataOffset = reader.ReadInt32(); this.LineNumberTableOffset = reader.ReadInt32(); long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = (long)this.DataOffset; this.CompileUnitIndex = reader.ReadLeb128(); this.LocalVariableTableOffset = reader.ReadLeb128(); this.NamespaceID = reader.ReadLeb128(); this.CodeBlockTableOffset = reader.ReadLeb128(); this.ScopeVariableTableOffset = reader.ReadLeb128(); this.RealNameOffset = reader.ReadLeb128(); this.flags = (MethodEntry.Flags)reader.ReadLeb128(); reader.BaseStream.Position = old_pos; this.CompileUnit = file.GetCompileUnit(this.CompileUnitIndex); }
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> (); }
MonoSymbolFile (string filename) { this.FileName = filename; FileStream stream = new FileStream (filename, FileMode.Open, FileAccess.Read); 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 `{0}' is not a valid " + "Mono symbol file", filename); if (major_version != OffsetTable.MajorVersion) throw new MonoSymbolFileException ( "Symbol file `{0}' has version {1}, " + "but expected {2}", filename, major_version, OffsetTable.MajorVersion); if (minor_version != OffsetTable.MinorVersion) throw new MonoSymbolFileException ( "Symbol file `{0}' has version {1}.{2}, " + "but expected {3}.{4}", filename, 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 { throw new MonoSymbolFileException ( "Cannot read symbol file `{0}'", filename); } source_file_hash = new Dictionary<int, SourceFileEntry> (); compile_unit_hash = new Dictionary<int, CompileUnitEntry> (); }
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; }
internal CompileUnitEntry (MonoSymbolFile file, MyBinaryReader reader) { this.file = file; Index = reader.ReadInt32 (); DataOffset = reader.ReadInt32 (); }
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> (); }