void LoadSourceFileIntoEditor(string file, sstSrcModule.SourceFileInformation?f = null) { // Assume all files not be modified since the last time of load. Better performance. if (file == lastOpenedFile) { return; } if (!File.Exists(file)) { MessageBox.Show(file + " cannot be found!"); return; } if (!f.HasValue) { f = GetFileInfo(dbg.MainProcess.MainModule, file); } MarkerStrategy.RemoveAll(); currentFrameMarker = null; editor.Load(lastOpenedFile = file); editor.IsReadOnly = true; // Highlight all lines where breakpoints can be set var lines = new List <int>(); if (f.HasValue) { foreach (var seg in f.Value.Segments) { for (int i = 0; i < seg.Lines.Length; i++) { var ln = seg.Lines[i]; var marker = new DebugInfoAvailableMarker(MarkerStrategy, editor.Document, ln, ln); MarkerStrategy.Add(marker); marker.Redraw(); marker.Tag = seg.Offsets[i]; // And highlight previously set breakpoints var bp = dbg.Breakpoints.ByAddress(dbg.MainProcess.MainModule.ToVirtualAddress((int)seg.Offsets[i])); if (bp != null) { var bpM = new BreakpointMarker(MarkerStrategy, bp, editor.Document, ln, ln); MarkerStrategy.Add(bpM); bpM.Redraw(); } } } } }
void LoadSourceFileIntoEditor(string file, sstSrcModule.SourceFileInformation? f = null) { // Assume all files not be modified since the last time of load. Better performance. if (file == lastOpenedFile) return; if (!File.Exists(file)) { MessageBox.Show(file + " cannot be found!"); return; } if (!f.HasValue) f = GetFileInfo(dbg.MainProcess.MainModule, file); MarkerStrategy.RemoveAll(); currentFrameMarker = null; editor.Load(lastOpenedFile = file); editor.IsReadOnly = true; // Highlight all lines where breakpoints can be set var lines = new List<int>(); if(f.HasValue) foreach (var seg in f.Value.Segments) for (int i = 0; i < seg.Lines.Length; i++) { var ln = seg.Lines[i]; var marker = new DebugInfoAvailableMarker(MarkerStrategy, editor.Document, ln, ln); MarkerStrategy.Add(marker); marker.Redraw(); marker.Tag = seg.Offsets[i]; // And highlight previously set breakpoints var bp = dbg.Breakpoints.ByAddress(dbg.MainProcess.MainModule.ToVirtualAddress((int)seg.Offsets[i])); if (bp != null) { var bpM = new BreakpointMarker(MarkerStrategy, bp, editor.Document, ln, ln); MarkerStrategy.Add(bpM); bpM.Redraw(); } } }