示例#1
0
 void AdjustCanExecutes()
 {
     RestartCommand.RaiseCanExecuteChanged();
     RunToBacktrackCommand.RaiseCanExecuteChanged();
     RunToSuccessCommand.RaiseCanExecuteChanged();
     StepIntoCommand.RaiseCanExecuteChanged();
     StepOverCommand.RaiseCanExecuteChanged();
     ReturnToCallerCommand.RaiseCanExecuteChanged();
 }
示例#2
0
        public void CoreDumpVerifyActions(ITestSettings settings)
        {
            this.TestPurpose("This test checks to see the behavior when do actions during core dump debugging.");
            this.WriteSettings(settings);

            this.Comment("Compile the application");
            CompileApp(this, settings, DebuggeeMonikers.CoreDump.Action);

            this.Comment("Set initial debuggee for application");
            IDebuggee debuggee = OpenDebuggee(this, settings, DebuggeeMonikers.CoreDump.Action);

            this.Comment("Launch the application to hit an exception and generate core dump");
            string coreDumpPath = GenerateCoreDump(settings, DebuggeeMonikers.CoreDump.Action, debuggee);

            using (IDebuggerRunner runner = CreateDebugAdapterRunner(settings))
            {
                this.Comment("Configure the core dump before start debugging");
                runner.LaunchCoreDump(settings.DebuggerSettings, debuggee, coreDumpPath);

                this.Comment("Start debugging to hit the exception and verify it should stop at correct source file and line");
                runner.Expects.StoppedEvent(StoppedReason.Exception, srcClassName, 8).AfterConfigurationDone();

                this.Comment("Verify the error message for relevant actions during core dump debugging");
                using (IThreadInspector threadInspector = runner.GetThreadInspector())
                {
                    this.Comment("Get current frame object");
                    IFrameInspector currentFrame = threadInspector.Stack.First();

                    this.Comment("Verify current frame when stop at the exception");
                    threadInspector.AssertStackFrameNames(true, "myException::RaisedUnhandledException.*");

                    this.Comment("Try to evaluate a expression and verify the results");

                    string varEvalResult = currentFrame.Evaluate("result + 1");
                    Assert.Equal("11", varEvalResult);

                    this.Comment("Try to evaluate a function and verify the error message");
                    EvaluateResponseValue evalResponse = runner.RunCommand(new EvaluateCommand("EvalFunc(100, 100)", currentFrame.Id));
                    // TODO: From VSCode IDE with the latest cpptools, the error message after evaluate function is "not availabe", but evalResponse.message is null, is it expected ?
                    // Currently just simply verify the result is empty as a workaround, need to revisit this once get more information from logged bug #242418
                    this.Comment(string.Format(CultureInfo.InvariantCulture, "Actual evaluated result: {0}", evalResponse.body.result));
                    Assert.True(evalResponse.body.result.Equals(string.Empty));

                    this.Comment(string.Format(CultureInfo.InvariantCulture, "Actual evaluated respone message: {0}", evalResponse.message));
                    //Assert.True(evalResponse.message.Contains(evalError));
                }

                this.Comment("Try to step in and verify the error message");
                StepInCommand stepInCommand = new StepInCommand(runner.DarRunner.CurrentThreadId);
                runner.RunCommandExpectFailure(stepInCommand);
                this.WriteLine(string.Format(CultureInfo.InvariantCulture, "Actual respone message: {0}", stepInCommand.Message));
                Assert.Contains(stepInCommand.Message, string.Format(CultureInfo.InvariantCulture, stepError, "step in"));

                this.Comment("Try to step over and verify the error message");
                StepOverCommand stepOverCommand = new StepOverCommand(runner.DarRunner.CurrentThreadId);
                runner.RunCommandExpectFailure(stepOverCommand);
                this.WriteLine(string.Format(CultureInfo.InvariantCulture, "Actual respone message: {0}", stepOverCommand.Message));
                Assert.Contains(stepOverCommand.Message, string.Format(CultureInfo.InvariantCulture, stepError, "step next"));

                this.Comment("Try to step out and verify the error message");
                StepOutCommand stepOutCommand = new StepOutCommand(runner.DarRunner.CurrentThreadId);
                runner.RunCommandExpectFailure(stepOutCommand);
                this.WriteLine(string.Format(CultureInfo.InvariantCulture, "Actual respone message: {0}", stepOutCommand.Message));
                Assert.Contains(stepOutCommand.Message, string.Format(CultureInfo.InvariantCulture, stepError, "step out"));

                this.Comment("Try to continue and verify the error message");
                ContinueCommand continueCommand = new ContinueCommand(runner.DarRunner.CurrentThreadId);
                runner.RunCommandExpectFailure(continueCommand);
                this.WriteLine(string.Format(CultureInfo.InvariantCulture, "Actual respone message: {0}", continueCommand.Message));
                Assert.Contains(continueCommand.Message, string.Format(CultureInfo.InvariantCulture, stepError, "continue"));

                this.Comment("Try to set a breakpoint and verify the error message");
                SourceBreakpoints           bp            = debuggee.Breakpoints(srcAppName, 16);
                SetBreakpointsResponseValue setBpResponse = runner.SetBreakpoints(bp);
                Assert.False(setBpResponse.body.breakpoints[0].verified);
                this.WriteLine(string.Format(CultureInfo.InvariantCulture, "Actual respone message: {0}", setBpResponse.body.breakpoints[0].message));
                Assert.Contains(setBpResponse.body.breakpoints[0].message, bpError);

                this.Comment("Stop core dump debugging");
                runner.DisconnectAndVerify();
            }
        }
