Ejemplo n.º 1
0
        public static string InsertBreakpoint(Breakpoint bp, int token)
        {
            var res = MIDebugger.Request(token.ToString() + "-break-insert -f " +
                                         bp.ToString());

            if (res.Class != MIResultClass.Done)
            {
                return(null);
            }

            return(((MIConst)((MITuple)res["bkpt"])["number"]).CString);
        }
Ejemplo n.º 2
0
        public void Show()
        {
            // active editor
            if (Far.Api.Window.Kind == WindowKind.Editor)
            {
                _editor = Far.Api.Editor;
            }

            // menu loop
            for (_toStop = false; ; _menu.Items.Clear())
            {
                // new breakpoint by types
                _menu.Add("&Line breakpoint...", OnLineBreakpoint);
                _menu.Add("&Command breakpoint...", OnCommandBreakpoint);
                _menu.Add("&Variable breakpoint...", OnVariableBreakpoint);

                // breakpoint collection
                _breakpoints = A.InvokeCode("Get-PSBreakpoint");
                if (_breakpoints.Count > 0)
                {
                    // separator
                    _menu.Add("Breakpoints").IsSeparator = true;

                    // breakpoints
                    int n = 0;
                    foreach (PSObject o in _breakpoints)
                    {
                        Breakpoint bp = (Breakpoint)o.BaseObject;

                        ++n;
                        string text = bp.ToString();
                        if (n <= 9)
                        {
                            text = "&" + Kit.ToString(n) + " " + text;
                        }

                        FarItem mi = _menu.Add(text);
                        mi.Checked = bp.Enabled;
                        mi.Data    = bp;
                    }
                }

                // go
                if (!_menu.Show() || _toStop)
                {
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gathers the list of breakpoints to process and calls ProcessBreakpoints
        /// </summary>
        protected override void ProcessRecord()
        {
            if (ParameterSetName.Equals("Breakpoint", StringComparison.OrdinalIgnoreCase))
            {
                foreach (Breakpoint breakpoint in _breakpoints)
                {
                    if (ShouldProcessInternal(breakpoint.ToString()))
                    {
                        ProcessBreakpoint(breakpoint);
                    }
                }
            }
            else
            {
                Debug.Assert(ParameterSetName.Equals("Id", StringComparison.OrdinalIgnoreCase));

                foreach (int i in _ids)
                {
                    Breakpoint breakpoint = this.Context.Debugger.GetBreakpoint(i);

                    if (breakpoint == null)
                    {
                        WriteError(
                            new ErrorRecord(
                                new ArgumentException(StringUtil.Format(Debugger.BreakpointIdNotFound, i)),
                                "PSBreakpoint:BreakpointIdNotFound",
                                ErrorCategory.InvalidArgument,
                                null));
                        continue;
                    }

                    if (ShouldProcessInternal(breakpoint.ToString()))
                    {
                        ProcessBreakpoint(breakpoint);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public static void InsertBreakpoint(Breakpoint bp, int token)
 {
     Assert.Equal(MIResultClass.Done,
                  MIDebugger.Request(token.ToString() + "-break-insert -f "
                                     + bp.ToString()).Class);
 }