Esempio n. 1
0
        private void OnBreakpointUpdated(BreakpointUpdatedEventArgs e)
        {
            EventHandler <BreakpointUpdatedEventArgs> breakpointUpdated = this.BreakpointUpdated;

            if (breakpointUpdated != null)
            {
                breakpointUpdated(this, e);
            }
        }
Esempio n. 2
0
        private void OnBreakpointUpdated(BreakpointUpdatedEventArgs e)
        {
            EventHandler <BreakpointUpdatedEventArgs> breakpointUpdated = this.BreakpointUpdated;

            if (breakpointUpdated == null)
            {
                return;
            }
            breakpointUpdated((object)this, e);
        }
 void debugService_BreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
 {
     // TODO: Needed?
 }
Esempio n. 4
0
        /// <summary>
        /// This event handler adds or removes breakpoints monitored by Visual Studio.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Debugger_BreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
        {
            if (_initializingRunspace) return;

            if (e.UpdateType == BreakpointUpdateType.Set)
            {
                var lbp = e.Breakpoint as LineBreakpoint;
                if (lbp != null)
                {
                    var breakpoint = new ScriptBreakpoint(_node, e.Breakpoint.Script, lbp.Line, lbp.Column, _events);
                    breakpoint.Bind();

                    var bp = bps.FirstOrDefault(
                                                m =>
                                                m.Column == lbp.Column && m.Line == lbp.Line &&
                                                m.File.Equals(lbp.Script, StringComparison.InvariantCultureIgnoreCase));
                    if (bp == null)
                        bps.Add(breakpoint);
                }
            }

            if (e.UpdateType == BreakpointUpdateType.Removed)
            {
                var lbp = e.Breakpoint as LineBreakpoint;
                if (lbp != null)
                {
                    var bp =bps.FirstOrDefault(
                        m =>
                        m.Column == lbp.Column && m.Line == lbp.Line &&
                        m.File.Equals(lbp.Script, StringComparison.InvariantCultureIgnoreCase));

                    if (bp != null)
                    {
                        bp.Delete();
                        bps.Remove(bp);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// HandleBreakpointUpdated
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HandleBreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
        {
            // Ignore if we are in restricted mode.
            if (!IsDebuggingSupported()) { return; }

            if (LocalDebugMode)
            {
                // Forward event locally.
                RaiseBreakpointUpdatedEvent(e);
                return;
            }

            try
            {
                // Forward event to remote client.
                Dbg.Assert(_runspace != null, "Runspace cannot be null.");
                _runspace.ExecutionContext.Events.GenerateEvent(
                    sourceIdentifier: RemoteDebugger.RemoteDebuggerBreakpointUpdatedEvent,
                    sender: null,
                    args: new object[] { e },
                    extraData: null);
            }
            catch (Exception ex)
            {
                CommandProcessor.CheckForSevereException(ex);
            }
        }
Esempio n. 6
0
 private void OnBreakpointUpdated(BreakpointUpdatedEventArgs e)
 {
     EventHandler<BreakpointUpdatedEventArgs> breakpointUpdated = this.BreakpointUpdated;
     if (breakpointUpdated != null)
     {
         breakpointUpdated(this, e);
     }
 }
Esempio n. 7
0
 private void DebuggerOnBreakpointUpdated(object sender, BreakpointUpdatedEventArgs args)
 {
     if (Interactive)
     {
         if (args.Breakpoint is LineBreakpoint)
         {
             var breakpoint = args.Breakpoint as LineBreakpoint;
             if (string.Equals(breakpoint.Script, DebugFile, StringComparison.OrdinalIgnoreCase))
             {
                 var message = Message.Parse(this, "ise:setbreakpoint");
                 message.Arguments.Add("Line", (breakpoint.Line - 1).ToString());
                 message.Arguments.Add("Action", args.UpdateType.ToString());
                 SendUiMessage(message);
             }
         }
     }
 }
        private void OnBreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
        {
            List<Breakpoint> breakpoints = null;

            // Normalize the script filename for proper indexing
            string normalizedScriptName = e.Breakpoint.Script.ToLower();

            // Get the list of breakpoints for this file
            if (!this.breakpointsPerFile.TryGetValue(normalizedScriptName, out breakpoints))
            {
                breakpoints = new List<Breakpoint>();
                this.breakpointsPerFile.Add(
                    normalizedScriptName,
                    breakpoints);
            }

            // Add or remove the breakpoint based on the update type
            if (e.UpdateType == BreakpointUpdateType.Set)
            {
                breakpoints.Add(e.Breakpoint);
            }
            else if(e.UpdateType == BreakpointUpdateType.Removed)
            {
                breakpoints.Remove(e.Breakpoint);
            }
            else
            {
                // TODO: Do I need to switch out instances for updated breakpoints?
            }

            if (this.BreakpointUpdated != null)
            {
                this.BreakpointUpdated(sender, e);
            }
        }
Esempio n. 9
0
 void OnBreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.Breakpoint.Script))
     {
         var bp = e.Breakpoint as LineBreakpoint;
         if (bp != null)
         {
             if (e.UpdateType == BreakpointUpdateType.Removed)
                 Breakpoints.Remove(bp);
             else
                 Breakpoints.Add(bp);
         }
     }
 }
Esempio n. 10
0
 protected void RaiseBreakpointUpdatedEvent(BreakpointUpdatedEventArgs args)
 {
     BreakpointUpdated.SafeInvoke<BreakpointUpdatedEventArgs>(this, args);
 }
Esempio n. 11
0
 protected virtual void HandleBreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
 {
     this.RaiseBreakpointUpdatedEvent(e);
 }
Esempio n. 12
0
        private void HandleBreakpointUpdated(object sender, BreakpointUpdatedEventArgs e)
        {
            switch (e.UpdateType)
            {
                case BreakpointUpdateType.Set:
                    AddNewBreakpoint(e.Breakpoint);
                    break;

                case BreakpointUpdateType.Removed:
                    RemoveBreakpoint(e.Breakpoint);
                    break;

                case BreakpointUpdateType.Enabled:
                    EnableBreakpoint(e.Breakpoint);
                    break;

                case BreakpointUpdateType.Disabled:
                    DisableBreakpoint(e.Breakpoint);
                    break;
            }
        }
Esempio n. 13
0
 /// <summary>
 /// Raises the BreakpointUpdated event
 /// </summary>
 /// <param name="e"></param>
 private void OnBreakpointUpdated(BreakpointUpdatedEventArgs e)
 {
     RaiseBreakpointUpdatedEvent(e);
 }
        // 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)
        {
            // Write message to console.
            ConsoleColor saveFGColor = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine();

            switch (args.UpdateType)
            {
                case BreakpointUpdateType.Set:
                    if (!_breakPoints.ContainsKey(args.Breakpoint.Id))
                    {
                        _breakPoints.Add(args.Breakpoint.Id, args.Breakpoint);
                    }
                    Console.WriteLine("Breakpoint created:");
                    break;

                case BreakpointUpdateType.Removed:
                    _breakPoints.Remove(args.Breakpoint.Id);
                    Console.WriteLine("Breakpoint removed:");
                    break;

                case BreakpointUpdateType.Enabled:
                    Console.WriteLine("Breakpoint enabled:");
                    break;

                case BreakpointUpdateType.Disabled:
                    Console.WriteLine("Breakpoint disabled:");
                    break;
            }

            Console.WriteLine(args.Breakpoint.ToString());
            Console.WriteLine();
            Console.ForegroundColor = saveFGColor;
        }