示例#3
0
 private Task <ICommandResponse <StepOverCommand> > StepOverCommand(StepOverCommand arg)
 {
     this.BreakOn = BreakableScriptPoint.Any;
     Continue();
     return(Task.FromResult <ICommandResponse <StepOverCommand> >(new StepOverCommandResponse()));
 }
示例#4
0
        public DebugManager()
        {
            BreakPointManager = new BreakPointManager();

            StartDebuggingCommand = ReactiveCommand.Create();
            StartDebuggingCommand.Subscribe(async o =>
            {
                switch (_shell.CurrentPerspective)
                {
                case Perspective.Editor:
                    if (o == null)
                    {
                        o = _shell.CurrentSolution.StartupProject;
                    }

                    if (o is IProject)
                    {
                        var masterProject = o as IProject;

                        //WorkspaceViewModel.Instance.SaveAllCommand.Execute(null);

                        Task.Factory.StartNew(async() =>
                        {
                            //WorkspaceViewModel.Instance.ExecutingCompileTask = true;

                            if (await masterProject.ToolChain.Build(_console, masterProject))
                            {
                                //Debugger = masterProject.SelectedDebugAdaptor;

                                if (CurrentDebugger != null)
                                {
                                    //await WorkspaceViewModel.Instance.DispatchDebug((Action)(() =>
                                    {
                                        StartDebug(masterProject);
                                    }                                             //));
                                }
                                else
                                {
                                    _console.WriteLine(
                                        "You have not selected a debug adaptor. Please goto Tools->Options to configure your debug adaptor.");
                                }
                            }

                            //WorkspaceViewModel.Instance.ExecutingCompileTask = false;
                        });
                    }
                    break;

                case Perspective.Debug:
                    // Begin dispatch otherwise UI is awaiting debugger. Inversion of control.
                    //WorkspaceViewModel.Instance.BeginDispatchDebug(() =>
                    {
                        PrepareToRun();
                        await CurrentDebugger.ContinueAsync();
                    }                     //);
                    break;
                }
            } /*, (o) =>
               * {
               * bool result = false;
               *
               * switch (WorkspaceViewModel.Instance.CurrentPerspective)
               * {
               * case Perspective.Editor:
               * if (WorkspaceViewModel.Instance.SolutionExplorer.SelectedProject != null && !WorkspaceViewModel.Instance.ExecutingCompileTask)
               * {
               * result = true;
               * }
               * break;
               *
               * case Perspective.Debug:
               * result = StepCommandsCanExecute(o);
               * break;
               * }
               *
               * return result;
               * }*/                        );

            RestartDebuggingCommand = ReactiveCommand.Create();
            //(o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && !IsUpdating);
            RestartDebuggingCommand.Subscribe(_ =>
            {
                SetDebuggers(currentDebugger);

                // Begin dispatch other wise ui thread is awaiting the debug thread. Inversion of control.
                //WorkspaceViewModel.Instance.BeginDispatchDebug(() =>
                {
                    PrepareToRun();
                    //Debugger.Reset(project.UserData.RunImmediately);
                }                 //);
            });

            StopDebuggingCommand = ReactiveCommand.Create();
            //(o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && !IsUpdating);
            StopDebuggingCommand.Subscribe(_ => { Stop(); });

            InterruptDebuggingCommand = ReactiveCommand.Create();
            //, (o) => WorkspaceViewModel.Instance.CurrentPerspective == Perspective.Debug && Debugger != null && Debugger.State == DebuggerState.Running && !IsUpdating);
            InterruptDebuggingCommand.Subscribe(async _ => { await CurrentDebugger.PauseAsync(); });

            StepIntoCommand = ReactiveCommand.Create();             //stepcommand can execute.
            StepIntoCommand.Subscribe(_ => { StepInto(); });

            StepInstructionCommand = ReactiveCommand.Create();             // }, StepCommandsCanExecute);
            StepInstructionCommand.Subscribe(_ => { StepInstruction(); });

            StepOverCommand = ReactiveCommand.Create();             // }, StepCommandsCanExecute);
            StepOverCommand.Subscribe(_ => { StepOver(); });

            StepOutCommand = ReactiveCommand.Create();             // , StepCommandsCanExecute);
            StepOutCommand.Subscribe(_ => { StepOut(); });
        }