示例#1
0
 public void AddBreakPoint(BreakPoint breakpoint)
 {
     if (!BreakPoints.Any(b => b.Address == breakpoint.Address))
     {
         BreakPoints.Add(breakpoint);
         GDBConnector.AddBreakPoint(breakpoint.Address);
         NotifyBreakPointChange();
     }
 }
示例#2
0
        private bool CheckforCancellation()
        {
            if (IsPaused)
            {
                return(true);
            }

            if (_skipCycles && PictureProcessingUnit.TotalCycles >= cyclesToSkip)
            {
                _skipCycles = false;

                return(true);
            }

            if (BreakPoints.Any(x => x.IsEnabled && x.BreakPointType == BreakPointType.Execute && x.ConvertedAddress == Processor.ProgramCounter))
            {
                return(true);
            }

            return(false);
        }
示例#3
0
        void IconBarMargin_MouseDown(AbstractMargin sender, Point mousepos, MouseButtons mouseButtons)
        {
            if (mouseButtons != MouseButtons.Left)
            {
                return;
            }

            var textArea = _textEditor.ActiveTextAreaControl.TextArea;

            int yPos       = mousepos.Y;
            int lineHeight = textArea.TextView.FontHeight;
            int lineNumber = (yPos + textArea.VirtualTop.Y) / lineHeight;

            if (BreakPoints.Any(p => p.Line == lineNumber + 1) || lineNumber >= textArea.Document.TotalNumberOfLines)
            {
                return;
            }

            string text   = textArea.Document.GetText(textArea.Document.GetLineSegment(lineNumber));
            int    offset = -1;

            for (int i = 0; i < text.Length; i++)
            {
                if (
                    !Char.IsWhiteSpace(text[i]) &&
                    text[i] != '/'
                    )
                {
                    offset = i;
                    break;
                }
            }

            if (offset == -1)
            {
                return;
            }

            var breakPoint = new EditorBreakPoint(lineNumber + 1, offset);

            BreakPoints.Add(breakPoint);

            if (_script != null)
            {
                breakPoint.BreakPoint = new BreakPoint(Script.Script, lineNumber + 1, offset);
                _script.Engine.BreakPoints.Add(breakPoint.BreakPoint);
            }

            var document = _textEditor.Document;

            var mark = new BreakPointMark(
                document,
                new TextLocation(
                    offset,
                    lineNumber
                    )
                );

            mark.Removed += (s, e) =>
            {
                BreakPoints.Remove(breakPoint);
                _script?.Engine.BreakPoints.Remove(breakPoint.BreakPoint);
            };

            document.BookmarkManager.AddMark(mark);

            _textEditor.Refresh();
        }