public void StopWhenLldbShellIsNull()
        {
            _lldbShell = null;
            _attachedProgram.Stop();

            Received.InOrder(() => { _eventManager.StopListener(); });
        }
        public void SetUp()
        {
            _lldbShell         = Substitute.For <ILLDBShell>();
            _breakpointManager = Substitute.For <IBreakpointManager>();
            _moduleFileLoader  = Substitute.For <IModuleFileLoader>();

            _debugger           = Substitute.For <SbDebugger>();
            _target             = Substitute.For <RemoteTarget>();
            _listenerSubscriber = Substitute.For <ILldbListenerSubscriber>();
            _process            = Substitute.For <SbProcess>();

            _debugEngineHandler = Substitute.For <IDebugEngineHandler>();
            _taskExecutor       = Substitute.For <ITaskExecutor>();
            _eventManager       = Substitute.For <IEventManager>();

            var exceptionManagerFactory =
                new LldbExceptionManager.Factory(new Dictionary <int, YetiCommon.Signal>());
            var exceptionManager = exceptionManagerFactory.Create(_process);

            _debugModuleCache = Substitute.For <IDebugModuleCache>();
            _debugProgram     = Substitute.For <IGgpDebugProgram>();

            _attachedProgram = new LldbAttachedProgram(
                _breakpointManager, _eventManager, _lldbShell, _moduleFileLoader,
                _debugEngineHandler, _taskExecutor, _debugProgram, _debugger, _target, _process,
                exceptionManager, _debugModuleCache, _listenerSubscriber, _remotePid);
        }
        public void ContinueInBreakModeWhenLldbShellIsNull()
        {
            _lldbShell = null;

            var selectedThread = Substitute.For <RemoteThread>();

            _process.GetSelectedThread().Returns(selectedThread);

            _attachedProgram.ContinueInBreakMode();

            Predicate <DebugEvent> matchExceptionEvent = e =>
            {
                ExceptionEvent exceptionEvent = e as ExceptionEvent;
                if (exceptionEvent == null)
                {
                    return(false);
                }

                var info = new EXCEPTION_INFO[1];
                exceptionEvent.GetException(info);
                return(info[0].dwState == enum_EXCEPTION_STATE.EXCEPTION_NONE);
            };

            Received.InOrder(() => {
                _debugEngineHandler.SendEvent(Arg.Is <DebugEvent>(e => matchExceptionEvent(e)),
                                              _debugProgram,selectedThread);
            });
        }
        public void SetUp()
        {
            logSpy = new LogSpy();
            logSpy.Attach();

            var taskContext = new JoinableTaskContext();

            shellMock = Substitute.For <ILLDBShell>();

            commandWindowText = "";

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

            serviceProviderMock = Substitute.For <IServiceProvider>();

            yetiOptions = Substitute.For <OptionPageGrid>();
            var yetiService = new YetiVSIService(yetiOptions);

            serviceProviderMock.GetService(typeof(YetiVSIService)).Returns(yetiService);
            serviceProviderMock.GetService(typeof(SLLDBShell)).Returns(shellMock);
            serviceProviderMock.GetService(typeof(SVsCommandWindow)).Returns(commandWindowMock);

            menuCommandService = new OleMenuCommandService(serviceProviderMock);
            serviceProviderMock.GetService(typeof(IMenuCommandService)).Returns(menuCommandService);

            LLDBShellCommandTarget.Register(taskContext, serviceProviderMock);
        }
Exemplo n.º 5
0
 public Factory(JoinableTaskContext taskContext,
                IDebugEngineHandlerFactory debugEngineHandlerFactory,
                ITaskExecutor taskExecutor, LldbEventManager.Factory eventManagerFactory,
                IDebugProgramFactory debugProgramFactory,
                DebugModuleCache.Factory debugModuleCacheFactory,
                DebugModule.Factory debugModuleFactory,
                CreateDebugThreadDelegate debugThreadCreatorDelegate,
                CreateDebugStackFrameDelegate debugStackFrameCreator,
                ILLDBShell lldbShell,
                LldbBreakpointManager.Factory breakpointManagerFactory,
                SymbolLoader.Factory symbolLoaderFactory,
                BinaryLoader.Factory binaryLoaderFactory,
                IModuleFileLoaderFactory moduleFileLoaderFactory)
 {
     _taskContext = taskContext;
     _debugEngineHandlerFactory = debugEngineHandlerFactory;
     _taskExecutor               = taskExecutor;
     _eventManagerFactory        = eventManagerFactory;
     _debugProgramFactory        = debugProgramFactory;
     _debugModuleCacheFactory    = debugModuleCacheFactory;
     _debugModuleFactory         = debugModuleFactory;
     _debugThreadCreatorDelegate = debugThreadCreatorDelegate;
     _debugStackFrameCreator     = debugStackFrameCreator;
     _breakpointManagerFactory   = breakpointManagerFactory;
     _lldbShell               = lldbShell;
     _symbolLoaderFactory     = symbolLoaderFactory;
     _binaryLoaderFactory     = binaryLoaderFactory;
     _moduleFileLoaderFactory = moduleFileLoaderFactory;
 }
 public void ContinueFromSuspendedWhenLldbShellIsNull()
 {
     _lldbShell = null;
     _attachedProgram.ContinueFromSuspended();
     Received.InOrder(() => {
         _eventManager.StartListener();
         _process.Continue();
         _debugProgram.Received().EnumModules(out _);
     });
 }
Exemplo n.º 7
0
 public LldbAttachedProgram(IBreakpointManager breakpointManager, IEventManager eventManager,
                            ILLDBShell lldbShell, IModuleFileLoader moduleFileLoader,
                            IDebugEngineHandler debugEngineHandler,
                            ITaskExecutor taskExecutor, IGgpDebugProgram debugProgram,
                            SbDebugger debugger, RemoteTarget target, SbProcess process,
                            IExceptionManager exceptionManager,
                            IDebugModuleCache debugModuleCache,
                            ILldbListenerSubscriber listenerSubscriber, uint remotePid)
 {
     _debugProgram       = debugProgram;
     _breakpointManager  = breakpointManager;
     _eventManager       = eventManager;
     _lldbShell          = lldbShell;
     _moduleFileLoader   = moduleFileLoader;
     _debugEngineHandler = debugEngineHandler;
     _taskExecutor       = taskExecutor;
     _debugger           = debugger;
     _target             = target;
     _process            = process;
     _exceptionManager   = exceptionManager;
     _debugModuleCache   = debugModuleCache;
     _listenerSubscriber = listenerSubscriber;
     RemotePid           = remotePid;
 }