예제 #1
0
        private void UpdateCurrentLocation()
        {
            var newCurrent = Dataphoria.Debugger.CurrentLocation;

            // Remove the existing current bookmark if it is no longer accurate
            if (_currentBookmark != null && (newCurrent == null || !_currentBookmark.Locator.Equals(newCurrent)))
            {
                _textEdit.Document.BookmarkManager.RemoveMark(_currentBookmark);
                _currentBookmark.RemoveMarker();
                _currentBookmark = null;
            }

            // Add a new current bookmark if needed and appropriate
            if
            (
                _currentBookmark == null &&
                newCurrent != null &&
                Service.LocatorNameMatches(newCurrent.Locator) &&
                newCurrent.Line >= 1 &&
                newCurrent.Line <= _textEdit.Document.TotalNumberOfLines
            )
            {
                var location = new TextLocation(newCurrent.LinePos < 1 ? 0 : newCurrent.LinePos - 1, newCurrent.Line - 1);
                _currentBookmark = new CurrentLineBookmark(_textEdit.Document, location, newCurrent);
                AddBookmark(_currentBookmark);
            }
        }
예제 #2
0
 public override void Execute(object parameter)
 {
     if (CurrentDebugger.IsDebugging && !CurrentDebugger.IsProcessRunning)
     {
         CurrentLineBookmark.Remove();
         CurrentDebugger.Continue();
         MainWindow.Instance.SetStatus("Running...", Brushes.Black);
     }
 }
예제 #3
0
        public override void JumpToCurrentLine(string sourceFullFilename, int startLine, int startColumn, int endLine, int endColumn)
        {
            IViewContent viewContent = FileService.OpenFile(sourceFullFilename);

            if (viewContent != null)
            {
                IPositionable positionable = viewContent.GetService <IPositionable>();
                if (positionable != null)
                {
                    positionable.JumpTo(startLine, startColumn);
                }
            }
            CurrentLineBookmark.SetPosition(viewContent, startLine, startColumn, endLine, endColumn);
        }
        void UpdateCurrentLineBookmark(int lineNumber)
        {
            if (lineNumber <= 0)
            {
                return;
            }

            CurrentLineBookmark.SetPosition(codeView.TextEditor.FileName, codeView.TextEditor.Document, lineNumber, 0, lineNumber, 0);
            var currentLineBookmark = BookmarkManager.Bookmarks.OfType <CurrentLineBookmark>().FirstOrDefault();

            if (currentLineBookmark != null)
            {
                // update bookmark & marker
                codeView.IconBarManager.Bookmarks.Add(currentLineBookmark);
                currentLineBookmark.Document = this.codeView.TextEditor.Document;
            }
        }
예제 #5
0
        void SyncCurrentLineBookmark()
        {
            // checks
            if (CurrentLineBookmark.Instance == null)
            {
                return;
            }

            var oldMappings = DebugInformation.OldCodeMappings;
            var newMappings = DebugInformation.CodeMappings;

            if (oldMappings == null || newMappings == null)
            {
                return;
            }

            // 1. Save it's data
            int line       = CurrentLineBookmark.Instance.LineNumber;
            var markerType = CurrentLineBookmark.Instance.MemberReference;

            if (!oldMappings.ContainsKey(markerType.MetadataToken.ToInt32()) || !newMappings.ContainsKey(markerType.MetadataToken.ToInt32()))
            {
                return;
            }

            // 2. Remove it
            CurrentLineBookmark.Remove();

            // 3. map the marker line
            int token;
            var instruction = oldMappings[markerType.MetadataToken.ToInt32()].GetInstructionByLineNumber(line, out token);

            if (instruction == null)
            {
                return;
            }

            MemberReference memberReference;
            int             newline;

            if (newMappings[markerType.MetadataToken.ToInt32()].GetInstructionByTokenAndOffset(token, instruction.ILInstructionOffset.From, out memberReference, out newline))
            {
                // 4. create breakpoint for new languages
                CurrentLineBookmark.SetPosition(memberReference, newline, 0, newline, 0);
            }
        }
예제 #6
0
        void UpdateDebugUI(bool isDecompilationOk)
        {
            // sync bookmarks
            iconMargin.SyncBookmarks();

            if (isDecompilationOk)
            {
                if (DebugInformation.DebugStepInformation != null && DebuggerService.CurrentDebugger != null)
                {
                    // repaint bookmarks
                    iconMargin.InvalidateVisual();

                    // show the currentline marker
                    int             token    = DebugInformation.DebugStepInformation.Item1;
                    int             ilOffset = DebugInformation.DebugStepInformation.Item2;
                    int             line;
                    MemberReference member;
                    if (DebugInformation.CodeMappings == null || !DebugInformation.CodeMappings.ContainsKey(token))
                    {
                        return;
                    }

                    if (!DebugInformation.CodeMappings[token].GetInstructionByTokenAndOffset(ilOffset, out member, out line))
                    {
                        return;
                    }

                    // update marker
                    DebuggerService.JumpToCurrentLine(member, line, 0, line, 0, ilOffset);

                    var          bm      = CurrentLineBookmark.Instance;
                    DocumentLine docline = textEditor.Document.GetLineByNumber(line);
                    bm.Marker = bm.CreateMarker(textMarkerService, docline.Offset + 1, docline.Length);

                    UnfoldAndScroll(line);
                }
            }
            else
            {
                // remove currentline marker
                CurrentLineBookmark.Remove();
            }
        }
예제 #7
0
 public static void JumpToCurrentLine(MemberReference memberReference, int startLine, int startColumn, int endLine, int endColumn, int ilOffset)
 {
     CurrentLineBookmark.SetPosition(memberReference, startLine, startColumn, endLine, endColumn, ilOffset);
 }
예제 #8
0
        /* TODO: reimplement this stuff
         * static void ViewContentOpened(object sender, ViewContentEventArgs e)
         * {
         *              textArea.IconBarMargin.MouseDown += IconBarMouseDown;
         *              textArea.ToolTipRequest          += TextAreaToolTipRequest;
         *              textArea.MouseLeave              += TextAreaMouseLeave;
         * }*/

        public static void RemoveCurrentLineMarker()
        {
            CurrentLineBookmark.Remove();
        }
예제 #9
0
 public override void RemoveCurrentLineMarker()
 {
     CurrentLineBookmark.Remove();
 }