public void FillWithSource() { cachedLines.Clear(); StackFrame sf = DebuggingService.CurrentFrame; session = sf.DebuggerSession; if (currentFile != sf.SourceLocation.FileName) { AssemblyLine[] asmLines = sf.DebuggerSession.DisassembleFile(sf.SourceLocation.FileName); if (asmLines == null) { // Mixed disassemble not supported Fill(); return; } currentFile = sf.SourceLocation.FileName; addressLines.Clear(); editor.Text = string.Empty; using (var sr = new StreamReader(sf.SourceLocation.FileName)) { string line; int sourceLine = 1; int na = 0; int editorLine = 1; var sb = new StringBuilder(); var asmLineNums = new List <int> (); while ((line = sr.ReadLine()) != null) { InsertSourceLine(sb, editorLine++, line); while (na < asmLines.Length && asmLines [na].SourceLine == sourceLine) { asmLineNums.Add(editorLine); InsertAssemblerLine(sb, editorLine++, asmLines [na++]); } sourceLine++; } editor.Text = sb.ToString(); foreach (int li in asmLineNums) { editor.AddMarker(li, asmMarker); } } } int aline; if (!addressLines.TryGetValue(GetAddrId(sf.Address, sf.AddressSpace), out aline)) { return; } UpdateCurrentLineMarker(true); }
private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e) { int newPosition = _trackingPoint.GetPosition(_trackingPoint.TextBuffer.CurrentSnapshot) - 1; if (newPosition != _marker.Offset) { TextEditor.RemoveMarker(_marker); _marker = TextMarkerFactory.CreateGenericTextSegmentMarker(TextEditor, TextSegmentMarkerEffect.Underline, _marker.Color, newPosition, 1); TextEditor.AddMarker(_marker); } }