Ejemplo n.º 1
0
        /// <summary>
        /// Handles the <c>ExecutionInterrupt</c> event of the debugger
        /// by displaying the interrupt reason and setting <c>Done</c> event.
        /// </summary>
        /// <param name="reason">The reason of the interrupt.</param>
        protected void ExecutionInterrupted(ExecutionInterruptReason reason)
        {
            // If (program loaded)
            if (reason.Exception == null || !(reason.Exception is NoProgramLoadedException))
            {
                if (reason.Exception != null)
                {
                    Console.WriteLine("EXCEPTION: " + reason.Exception.Message);
                }
                StringBuilder sb = new StringBuilder();
                foreach (Breakpoint bp in reason.HitBreakpoints)
                {
                    // Step breakpoints are internal and should not be displayed.
                    if (bp is StepBreakpoint)
                    {
                        continue;
                    }

                    sb.Append(", ");
                    sb.Append(Debugger.Breakpoints.IndexOf(bp));
                }
                string bps = sb.ToString();
                if (!string.IsNullOrEmpty(bps))
                {
                    Console.Write("BREAKPOINT(S):");
                    Console.WriteLine(bps.Remove(0, 1));
                }
                WriteLocation();
            }
            else
            {
                Console.WriteLine("Program unloaded.");
            }
            Done.Set();
        }
Ejemplo n.º 2
0
            public virtual void HandleExecutionInterrupt(ExecutionInterruptReason reason)
            {
                // If (program stopped)
                if (reason.Exception != null && reason.Exception is NoProgramLoadedException)
                {
                    Controller.State = States.NotLoaded;

                    if (_restart)
                    {
                        Controller.StepInto(false);
                    }
                }
            }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the execution interruption by calling the handler of the current IState.
        /// </summary>
        /// <param name="reason">The interrupt reason.</param>
        protected virtual void HandleExecutionInterrupt(ExecutionInterruptReason reason)
        {
            var main = Platform.Gui.MainForm;

            // Invoke will most likely be required because
            // Debugger runs in a separate thread.
            if (main.InvokeRequired)
            {
                main.BeginInvoke(new Action <ExecutionInterruptReason>(HandleExecutionInterrupt), reason);
                return;
            }

            ExecutionInterruptReason = reason;
            if (CurrentIState != null)
            {
                CurrentIState.HandleExecutionInterrupt(reason);
            }
        }
Ejemplo n.º 4
0
 public virtual void HandleExecutionInterrupt(ExecutionInterruptReason reason)
 {
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles the <c>ExecutionInterrupt</c> event of the debugger
        /// by displaying the interrupt reason and setting <c>Done</c> event.
        /// </summary>
        /// <param name="reason">The reason of the interrupt.</param>
        protected void ExecutionInterrupted(ExecutionInterruptReason reason)
        {
            // If (program loaded)
            if (reason.Exception == null || !(reason.Exception is NoProgramLoadedException))
            {
                if (reason.Exception != null)
                {
                    Console.WriteLine("EXCEPTION: " + reason.Exception.Message);
                }
                StringBuilder sb = new StringBuilder();
                foreach (Breakpoint bp in reason.HitBreakpoints)
                {
                    // Step breakpoints are internal and should not be displayed.
                    if (bp is StepBreakpoint) continue;

                    sb.Append(", ");
                    sb.Append(Debugger.Breakpoints.IndexOf(bp));
                }
                string bps = sb.ToString();
                if (!string.IsNullOrEmpty(bps))
                {
                    Console.Write("BREAKPOINT(S):");
                    Console.WriteLine(bps.Remove(0, 1));
                }
                WriteLocation();
            }
            else
            {
                Console.WriteLine("Program unloaded.");
            }
            Done.Set();
        }