Пример #1
0
        // Method to handle the Debugger BreakpointUpdated event.
        // This method will display the current breakpoint change and maintain a
        // collection of all current breakpoints.
        private void HandlerBreakpointUpdatedEvent(object sender, BreakpointUpdatedEventArgs args)
        {
            switch (args.UpdateType)
            {
            case BreakpointUpdateType.Set:
                if (!BreakPoints.ContainsKey(args.Breakpoint.Id))
                {
                    BreakPoints.Add(args.Breakpoint.Id, args.Breakpoint);
                }
                UserIOImpl.PrintMessage("HandlerBreakpointUpdatedEvent> breakpoint created");
                break;

            case BreakpointUpdateType.Removed:
                BreakPoints.Remove(args.Breakpoint.Id);
                UserIOImpl.PrintMessage("HandlerBreakpointUpdatedEvent> breakpoint removed");
                break;

            case BreakpointUpdateType.Enabled:
                UserIOImpl.PrintMessage("HandlerBreakpointUpdatedEvent> breakpoint enabled");
                break;

            case BreakpointUpdateType.Disabled:
                UserIOImpl.PrintMessage("HandlerBreakpointUpdatedEvent> breakpoint disabled");
                break;
            }

            UserIOImpl.PrintMessage(args.Breakpoint.ToString());
        }
Пример #2
0
        public void AddBreakPoint(BreakPoint bp)
        {
            if (_editingBreakPoint != null)
            {
                // Copy state (number, condition, trip count etc...)
                bp.CopyState(_editingBreakPoint);

                // Replace it
                var index = _allBreakPoints.IndexOf(_editingBreakPoint);
                _allBreakPoints[index] = bp;

                PrepareBreakPoints();

                // Save
                OnSettingsChanged();
                WriteLine("Edited {0}", bp);
                return;
            }

            if (_allBreakPoints.Count > 0)
            {
                bp.Number = _allBreakPoints.Max(x => x.Number) + 1;
            }
            else
            {
                bp.Number = 1;
            }

            BreakPoints.Add(bp);

            PrepareBreakPoints();
            OnSettingsChanged();

            WriteLine("Added {0}", bp.ToString());
        }
Пример #3
0
        private async Task Build(string str)
        {
            str = str.Trim();
            var resultCode = CheckCode(str);

            if (resultCode != 0)
            {
                Message = $"line {resultCode}: Error! IncorrectCommand";
                return;
            }
            BreakPoints.Clear();
            foreach (var command in Commands)
            {
                if (command.IsBreakpointSet)
                {
                    BreakPoints.Add(command.CommandId);
                }
            }
            Commands = FromsStringtoCommands(str);
            for (int i = 0; i < Commands.Count; i++)
            {
                if (BreakPoints.Contains(Commands[i].CommandId))
                {
                    Commands[i].IsBreakpointSet = true;
                }
            }
            CurrentCommand = Commands.First();

            SaveProjectCommand.Execute("Build");
            await Task.Factory.StartNew(() => SendMessage("Sucessfully Compiled!"));

            Start();
        }
Пример #4
0
 public void AddBreakPoint(BreakPoint breakpoint)
 {
     if (!BreakPoints.Any(b => b.Address == breakpoint.Address))
     {
         BreakPoints.Add(breakpoint);
         GDBConnector.AddBreakPoint(breakpoint.Address);
         NotifyBreakPointChange();
     }
 }
Пример #5
0
 public void ApplyBreakPoints()
 {
     Break -= OnBreakEvent;
     int[] breakPoints = Debugger.GetBreakPoints(ModuleName);
     if (breakPoints != null)
     {
         if (breakPoints.Length > 0)
         {
             BreakPoints.Clear();
             foreach (int line in breakPoints)
             {
                 var bp = new BreakPoint(line, 0);
                 BreakPoints.Add(bp);
             }
             Break += OnBreakEvent;
         }
     }
 }
Пример #6
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();
        }
Пример #7
0
 private void AddBreakPoint(JToken bp) => BreakPoints.Add(BreakPointsConverter.FromDto(bp.ToObject <BreakPointDto>()));