internal NamespaceEntry(MonoSymbolFile file, MyBinaryReader reader) { this.Name = reader.ReadString(); this.Index = reader.ReadLeb128(); this.Parent = reader.ReadLeb128(); int count = reader.ReadLeb128(); this.UsingClauses = new string[count]; for (int i = 0; i < count; i++) { this.UsingClauses[i] = reader.ReadString(); } }
//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 AnonymousScopeEntry(MyBinaryReader reader) { this.ID = reader.ReadLeb128(); int num_captured_vars = reader.ReadLeb128(); for (int i = 0; i < num_captured_vars; i++) { this.captured_vars.Add(new CapturedVariable(reader)); } int num_captured_scopes = reader.ReadLeb128(); for (int i = 0; i < num_captured_scopes; i++) { this.captured_scopes.Add(new CapturedScope(reader)); } }
internal CodeBlockEntry(int index, MyBinaryReader reader) { this.Index = index; int type_flag = reader.ReadLeb128(); this.BlockType = (CodeBlockEntry.Type)(type_flag & 63); this.Parent = reader.ReadLeb128(); this.StartOffset = reader.ReadLeb128(); this.EndOffset = reader.ReadLeb128(); if ((type_flag & 64) != 0) { int data_size = (int)reader.ReadInt16(); reader.BaseStream.Position += (long)data_size; } }
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); }
void ReadData() { if (creating) { throw new InvalidOperationException(); } lock (file) { if (namespaces != null) { return; } MyBinaryReader reader = file.BinaryReader; int old_pos = (int)reader.BaseStream.Position; reader.BaseStream.Position = DataOffset; int source_idx = reader.ReadLeb128(); source = file.GetSourceFile(source_idx); int count_includes = reader.ReadLeb128(); if (count_includes > 0) { include_files = new List <SourceFileEntry> (); for (int i = 0; i < count_includes; i++) { include_files.Add(file.GetSourceFile(reader.ReadLeb128())); } } int count_ns = reader.ReadLeb128(); namespaces = new List <NamespaceEntry> (); for (int i = 0; i < count_ns; i++) { namespaces.Add(new NamespaceEntry(file, reader)); } reader.BaseStream.Position = old_pos; } }
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> (); }
public LineNumberTable GetLineNumberTable() { lock (SymbolFile) { if (lnt != null) { return(lnt); } if (LineNumberTableOffset == 0) { return(null); } MyBinaryReader reader = SymbolFile.BinaryReader; long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = LineNumberTableOffset; lnt = LineNumberTable.Read(SymbolFile, reader); reader.BaseStream.Position = old_pos; return(lnt); } }
public LineNumberTable GetLineNumberTable() { lock (SymbolFile) { if (lnt != null) { return(lnt); } if (LineNumberTableOffset == 0) { return(null); } MyBinaryReader reader = SymbolFile.BinaryReader; long old_pos = reader.BaseStream.Position; reader.BaseStream.Position = LineNumberTableOffset; lnt = LineNumberTable.Read(SymbolFile, reader, (flags & Flags.ColumnsInfoIncluded) != 0, (flags & Flags.EndInfoIncluded) != 0); reader.BaseStream.Position = old_pos; return(lnt); } }
protected virtual void Dispose (bool disposing) { if (disposing) { if (reader != null) { reader.Close (); reader = null; } } }
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> (); }
private void DoRead(MonoSymbolFile file, MyBinaryReader br) { List<LineNumberEntry> lines = new List<LineNumberEntry>(); bool is_hidden = false; bool modified = false; int stm_line = 1; int stm_offset = 0; int stm_file = 1; byte opcode; while (true) { opcode = br.ReadByte(); if (opcode == 0) { byte size = br.ReadByte(); long end_pos = br.BaseStream.Position + (long)((ulong)size); opcode = br.ReadByte(); if (opcode == 1) { break; } if (opcode == 64) { is_hidden = !is_hidden; modified = true; } else { if (opcode < 64 || opcode > 127) { goto IL_B8; } } br.BaseStream.Position = end_pos; } else { if (opcode < this.OpcodeBase) { switch (opcode) { case 1: lines.Add(new LineNumberEntry(stm_file, stm_line, stm_offset, is_hidden)); modified = false; continue; case 2: stm_offset += br.ReadLeb128(); modified = true; continue; case 3: stm_line += br.ReadLeb128(); modified = true; continue; case 4: stm_file = br.ReadLeb128(); modified = true; continue; case 8: stm_offset += this.MaxAddressIncrement; modified = true; continue; } goto Block_8; } opcode -= this.OpcodeBase; stm_offset += (int)opcode / this.LineRange; stm_line += this.LineBase + (int)opcode % this.LineRange; lines.Add(new LineNumberEntry(stm_file, stm_line, stm_offset, is_hidden)); modified = false; } } if (modified) { lines.Add(new LineNumberEntry(stm_file, stm_line, stm_offset, is_hidden)); } this._line_numbers = new LineNumberEntry[lines.Count]; lines.CopyTo(this._line_numbers, 0); return; IL_B8: throw new MonoSymbolFileException("Unknown extended opcode {0:x} in LNT ({1})", new object[] { opcode, file.FileName }); Block_8: throw new MonoSymbolFileException("Unknown standard opcode {0:x} in LNT", new object[] { opcode }); }
internal ScopeVariable(MyBinaryReader reader) { Scope = reader.ReadLeb128(); Index = reader.ReadLeb128(); }
internal CapturedVariable(MyBinaryReader reader) { Name = reader.ReadString(); CapturedName = reader.ReadString(); Kind = (CapturedKind)reader.ReadByte(); }
//internal void WriteData(MyBinaryWriter bw) //{ // this.DataOffset = (int)bw.BaseStream.Position; // bw.WriteLeb128(this.source.Index); // int count_includes = (this.include_files != null) ? this.include_files.Count : 0; // bw.WriteLeb128(count_includes); // if (this.include_files != null) // { // foreach (SourceFileEntry entry in this.include_files) // { // bw.WriteLeb128(entry.Index); // } // } // bw.WriteLeb128(this.namespaces.Count); // foreach (NamespaceEntry ns in this.namespaces) // { // ns.Write(this.file, bw); // } //} //internal void Write(BinaryWriter bw) //{ // bw.Write(this.Index); // bw.Write(this.DataOffset); //} internal CompileUnitEntry(MonoSymbolFile file, MyBinaryReader reader) { this.file = file; this.Index = reader.ReadInt32(); this.DataOffset = reader.ReadInt32(); }
private void DoRead(MonoSymbolFile file, MyBinaryReader br) { List <LineNumberEntry> lines = new List <LineNumberEntry>(); bool is_hidden = false; bool modified = false; int stm_line = 1; int stm_offset = 0; int stm_file = 1; byte opcode; while (true) { opcode = br.ReadByte(); if (opcode == 0) { byte size = br.ReadByte(); long end_pos = br.BaseStream.Position + (long)((ulong)size); opcode = br.ReadByte(); if (opcode == 1) { break; } if (opcode == 64) { is_hidden = !is_hidden; modified = true; } else { if (opcode < 64 || opcode > 127) { goto IL_B8; } } br.BaseStream.Position = end_pos; } else { if (opcode < this.OpcodeBase) { switch (opcode) { case 1: lines.Add(new LineNumberEntry(stm_file, stm_line, stm_offset, is_hidden)); modified = false; continue; case 2: stm_offset += br.ReadLeb128(); modified = true; continue; case 3: stm_line += br.ReadLeb128(); modified = true; continue; case 4: stm_file = br.ReadLeb128(); modified = true; continue; case 8: stm_offset += this.MaxAddressIncrement; modified = true; continue; } goto Block_8; } opcode -= this.OpcodeBase; stm_offset += (int)opcode / this.LineRange; stm_line += this.LineBase + (int)opcode % this.LineRange; lines.Add(new LineNumberEntry(stm_file, stm_line, stm_offset, is_hidden)); modified = false; } } if (modified) { lines.Add(new LineNumberEntry(stm_file, stm_line, stm_offset, is_hidden)); } this._line_numbers = new LineNumberEntry[lines.Count]; lines.CopyTo(this._line_numbers, 0); return; IL_B8: throw new MonoSymbolFileException("Unknown extended opcode {0:x} in LNT ({1})", new object[] { opcode, file.FileName }); Block_8: throw new MonoSymbolFileException("Unknown standard opcode {0:x} in LNT", new object[] { opcode }); }
internal CapturedVariable (MyBinaryReader reader) { Name = reader.ReadString (); CapturedName = reader.ReadString (); Kind = (CapturedKind) reader.ReadByte (); }
internal LocalVariableEntry (MonoSymbolFile file, MyBinaryReader reader) { Index = reader.ReadLeb128 (); Name = reader.ReadString (); BlockIndex = reader.ReadLeb128 (); }
internal CodeBlockEntry (int index, MyBinaryReader reader) { this.Index = index; int type_flag = reader.ReadLeb128 (); BlockType = (Type) (type_flag & 0x3f); this.Parent = reader.ReadLeb128 (); this.StartOffset = reader.ReadLeb128 (); this.EndOffset = reader.ReadLeb128 (); /* Reserved for future extensions. */ if ((type_flag & 0x40) != 0) { int data_size = reader.ReadInt16 (); reader.BaseStream.Position += data_size; } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (reader != null) { ((IDisposable)reader).Dispose (); reader = null; } } }
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> (); }
void DoRead(MonoSymbolFile file, MyBinaryReader br) { ArrayList lines = new ArrayList (); bool is_hidden = false, modified = false; int stm_line = 1, stm_offset = 0, stm_file = 1; #if DEBUGGER_SOURCE SourceRangeEntry source_range = null; #endif while (true) { byte opcode = br.ReadByte (); if (opcode == 0) { byte size = br.ReadByte (); long end_pos = br.BaseStream.Position + size; opcode = br.ReadByte (); if (opcode == DW_LNE_end_sequence) { if (modified) #if DEBUGGER_SOURCE lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden, source_range)); #else lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden)); #endif break; } else if (opcode == DW_LNE_MONO_negate_is_hidden) { is_hidden = !is_hidden; modified = true; #if DEBUGGER_SOURCE } else if (opcode == DW_LNE_MONO_set_source_range) { int start_line = stm_line + br.ReadLeb128 (); int end_line = start_line + br.ReadLeb128 (); int start_col = br.ReadLeb128 (); int end_col = br.ReadLeb128 (); source_range = new SourceRangeEntry ( start_line, end_line, start_col, end_col); #endif } else if ((opcode >= DW_LNE_MONO__extensions_start) && (opcode <= DW_LNE_MONO__extensions_end)) { ; // reserved for future extensions } else { throw new MonoSymbolFileException ( "Unknown extended opcode {0:x} in LNT ({1})", opcode, file.FileName); } br.BaseStream.Position = end_pos; continue; } else if (opcode < OpcodeBase) { switch (opcode) { case DW_LNS_copy: #if DEBUGGER_SOURCE lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden, source_range)); source_range = null; #else lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden)); #endif modified = false; break; case DW_LNS_advance_pc: stm_offset += br.ReadLeb128 (); modified = true; break; case DW_LNS_advance_line: stm_line += br.ReadLeb128 (); modified = true; break; case DW_LNS_set_file: stm_file = br.ReadLeb128 (); modified = true; break; case DW_LNS_const_add_pc: stm_offset += MaxAddressIncrement; modified = true; break; default: throw new MonoSymbolFileException ( "Unknown standard opcode {0:x} in LNT", opcode); } } else { opcode -= OpcodeBase; stm_offset += opcode / LineRange; stm_line += LineBase + (opcode % LineRange); #if DEBUGGER_SOURCE lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden, source_range)); source_range = null; #else lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden)); #endif modified = false; } } _line_numbers = new LineNumberEntry [lines.Count]; lines.CopyTo (_line_numbers, 0); }
internal CapturedVariable(MyBinaryReader reader) { this.Name = reader.ReadString(); this.CapturedName = reader.ReadString(); this.Kind = (CapturedVariable.CapturedKind)reader.ReadByte(); }
internal ScopeVariable(MyBinaryReader reader) { this.Scope = reader.ReadLeb128(); this.Index = reader.ReadLeb128(); }
void DoRead(MonoSymbolFile file, MyBinaryReader br) { var lines = new List <LineNumberEntry> (); bool is_hidden = false, modified = false; int stm_line = 1, stm_offset = 0, stm_file = 1; while (true) { byte opcode = br.ReadByte(); if (opcode == 0) { byte size = br.ReadByte(); long end_pos = br.BaseStream.Position + size; opcode = br.ReadByte(); if (opcode == DW_LNE_end_sequence) { if (modified) { lines.Add(new LineNumberEntry( stm_file, stm_line, stm_offset, is_hidden)); } break; } else if (opcode == DW_LNE_MONO_negate_is_hidden) { is_hidden = !is_hidden; modified = true; } else if ((opcode >= DW_LNE_MONO__extensions_start) && (opcode <= DW_LNE_MONO__extensions_end)) { ; // reserved for future extensions } else { throw new MonoSymbolFileException("Unknown extended opcode {0:x}", opcode); } br.BaseStream.Position = end_pos; continue; } else if (opcode < OpcodeBase) { switch (opcode) { case DW_LNS_copy: lines.Add(new LineNumberEntry( stm_file, stm_line, stm_offset, is_hidden)); modified = false; break; case DW_LNS_advance_pc: stm_offset += br.ReadLeb128(); modified = true; break; case DW_LNS_advance_line: stm_line += br.ReadLeb128(); modified = true; break; case DW_LNS_set_file: stm_file = br.ReadLeb128(); modified = true; break; case DW_LNS_const_add_pc: stm_offset += MaxAddressIncrement; modified = true; break; default: throw new MonoSymbolFileException( "Unknown standard opcode {0:x} in LNT", opcode); } } else { opcode -= OpcodeBase; stm_offset += opcode / LineRange; stm_line += LineBase + (opcode % LineRange); lines.Add(new LineNumberEntry( stm_file, stm_line, stm_offset, is_hidden)); modified = false; } } _line_numbers = new LineNumberEntry [lines.Count]; lines.CopyTo(_line_numbers, 0); }
internal CapturedScope (MyBinaryReader reader) { Scope = reader.ReadLeb128 (); CapturedName = reader.ReadString (); }
private MonoSymbolFile(string filename) { this.FileName = filename; FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read); this.reader = new MyBinaryReader(stream); try { long magic = this.reader.ReadInt64(); int major_version = this.reader.ReadInt32(); int minor_version = this.reader.ReadInt32(); if (magic != 5037318119232611860L) { throw new MonoSymbolFileException("Symbol file `{0}' is not a valid Mono symbol file", new object[] { filename }); } if (major_version != 50) { throw new MonoSymbolFileException("Symbol file `{0}' has version {1}, but expected {2}", new object[] { filename, major_version, 50 }); } if (minor_version != 0) { throw new MonoSymbolFileException("Symbol file `{0}' has version {1}.{2}, but expected {3}.{4}", new object[] { filename, major_version, minor_version, 50, 0 }); } this.MajorVersion = major_version; this.MinorVersion = minor_version; this.guid = new Guid(this.reader.ReadBytes(16)); this.ot = new OffsetTable(this.reader, major_version, minor_version); } catch { throw new MonoSymbolFileException("Cannot read symbol file `{0}'", new object[] { filename }); } this.source_file_hash = new Dictionary<int, SourceFileEntry>(); this.compile_unit_hash = new Dictionary<int, CompileUnitEntry>(); }
void DoRead(MonoSymbolFile file, MyBinaryReader br, bool includesColumns, bool includesEnds) { var lines = new List <LineNumberEntry> (); bool is_hidden = false, modified = false; int stm_line = 1, stm_offset = 0, stm_file = 1; while (true) { byte opcode = br.ReadByte(); if (opcode == 0) { byte size = br.ReadByte(); long end_pos = br.BaseStream.Position + size; opcode = br.ReadByte(); if (opcode == DW_LNE_end_sequence) { if (modified) { lines.Add(new LineNumberEntry( stm_file, stm_line, -1, stm_offset, is_hidden)); } break; } else if (opcode == DW_LNE_MONO_negate_is_hidden) { is_hidden = !is_hidden; modified = true; } else if ((opcode >= DW_LNE_MONO__extensions_start) && (opcode <= DW_LNE_MONO__extensions_end)) { ; // reserved for future extensions } else { throw new MonoSymbolFileException("Unknown extended opcode {0:x}", opcode); } br.BaseStream.Position = end_pos; continue; } else if (opcode < OpcodeBase) { switch (opcode) { case DW_LNS_copy: lines.Add(new LineNumberEntry( stm_file, stm_line, -1, stm_offset, is_hidden)); modified = false; break; case DW_LNS_advance_pc: stm_offset += br.ReadLeb128(); modified = true; break; case DW_LNS_advance_line: stm_line += br.ReadLeb128(); modified = true; break; case DW_LNS_set_file: stm_file = br.ReadLeb128(); modified = true; break; case DW_LNS_const_add_pc: stm_offset += MaxAddressIncrement; modified = true; break; default: throw new MonoSymbolFileException( "Unknown standard opcode {0:x} in LNT", opcode); } } else { opcode -= OpcodeBase; stm_offset += opcode / LineRange; stm_line += LineBase + (opcode % LineRange); lines.Add(new LineNumberEntry( stm_file, stm_line, -1, stm_offset, is_hidden)); modified = false; } } _line_numbers = lines.ToArray(); if (includesColumns) { for (int i = 0; i < _line_numbers.Length; ++i) { var ln = _line_numbers[i]; if (ln.Row >= 0) { ln.Column = br.ReadLeb128(); } } } if (includesEnds) { for (int i = 0; i < _line_numbers.Length; ++i) { var ln = _line_numbers[i]; int row = br.ReadLeb128(); if (row == 0xffffff) { ln.EndRow = -1; ln.EndColumn = -1; } else { ln.EndRow = ln.Row + row; ln.EndColumn = br.ReadLeb128(); } } } }
internal CapturedVariable(MyBinaryReader reader) { this.Name = reader.ReadString(); this.CapturedName = reader.ReadString(); this.Kind = (CapturedVariable.CapturedKind)reader.ReadByte(); }
internal LocalVariableEntry(MonoSymbolFile file, MyBinaryReader reader) { Index = reader.ReadLeb128(); Name = reader.ReadString(); BlockIndex = reader.ReadLeb128(); }
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 CapturedScope(MyBinaryReader reader) { Scope = reader.ReadLeb128(); CapturedName = reader.ReadString(); }
internal static LineNumberTable Read (MonoSymbolFile file, MyBinaryReader br) { LineNumberTable lnt = new LineNumberTable (file); lnt.DoRead (file, br); return lnt; }
internal CompileUnitEntry (MonoSymbolFile file, MyBinaryReader reader) { this.file = file; Index = reader.ReadInt32 (); DataOffset = reader.ReadInt32 (); }
void DoRead (MonoSymbolFile file, MyBinaryReader br) { ArrayList lines = new ArrayList (); bool is_hidden = false, modified = false; int stm_line = 1, stm_offset = 0, stm_file = 1; while (true) { byte opcode = br.ReadByte (); if (opcode == 0) { byte size = br.ReadByte (); long end_pos = br.BaseStream.Position + size; opcode = br.ReadByte (); if (opcode == DW_LNE_end_sequence) { if (modified) lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden)); break; } else if (opcode == DW_LNE_MONO_negate_is_hidden) { is_hidden = !is_hidden; modified = true; } else throw new MonoSymbolFileException ( "Unknown extended opcode {0:x} in LNT ({1})", opcode, file.FileName); br.BaseStream.Position = end_pos; continue; } else if (opcode < OpcodeBase) { switch (opcode) { case DW_LNS_copy: lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden)); modified = false; break; case DW_LNS_advance_pc: stm_offset += br.ReadLeb128 (); modified = true; break; case DW_LNS_advance_line: stm_line += br.ReadLeb128 (); modified = true; break; case DW_LNS_set_file: stm_file = br.ReadLeb128 (); modified = true; break; case DW_LNS_const_add_pc: stm_offset += MaxAddressIncrement; modified = true; break; default: throw new MonoSymbolFileException ( "Unknown standard opcode {0:x} in LNT", opcode); } } else { opcode -= OpcodeBase; stm_offset += opcode / LineRange; stm_line += LineBase + (opcode % LineRange); lines.Add (new LineNumberEntry ( stm_file, stm_line, stm_offset, is_hidden)); modified = false; } } _line_numbers = new LineNumberEntry [lines.Count]; lines.CopyTo (_line_numbers, 0); }