private void OnEndSession() { lock (_sessionLock) { if (_session != null) { _session.TargetUnhandledException -= _session_TargetStopped; _session.TargetStopped -= _session_TargetStopped; _session.TargetHitBreakpoint -= _session_TargetStopped; _session.TargetSignaled -= _session_TargetStopped; _session.TargetInterrupted -= _session_TargetStopped; _session.TargetExited -= _session_TargetExited; _session.TargetStarted -= _session_TargetStarted; _session.TargetReady -= _session_TargetReady; _session?.Dispose(); _session = null; } } Dispatcher.UIThread.InvokeAsync(() => { DebugSessionEnded?.Invoke(this, EventArgs.Empty); _studio.CurrentPerspective = Perspective.Normal; _lastDocument?.ClearDebugHighlight(); _lastDocument = null; // This will save breakpoints that were moved to be closer to actual sequence points. Breakpoints.Save(); }); }
public static void SetDebugHighlight(this IDebugLineDocumentTabViewModel model, int line, int startColumn = -1, int endColumn = -1) { model.DebugHighlight = new DebugHighlightLocation { Line = line, StartColumn = startColumn, EndColumn = endColumn }; }
private void _session_TargetStopped(object sender, TargetEventArgs e) { if (e.Backtrace != null && e.Backtrace.FrameCount > 0) { var currentFrame = e.Backtrace.GetFrame(0); var sourceLocation = currentFrame.SourceLocation; if (sourceLocation.FileName != null) { var normalizedPath = sourceLocation.FileName.NormalizePath(); ISourceFile file = null; var document = _studio.GetEditor(normalizedPath); if (document != null) { _lastDocument = document as IDebugLineDocumentTabViewModel; file = document?.SourceFile; } if (file == null) { file = _studio.CurrentSolution.FindFile(normalizedPath); } if (file != null) { Dispatcher.UIThread.InvokeAsync(async() => { _lastDocument = await _studio.OpenDocumentAsync(file, sourceLocation.Line, sourceLocation.Column, sourceLocation.EndColumn, true) as IDebugLineDocumentTabViewModel; }).Wait(); } else { _console.WriteLine("Unable to find file: " + normalizedPath); } } if (e.BreakEvent is WatchPoint) { var wp = e.BreakEvent as WatchPoint; _console.WriteLine($"Hit Watch Point {wp.Expression}"); } Dispatcher.UIThread.InvokeAsync(() => { TargetStopped?.Invoke(this, e); SetFrame(currentFrame); }).Wait(); } }
private void _session_TargetStarted(object sender, EventArgs e) { if (_lastDocument != null) { Dispatcher.UIThread.InvokeAsync(() => { _lastDocument.ClearDebugHighlight(); _lastDocument = null; }); } TargetStarted?.Invoke(this, e); }
public static void ClearDebugHighlight(this IDebugLineDocumentTabViewModel model) { model.SetDebugHighlight(-1); }