예제 #1
0
            /// <summary>
            /// Updates the Hardware pad if the specified debugger state is Suspended.
            /// </summary>
            /// <param name="state">The debugger controller state.</param>
            protected override void UpdateHardwarePad(DebuggerController.States state)
            {
                var c = HardwarePad.Content;

                if (state == DebuggerController.States.Suspended)
                {
                    c["Registers"]["PC"] = Platform.DebuggerController.Debugger.Target.Registers["PC"].ToString();
                    c["Registers"]["SP"] = Platform.DebuggerController.Debugger.Target.Registers["SP"].ToString();
                    var    target = Platform.DebuggerController.Debugger.Target as MessyLab.Debugger.Target.Pico.PicoTarget;
                    string asm;
                    string bin;
                    target.VirtualMachine.Disassembler.Disassemble(out asm, out bin);
                    c["Current Instruction"]["Symbolic"] = asm;
                    if (bin.Contains("  "))
                    {
                        string[] b = bin.Split(new string[] { "  " }, StringSplitOptions.None);
                        c["Current Instruction"]["Instruction"] = b[0];
                        c["Current Instruction"]["Constant"]    = b[1];
                    }
                    else
                    {
                        c["Current Instruction"]["Instruction"] = bin;
                        c["Current Instruction"]["Constant"]    = string.Empty;
                    }
                }
                else
                {
                    c["Registers"]["PC"] = "?";
                    c["Registers"]["SP"] = "?";
                    c["Current Instruction"]["Symbolic"]    = "?";
                    c["Current Instruction"]["Instruction"] = "?";
                    c["Current Instruction"]["Constant"]    = "?";
                }
            }
예제 #2
0
            /// <summary>
            /// Updates Debug Menus and Toolbars according to the specified debugger state.
            /// </summary>
            /// <param name="state">The debugger state.</param>
            protected virtual void UpdateDebugMenusAndToolbars(DebuggerController.States state)
            {
                DebugToolStripMenuItem.Enabled = DebugToolStripButton.Enabled =
                    state != DebuggerController.States.Running;

                PauseToolStripMenuItem.Enabled = PauseToolStripButton.Enabled =
                    state == DebuggerController.States.Running;

                StopToolStripMenuItem.Enabled = StopToolStripButton.Enabled =
                    state != DebuggerController.States.NotLoaded;

                RestartToolStripMenuItem.Enabled = RestartToolStripButton.Enabled =
                    state != DebuggerController.States.NotLoaded;

                StepIntoToolStripMenuItem.Enabled =
                    state == DebuggerController.States.NotLoaded ||
                    state == DebuggerController.States.Suspended;

                bool suspended = state == DebuggerController.States.Suspended;

                StepOverToolStripMenuItem.Enabled     = suspended;
                StepOutToolStripMenuItem.Enabled      = suspended;
                StepBackIntoToolStripMenuItem.Enabled = suspended;
                StepBackOverToolStripMenuItem.Enabled = suspended;
                StepBackOutToolStripMenuItem.Enabled  = suspended;
            }
예제 #3
0
 /// <summary>
 /// Updates the content of the Watch pad according to the specified debugger state.
 /// </summary>
 /// <param name="state">The debugger state.</param>
 protected virtual void UpdateWatchPad(DebuggerController.States state)
 {
     WatchPad.CanEdit = state == DebuggerController.States.Suspended;
     foreach (var item in WatchPad.WatchItems)
     {
         UpdateWatchItem(item);
     }
 }
예제 #4
0
 /// <summary>
 /// Updates the content of the Breakpoints pad according to the specified debugger state.
 /// </summary>
 /// <param name="state">The debugger state.</param>
 protected virtual void UpdateBreakpointsPad(DebuggerController.States state)
 {
     if (state == DebuggerController.States.Suspended)
     {
         var reason = Platform.DebuggerController.ExecutionInterruptReason;
         if (reason != null && reason.HitBreakpoints != null)
         {
             BreakpointsPad.HighlightBreakpoints(reason.HitBreakpoints);
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Loads breakpoints to debugger on program start.
 /// </summary>
 /// <param name="state">The current debugger state.</param>
 protected void DebuggerController_StateChanged(DebuggerController.States state)
 {
     if (state != DebuggerController.States.NotLoaded)
     {
         if (_debuggerControllerState == DebuggerController.States.NotLoaded)
         {
             LoadLineBreakpointsFromOpenEditors();
             LoadBreakpointsToDebugger();
         }
     }
     _debuggerControllerState = state;
 }
예제 #6
0
            /// <summary>
            /// Updates GUI elements according to the specified debugger state.
            /// </summary>
            /// <param name="state">The debugger state.</param>
            public virtual void Update(DebuggerController.States state)
            {
                UpdateDebugMenusAndToolbars(state);
                UpdateWatchPad(state);
                UpdateHardwarePad(state);
                UpdateBreakpointsPad(state);

                // Debugger Exception handling.
                if (state == DebuggerController.States.Suspended)
                {
                    HandleDebuggerException();
                }
            }
예제 #7
0
        /// <summary>
        /// Handles the debugger state change.
        /// </summary>
        /// <param name="state"></param>
        protected void DebuggerController_StateChanged(DebuggerController.States state)
        {
            var editors = Editors as DebuggableEditorProvider;

            editors.Update(state);
            var gui = Gui as DebuggableGuiProvider;

            gui.Update(state);

            // Note: Using a reverse order, i.e. GUI, then Editors would cause
            // the editor not the highlight the current line at the prompt
            // displayed by the GUI update on exception.
            // It would not be a bug per se, but it would be an inconvenience
            // for the user..
        }
예제 #8
0
            /// <summary>
            /// Updates editors according to the specified debugger state.
            /// </summary>
            /// <param name="state">The debugger state.</param>
            public virtual void Update(DebuggerController.States state)
            {
                switch (state)
                {
                case DebuggerController.States.NotLoaded:
                    EditorsReadOnly = false;
                    ClearHighlightedLines();
                    break;

                case DebuggerController.States.Suspended:
                    EditorsReadOnly = true;
                    var dc = Platform.DebuggerController;
                    HighlightLine(dc.HighlightedFile, dc.HighlightedLine);
                    break;

                case DebuggerController.States.Running:
                    EditorsReadOnly = true;
                    ClearHighlightedLines();
                    break;
                }
            }
예제 #9
0
 /// <summary>
 /// Updates the content of the Hardware pad according to the specified debugger state.
 /// </summary>
 /// <param name="state">The debugger state.</param>
 protected abstract void UpdateHardwarePad(DebuggerController.States state);
예제 #10
0
 /// <summary>
 /// Loads breakpoints to debugger on program start.
 /// </summary>
 /// <param name="state">The current debugger state.</param>
 protected void DebuggerController_StateChanged(DebuggerController.States state)
 {
     if (state != DebuggerController.States.NotLoaded)
     {
         if (_debuggerControllerState == DebuggerController.States.NotLoaded)
         {
             LoadLineBreakpointsFromOpenEditors();
             LoadBreakpointsToDebugger();
         }
     }
     _debuggerControllerState = state;
 }