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 CapturedVariable(MyBinaryReader reader) { Name = reader.ReadString(); CapturedName = reader.ReadString(); Kind = (CapturedKind)reader.ReadByte(); }
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(); } } } }