public int CompareTo(object obj) { LineEntry entry = (LineEntry)obj; if (entry.Address < Address) { return(1); } else if (entry.Address > Address) { return(-1); } else { return(0); } }
protected override LineNumberTableData ReadLineNumbers() { ArrayList lines = new ArrayList (); int last_line = -1; JitLineNumberEntry[] line_numbers = address.LineNumbers.ToArray (); string[] cil_code = wrapper.MethodSource.SourceBuffer.Contents; int[] cil_offsets = new int [cil_code.Length]; int last_cil_offset = 0; for (int i = 0; i < cil_code.Length; i++) { if (!cil_code [i].StartsWith ("IL_")) { cil_offsets [i] = last_cil_offset; continue; } string offset = cil_code [i].Substring (3, 4); last_cil_offset = Int32.Parse (offset, NumberStyles.HexNumber); cil_offsets [i] = last_cil_offset; } lines.Add (new LineEntry (wrapper.StartAddress, 0, 1)); for (int i = 0; i < line_numbers.Length; i++) { JitLineNumberEntry lne = line_numbers [i]; generate_line_number (lines, wrapper.StartAddress + lne.Address, lne.Offset, cil_offsets, ref last_line); } lines.Sort (); LineEntry[] addresses = new LineEntry [lines.Count]; lines.CopyTo (addresses, 0); return new LineNumberTableData (1, cil_code.Length, addresses); }
public LineNumberTableData(int start, int end, LineEntry[] addresses) { this.StartRow = start; this.EndRow = end; this.Addresses = addresses; }
SourceAddress create_address(LineEntry entry, int line_offset, int line_range) { SourceFile file = null; SourceBuffer buffer = null; if (entry.File != 0) { file = File.GetSourceFile (entry.File); } else { if (Method.MethodSource.HasSourceFile) file = Method.MethodSource.SourceFile; if (Method.MethodSource.HasSourceBuffer) buffer = Method.MethodSource.SourceBuffer; } return new SourceAddress (file, buffer, entry.Line, line_offset, line_range, entry.SourceRange); }