Пример #1
0
        public void SetUp()
        {
            logSpy = new LogSpy();
            logSpy.Attach();

            taskContext = new JoinableTaskContext();

            returnObjectMock = Substitute.For <SbCommandReturnObject>();
            returnObjectMock.GetDescription().Returns(COMMAND_DESCRIPTION);

            commandInterpreterMock = Substitute.For <SbCommandInterpreter>();
            commandInterpreterMock.WhenForAnyArgs(x => x.HandleCommand(DUMMY_COMMAND,
                                                                       out returnObjectMock)).Do(x => x[1] = returnObjectMock);

            debuggerMock = Substitute.For <SbDebugger>();
            debuggerMock.GetCommandInterpreter().Returns(commandInterpreterMock);

            commandWindowText = "";

            commandWindowMock = Substitute.For <IVsCommandWindow>();
            commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x));

            commandWindowWriter = new CommandWindowWriter(taskContext, commandWindowMock);

            shell = new YetiVSI.LLDBShell.LLDBShell(taskContext, commandWindowWriter);
            shell.AddDebugger(debuggerMock);
        }
Пример #2
0
        public void ExecuteCommandWithNoCommandWindow()
        {
            // CommandWindowWriter grabs the SVsCommandWindow once in the constructor. If we change
            // the service provide mock we need to create a new CommandwindowWriter to pick up the
            // change.
            commandWindowWriter = new CommandWindowWriter(taskContext, null);
            shell = new YetiVSI.LLDBShell.LLDBShell(taskContext, commandWindowWriter);
            shell.AddDebugger(debuggerMock);

            shell.ExecuteCommand(DUMMY_COMMAND);

            Assert.That(logSpy.GetOutput(), Does.Contain(COMMAND_DESCRIPTION));
            Assert.That(logSpy.GetOutput(), Does.Contain(DUMMY_COMMAND));
        }
        private LLDBShellCommandTarget(JoinableTaskContext taskContext,
                                       IServiceProvider serviceProvider)
        {
            taskContext.ThrowIfNotOnMainThread();

            this.taskContext     = taskContext;
            this.serviceProvider = serviceProvider;
            commandWindowWriter  = new CommandWindowWriter(taskContext,
                                                           (IVsCommandWindow)serviceProvider.GetService(typeof(SVsCommandWindow)));
            var menuCommand = new OleMenuCommand(HandleLLDBCommand,
                                                 new CommandID(YetiConstants.CommandSetGuid, PkgCmdID.cmdidLLDBShellExec));

            // Accept any parameter value.
            menuCommand.ParametersDescription = "$";

            (serviceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService)
            ?.AddCommand(menuCommand);
        }
        DebuggerOptionsCommand(JoinableTaskContext taskContext,
                               YetiVSIService vsiService,
                               IDebugEngineManager debugEngineManager,
                               IVsCommandWindow commandWindow,
                               IMenuCommandService menuCommandService)
        {
            taskContext.ThrowIfNotOnMainThread();

            this.taskContext        = taskContext;
            this.debugEngineManager = debugEngineManager;
            this.vsiService         = vsiService;

            commandWindowWriter = new CommandWindowWriter(taskContext, commandWindow);
            var menuCommand = new OleMenuCommand(HandleCommand,
                                                 new CommandID(YetiConstants.CommandSetGuid, PkgCmdID.cmdidDebuggerOptionsCommand));

            // Accept any parameter value.
            menuCommand.ParametersDescription = "$";
            menuCommandService?.AddCommand(menuCommand);
        }
Пример #5
0
 public LLDBShell(JoinableTaskContext taskContext, CommandWindowWriter commandWindowWriter)
 {
     this.taskContext         = taskContext;
     this.commandWindowWriter = commandWindowWriter;
     debuggers = new HashSet <SbDebugger>();
 }
 public CommandTextWriter(JoinableTaskContext taskContext,
                          CommandWindowWriter cmdWindowWriter)
 {
     this.taskContext     = taskContext;
     this.cmdWindowWriter = cmdWindowWriter;
 }