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); }
public LineNumberEntry(int file, int offset, int start_row, int end_row, int start_col, int end_col) : this(file, start_row, offset, false) { SourceRange = new SourceRangeEntry (start_row, end_row, start_col, end_col); }
public LineNumberEntry(int file, int row, int offset, bool is_hidden, SourceRangeEntry source_range) : this(file, row, offset, is_hidden) { this.SourceRange = source_range; }
public LineNumberEntry(int file, int row, int offset, bool is_hidden) { this.File = file; this.Row = row; this.Offset = offset; this.IsHidden = is_hidden; #if DEBUGGER_SOURCE this.SourceRange = null; #endif }