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 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 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; } }
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 AnonymousScopeEntry(MyBinaryReader reader) { ID = reader.ReadLeb128(); int num_captured_vars = reader.ReadLeb128(); for (int i = 0; i < num_captured_vars; i++) { captured_vars.Add(new CapturedVariable(reader)); } int num_captured_scopes = reader.ReadLeb128(); for (int i = 0; i < num_captured_scopes; i++) { captured_scopes.Add(new CapturedScope(reader)); } }
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; } }
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 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); }
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); }
internal CapturedScope(MyBinaryReader reader) { Scope = reader.ReadLeb128(); CapturedName = reader.ReadString(); }
internal ScopeVariable(MyBinaryReader reader) { Scope = reader.ReadLeb128(); Index = reader.ReadLeb128(); }
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 LocalVariableEntry(MonoSymbolFile file, MyBinaryReader reader) { Index = reader.ReadLeb128(); Name = reader.ReadString(); BlockIndex = 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); }
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(); } } } }
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) { this.Scope = reader.ReadLeb128(); this.Index = 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; } }
internal CapturedScope (MyBinaryReader reader) { Scope = reader.ReadLeb128 (); CapturedName = reader.ReadString (); }
internal LocalVariableEntry (MonoSymbolFile file, MyBinaryReader reader) { Index = reader.ReadLeb128 (); Name = reader.ReadString (); BlockIndex = reader.ReadLeb128 (); }