예제 #1
0
        public SledDebugService(
            MainForm mainForm,
            IStatusService statusService,
            ICommandService commandService)
        {
            m_mainForm = mainForm;

            m_connectStatus      = statusService.AddText(350);
            m_connectStatus.Text = Localization.SledDisconnected;

            m_recvBuf.Reset();
            m_curTarget = null;
            m_netPlugin = null;

            SetEndianness(Endian.Unknown);

            // Create a new menu for debugging options
            commandService.RegisterMenu(
                Menu.Debug,
                Localization.SledDebugMenuTitle,
                Localization.SledDebugMenuTitleComment);

            // Command to start debugging
            commandService.RegisterCommand(
                Command.Start,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledDebugMenuStart,
                Localization.SledDebugMenuStartComment,
                Keys.F5,
                SledIcon.DebugStart,
                CommandVisibility.All,
                this);

            commandService.RegisterCommand(
                Command.CurrentStatement,
                Menu.Debug,
                CommandGroup.Debug,
                "&Current Statement",
                "Jump to current statement",
                Keys.Alt | Keys.Multiply,
                SledIcon.BreakpointCsi,
                CommandVisibility.All,
                this);

            // Command to step through a line while debugging
            commandService.RegisterCommand(
                Command.StepInto,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledDebugMenuStep,
                Localization.SledDebugMenuStepComment,
                Keys.F11,
                SledIcon.DebugStepInto,
                CommandVisibility.All,
                this);

            // Command to step over while debugging
            commandService.RegisterCommand(
                Command.StepOver,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledDebugMenuStepOver,
                Localization.SledDebugMenuStepOverComment,
                Keys.F10,
                SledIcon.DebugStepOver,
                CommandVisibility.All,
                this);

            // Command to step out while debugging
            commandService.RegisterCommand(
                Command.StepOut,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledDebugMenuStepOut,
                Localization.SledDebugMenuStepOutComment,
                Keys.Shift | Keys.F11,
                SledIcon.DebugStepOut,
                CommandVisibility.All,
                this);

            // Command to stop debugging
            commandService.RegisterCommand(
                Command.Stop,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledDebugMenuStop,
                Localization.SledDebugMenuStopComment,
                Keys.Shift | Keys.F5,
                SledIcon.DebugStop,
                CommandVisibility.All,
                this);

            // Command to connect to a remote target
            commandService.RegisterCommand(
                Command.Connect,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledDebugMenuConnect,
                Localization.SledDebugMenuConnectComment,
                Keys.F7,
                SledIcon.DebugConnect,
                CommandVisibility.All,
                this);

            // Command to disconnect from a remote target
            commandService.RegisterCommand(
                Command.Disconnect,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledDebugMenuDisconnect,
                Localization.SledDebugMenuDisconnectComment,
                Keys.F8,
                SledIcon.DebugDisconnect,
                CommandVisibility.All,
                this);

            // Toggle a single breakpoint on/off
            commandService.RegisterCommand(
                Command.ToggleBreakpoint,
                Menu.Debug,
                CommandGroup.Debug,
                Localization.SledProjectMenuToggleBreakpoint,
                Localization.SledProjectMenuToggleBreakpointComment,
                Keys.F9,
                SledIcon.ProjectToggleBreakpoint,
                CommandVisibility.Menu,
                this);

            RegisterDebugCommands(commandService, this);
        }