protected override void ProcessRecord()
 {
     if (base.ParameterSetName.Equals("Breakpoint", StringComparison.OrdinalIgnoreCase))
     {
         foreach (System.Management.Automation.Breakpoint breakpoint in this._breakpoints)
         {
             if (base.ShouldProcess(breakpoint.ToString()))
             {
                 this.ProcessBreakpoint(breakpoint);
             }
         }
     }
     else
     {
         foreach (int num in this._ids)
         {
             System.Management.Automation.Breakpoint breakpoint2 = base.Context.Debugger.GetBreakpoint(num);
             if (breakpoint2 == null)
             {
                 base.WriteError(new ErrorRecord(new ArgumentException(StringUtil.Format(UtilityDebuggerStrings.BreakpointIdNotFound, num)), "PSBreakpoint:BreakpointIdNotFound", ErrorCategory.InvalidArgument, null));
             }
             else if (base.ShouldProcess(breakpoint2.ToString()))
             {
                 this.ProcessBreakpoint(breakpoint2);
             }
         }
     }
 }
 protected override void ProcessBreakpoint(Breakpoint breakpoint)
 {
     base.Context.Debugger.DisableBreakpoint(breakpoint);
     if (this._passThru)
     {
         base.WriteObject(breakpoint);
     }
 }
Beispiel #3
0
 internal void AddBreakpointCommon(Breakpoint breakpoint)
 {
     if (this._context._debuggingMode == 0)
     {
         this._context._debuggingMode = 1;
     }
     this.OnBreakpointUpdated(new BreakpointUpdatedEventArgs(breakpoint, BreakpointUpdateType.Set));
     this._idToBreakpoint[breakpoint.Id] = breakpoint;
 }
        /// <summary>
        /// Creates an instance of the BreakpointDetails class from a
        /// PowerShell Breakpoint object.
        /// </summary>
        /// <param name="breakpoint">The Breakpoint instance from which details will be taken.</param>
        /// <returns>A new instance of the BreakpointDetails class.</returns>
        public static BreakpointDetails Create(Breakpoint breakpoint)
        {
            Validate.IsNotNull("breakpoint", breakpoint);

            LineBreakpoint lineBreakpoint = breakpoint as LineBreakpoint;
            if (lineBreakpoint != null)
            {
                return new BreakpointDetails
                {
                    LineNumber = lineBreakpoint.Line
                };
            }
            else
            {
                throw new ArgumentException(
                    "Expected breakpoint type:" + breakpoint.GetType().Name);
            }
        }
Beispiel #5
0
        internal void AddBreakpointCommon(Breakpoint breakpoint)
        {
            if (_context._debuggingMode == 0)
            {
                SetInternalDebugMode(InternalDebugMode.Enabled);
            }

            _idToBreakpoint[breakpoint.Id] = breakpoint;
            OnBreakpointUpdated(new BreakpointUpdatedEventArgs(breakpoint, BreakpointUpdateType.Set, _idToBreakpoint.Count));
        }
Beispiel #6
0
 internal void DisableBreakpoint(Breakpoint bp)
 {
     bp.EnabledInternal = false;
     this.OnBreakpointUpdated(new BreakpointUpdatedEventArgs(bp, BreakpointUpdateType.Disabled));
 }
Beispiel #7
0
 internal void EnableBreakpoint(Breakpoint bp)
 {
     bp.SetEnabled(true);
     this.OnBreakpointUpdated(new BreakpointUpdatedEventArgs(bp, BreakpointUpdateType.Enabled));
 }
Beispiel #8
0
 internal void RemoveBreakpoint(Breakpoint breakpoint)
 {
     if (this._idToBreakpoint.ContainsKey(breakpoint.Id))
     {
         this._idToBreakpoint.Remove(breakpoint.Id);
     }
     breakpoint.RemoveSelf(this);
     if (this._idToBreakpoint.Count == 0)
     {
         this._context._debuggingMode = 0;
     }
     this.OnBreakpointUpdated(new BreakpointUpdatedEventArgs(breakpoint, BreakpointUpdateType.Removed));
 }
 /// <summary>
 /// Removes the given breakpoint
 /// </summary>
 protected override void ProcessBreakpoint(Breakpoint breakpoint)
 {
     this.Context.Debugger.RemoveBreakpoint(breakpoint);
 }
Beispiel #10
0
 internal void DisableBreakpoint(Breakpoint bp)
 {
     bp.SetEnabled(false);
     this.OnBreakpointUpdated(new BreakpointUpdatedEventArgs(bp, BreakpointUpdateType.Disabled));
 }
        /// <summary>
        /// Enables the given breakpoint
        /// </summary>
        protected override void ProcessBreakpoint(Breakpoint breakpoint)
        {
            this.Context.Debugger.EnableBreakpoint(breakpoint);

            if (_passThru)
            {
                WriteObject(breakpoint);
            }
        }
 /// <summary>
 /// Process the given breakpoint
 /// </summary>
 protected abstract void ProcessBreakpoint(Breakpoint breakpoint);
 protected abstract void ProcessBreakpoint(System.Management.Automation.Breakpoint breakpoint);
Beispiel #14
0
 /// <summary>
 /// Initializes the BreakpointUpdatedEventArgs 
 /// </summary>
 internal BreakpointUpdatedEventArgs(Breakpoint breakpoint, BreakpointUpdateType updateType, int breakpointCount)
 {
     this.Breakpoint = breakpoint;
     this.UpdateType = updateType;
     this.BreakpointCount = breakpointCount;
 }
Beispiel #15
0
 /// <summary>
 /// Implementation of Disable-PSBreakpoint cmdlet.
 /// </summary>
 internal void DisableBreakpoint(Breakpoint bp)
 {
     bp.SetEnabled(false);
     OnBreakpointUpdated(new BreakpointUpdatedEventArgs(bp, BreakpointUpdateType.Disabled, _idToBreakpoint.Count));
 }
Beispiel #16
0
        // This is the implementation of the Remove-PSBreakpoint cmdlet.
        internal void RemoveBreakpoint(Breakpoint breakpoint)
        {
            _idToBreakpoint.Remove(breakpoint.Id);

            breakpoint.RemoveSelf(this);

            if (_idToBreakpoint.Count == 0)
            {
                // The last breakpoint was removed, turn off debugging.
                SetInternalDebugMode(InternalDebugMode.Disabled);
            }

            OnBreakpointUpdated(new BreakpointUpdatedEventArgs(breakpoint, BreakpointUpdateType.Removed, _idToBreakpoint.Count));
        }
Beispiel #17
0
        private void AddNewBreakpoint(Breakpoint breakpoint)
        {
            LineBreakpoint lineBreakpoint = breakpoint as LineBreakpoint;
            if (lineBreakpoint != null)
            {
                AddLineBreakpoint(lineBreakpoint);
                return;
            }

            CommandBreakpoint cmdBreakpoint = breakpoint as CommandBreakpoint;
            if (cmdBreakpoint != null)
            {
                AddCommandBreakpoint(cmdBreakpoint);
                return;
            }

            VariableBreakpoint varBreakpoint = breakpoint as VariableBreakpoint;
            if (varBreakpoint != null)
            {
                AddVariableBreakpoint(varBreakpoint);
            }
        }