コード例 #1
0
 DebugProperty(ITaskExecutor taskExecutor, IChildrenProviderFactory childrenProviderFactory,
               IVariableInformationEnumFactory varInfoEnumFactory,
               IVariableInformation varInfo, DebugCodeContext.Factory codeContextFactory,
               VsExpressionCreator vsExpressionCreator) : base(
         taskExecutor, childrenProviderFactory, varInfoEnumFactory, varInfo, codeContextFactory,
         vsExpressionCreator)
 {
 }
コード例 #2
0
        public void SetUp()
        {
            _expressionCreator = new VsExpressionCreator();
            _evaluateSize      = Substitute.For <Func <string, Task <uint> > >();

            // Size specifier expressions resolve to zero by default.
            _evaluateSize(Arg.Any <string>()).Returns(Task.FromResult(0U));
        }
コード例 #3
0
 public Factory(IVariableInformationEnumFactory varInfoEnumFactory,
                IChildrenProviderFactory childrenProviderFactory,
                DebugCodeContext.Factory codeContextFactory,
                VsExpressionCreator vsExpressionCreator, ITaskExecutor taskExecutor)
 {
     _varInfoEnumFactory      = varInfoEnumFactory;
     _childrenProviderFactory = childrenProviderFactory;
     _codeContextFactory      = codeContextFactory;
     _vsExpressionCreator     = vsExpressionCreator;
     _taskExecutor            = taskExecutor;
 }
コード例 #4
0
 protected GgpCommonDebugProperty(ITaskExecutor taskExecutor,
                                  IChildrenProviderFactory childrenProviderFactory,
                                  IVariableInformationEnumFactory varInfoEnumFactory,
                                  IVariableInformation varInfo,
                                  DebugCodeContext.Factory codeContextFactory,
                                  VsExpressionCreator vsExpressionCreator)
 {
     _taskExecutor            = taskExecutor;
     _childrenProviderFactory = childrenProviderFactory;
     _varInfoEnumFactory      = varInfoEnumFactory;
     _varInfo             = varInfo;
     _codeContextFactory  = codeContextFactory;
     _vsExpressionCreator = vsExpressionCreator;
 }
コード例 #5
0
 public NatvisExpressionEvaluator(NatvisDiagnosticLogger logger,
                                  VsExpressionCreator vsExpressionCreator,
                                  IExtensionOptions extensionOptions,
                                  ExpressionEvaluationRecorder expressionEvaluationRecorder,
                                  ITimeSource timeSource)
 {
     _logger = logger;
     _vsExpressionCreator = vsExpressionCreator;
     // Instead of relying on the ExpressionEvaluationEngine flag directly, use
     // IExtensionOptions to get the flag. This will pick up configuration changes in
     // runtime.
     _extensionOptions             = extensionOptions;
     _expressionEvaluationRecorder = expressionEvaluationRecorder;
     _timeSource = timeSource;
 }
コード例 #6
0
 public Factory(CreateDebugPropertyDelegate createPropertyDelegate,
                VarInfoBuilder varInfoBuilder, VsExpressionCreator vsExpressionCreator,
                ErrorDebugProperty.Factory errorDebugPropertyFactory,
                IDebugEngineCommands debugEngineCommands,
                IExtensionOptions extensionOptions,
                ExpressionEvaluationRecorder expressionEvaluationRecorder,
                ITimeSource timeSource)
 {
     _createPropertyDelegate       = createPropertyDelegate;
     _varInfoBuilder               = varInfoBuilder;
     _vsExpressionCreator          = vsExpressionCreator;
     _errorDebugPropertyFactory    = errorDebugPropertyFactory;
     _debugEngineCommands          = debugEngineCommands;
     _extensionOptions             = extensionOptions;
     _expressionEvaluationRecorder = expressionEvaluationRecorder;
     _timeSource = timeSource;
 }
コード例 #7
0
        public void SetUp()
        {
            _mockDebuggerStackFrame = Substitute.For <RemoteFrame>();
            var childAdapterFactory = new RemoteValueChildAdapter.Factory();
            var varInfoFactory      = new LLDBVariableInformationFactory(childAdapterFactory);

            _vsExpressionCreator = new VsExpressionCreator();

            _metrics = Substitute.For <IMetrics>();
            var eventScheduler        = new EventSchedulerFake();
            var eventSchedulerFactory = Substitute.For <IEventSchedulerFactory>();

            eventSchedulerFactory.Create(Arg.Do <System.Action>(a => eventScheduler.Callback = a))
            .Returns(eventScheduler);
            var       timer = new TimerFake();
            const int minimumBatchSeparationMilliseconds = 1;
            var       batchEventAggregator =
                new BatchEventAggregator <ExpressionEvaluationBatch, ExpressionEvaluationBatchParams,
                                          ExpressionEvaluationBatchSummary>(minimumBatchSeparationMilliseconds,
                                                                            eventSchedulerFactory, timer);

            _expressionEvaluationRecorder =
                new ExpressionEvaluationRecorder(batchEventAggregator, _metrics);
            _timeSource = new MonotonicTimeSource();

            _taskExecutor = Substitute.ForPartsOf <FakeTaskExecutor>();

            var enumFactory = new VariableInformationEnum.Factory(_taskExecutor);

            var childrenProviderFactory = new ChildrenProvider.Factory();
            var debugPropertyFactory    = new DebugProperty.Factory(
                enumFactory, childrenProviderFactory, null, _vsExpressionCreator, _taskExecutor);

            _createPropertyDelegate = debugPropertyFactory.Create;

            childrenProviderFactory.Initialize(_createPropertyDelegate);

            _varInfoBuilder = new VarInfoBuilder(varInfoFactory);
            varInfoFactory.SetVarInfoBuilder(_varInfoBuilder);

            _engineCommandsMock = Substitute.For <IDebugEngineCommands>();

            _mockDebugEngineHandler = Substitute.For <IDebugEngineHandler>();
            _mockProgram            = Substitute.For <IGgpDebugProgram>();
            _mockThread             = Substitute.For <IDebugThread2>();
        }
コード例 #8
0
 AsyncExpressionEvaluator(RemoteFrame frame, string text,
                          VsExpressionCreator vsExpressionCreator,
                          VarInfoBuilder varInfoBuilder,
                          CreateDebugPropertyDelegate createPropertyDelegate,
                          ErrorDebugProperty.Factory errorDebugPropertyFactory,
                          IDebugEngineCommands debugEngineCommands,
                          ExpressionEvaluationStrategy expressionEvaluationStrategy,
                          ExpressionEvaluationRecorder expressionEvaluationRecorder,
                          ITimeSource timeSource)
 {
     _frame = frame;
     _text  = text;
     _vsExpressionCreator          = vsExpressionCreator;
     _varInfoBuilder               = varInfoBuilder;
     _createPropertyDelegate       = createPropertyDelegate;
     _errorDebugPropertyFactory    = errorDebugPropertyFactory;
     _debugEngineCommands          = debugEngineCommands;
     _expressionEvaluationStrategy = expressionEvaluationStrategy;
     _expressionEvaluationRecorder = expressionEvaluationRecorder;
     _timeSource = timeSource;
 }
コード例 #9
0
        /// <summary>
        /// Creates a new debug engine factory.
        /// </summary>
        /// <param name="self">The external identity of the debug engine.</param>
        public virtual IDebugEngineFactory CreateDebugEngineFactory()
        {
            ServiceManager serviceManager = CreateServiceManager();

            GetJoinableTaskContext().ThrowIfNotOnMainThread();

            var vsExpressionCreator = new VsExpressionCreator();

            if (GetVsiService().Options.LLDBVisualizerSupport == LLDBVisualizerSupport.ENABLED)
            {
                GetNatvis().VisualizerScanner.LoadProjectFiles();
            }

            var debugEngineCommands = new DebugEngineCommands(
                GetJoinableTaskContext(), GetNatvis(),
                GetVsiService().Options.LLDBVisualizerSupport == LLDBVisualizerSupport.ENABLED);

            var actionRecorder           = new ActionRecorder(GetDebugSessionMetrics());
            var backgroundProcessFactory = new BackgroundProcess.Factory();

            var processFactory = new ManagedProcess.Factory();
            var binaryFileUtil = new ElfFileUtil(processFactory);
            var lldbModuleUtil = new LldbModuleUtil();

            var symbolServerRequestHandler = new WebRequestHandler()
            {
                AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
                UseDefaultCredentials  = true,
                CachePolicy            = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore),
            };
            var symbolServerHttpClient = new HttpClient(symbolServerRequestHandler);
            var symbolPathParser       = new SymbolPathParser(
                GetFileSystem(), binaryFileUtil, symbolServerHttpClient,
                new CrashReportClient(GetCloudRunner()),
                SDKUtil.GetDefaultSymbolCachePath(), SDKUtil.GetDefaultSymbolStorePath(),
                YetiConstants.SymbolServerExcludeList);
            IModuleFileFinder        moduleFileFinder        = new ModuleFileFinder(symbolPathParser);
            IModuleFileLoaderFactory moduleFileLoaderFactory = new ModuleFileLoader.Factory();

            var moduleFileLoadRecorderFactory =
                new ModuleFileLoadMetricsRecorder.Factory(lldbModuleUtil, moduleFileFinder);

            var symbolLoaderFactory =
                new SymbolLoader.Factory(lldbModuleUtil, binaryFileUtil, moduleFileFinder);
            var binaryLoaderFactory = new BinaryLoader.Factory(lldbModuleUtil, moduleFileFinder);

            var cancelableTaskFactory = GetCancelableTaskFactory();

            var exceptionManagerFactory =
                new LldbExceptionManager.Factory(LinuxSignals.GetDefaultSignalsMap());

            DebugModule.Factory debugModuleFactory =
                GetFactoryDecorator().Decorate(new DebugModule.Factory(
                                                   cancelableTaskFactory, actionRecorder, moduleFileLoadRecorderFactory,
                                                   lldbModuleUtil, GetSymbolSettingsProvider()));
            var debugModuleCacheFactory   = new DebugModuleCache.Factory(GetDispatcher());
            var debugMemoryContextFactory =
                GetFactoryDecorator().Decorate(new DebugMemoryContext.Factory());

            var debugDocumentContextFactory =
                GetFactoryDecorator().Decorate(new DebugDocumentContext.Factory());

            var debugCodeContextFactory = GetFactoryDecorator().Decorate(
                new DebugCodeContext.Factory(debugMemoryContextFactory));

            var varInfoEnumFactory =
                GetFactoryDecorator().Decorate <IVariableInformationEnumFactory>(
                    new VariableInformationEnum.Factory(GetTaskExecutor()));

            var concreteChildrenProviderFactory = new ChildrenProvider.Factory();
            var childrenProviderFactory         = GetFactoryDecorator().Decorate <IChildrenProviderFactory>(
                concreteChildrenProviderFactory);

            // TODO: Add test for this: (internal)
            bool asyncInterfacesEnabled =
                GetVsiService().Options.AsyncInterfaces == AsyncInterfaces.ENABLED;

            var debugPropertyFactory = GetFactoryDecorator().Decorate(new DebugProperty.Factory(
                                                                          varInfoEnumFactory, childrenProviderFactory, debugCodeContextFactory,
                                                                          vsExpressionCreator, GetTaskExecutor()));
            var debugPropertyAsyncFactory =
                GetFactoryDecorator().Decorate(new DebugAsyncProperty.Factory(
                                                   varInfoEnumFactory, childrenProviderFactory, debugCodeContextFactory,
                                                   vsExpressionCreator, GetTaskExecutor()));

            var createDebugPropertyDelegate =
                asyncInterfacesEnabled
                ?(CreateDebugPropertyDelegate)
                debugPropertyAsyncFactory.Create : debugPropertyFactory.Create;

            concreteChildrenProviderFactory.Initialize(createDebugPropertyDelegate);

            var asyncEvaluatorFactory =
                GetFactoryDecorator().Decorate(new AsyncExpressionEvaluator.Factory(
                                                   createDebugPropertyDelegate, GetVarInfoBuilder(), vsExpressionCreator,
                                                   new ErrorDebugProperty.Factory(), debugEngineCommands,
                                                   GetVsiService().Options, GetExpressionEvaluationRecorder(), GetTimeSource()));

            var debugExpressionFactory = GetFactoryDecorator().Decorate(
                new DebugExpression.Factory(asyncEvaluatorFactory, GetTaskExecutor()));
            var debugAsyncExpressionFactory = GetFactoryDecorator().Decorate(
                new DebugAsyncExpression.Factory(asyncEvaluatorFactory, GetTaskExecutor()));
            var debugExpressionCreator =
                asyncInterfacesEnabled
                ?(CreateDebugExpressionDelegate)
                debugAsyncExpressionFactory.Create : debugExpressionFactory.Create;
            var registerSetsBuilderFactory = GetFactoryDecorator().Decorate(
                new RegisterSetsBuilder.Factory(GetVariableInformationFactory()));
            var debugStackFrameFactory = GetFactoryDecorator().Decorate(new DebugStackFrame.Factory(
                                                                            debugDocumentContextFactory, childrenProviderFactory, debugCodeContextFactory,
                                                                            debugExpressionCreator, GetVariableInformationFactory(), varInfoEnumFactory,
                                                                            registerSetsBuilderFactory, GetTaskExecutor()));
            var debugStackFrameFactoryAsync =
                GetFactoryDecorator().Decorate(new DebugStackFrameAsync.Factory(
                                                   debugDocumentContextFactory, childrenProviderFactory, debugCodeContextFactory,
                                                   debugExpressionCreator, GetVariableInformationFactory(), varInfoEnumFactory,
                                                   registerSetsBuilderFactory, GetTaskExecutor()));
            var debugStackFrameCreator =
                asyncInterfacesEnabled ?(CreateDebugStackFrameDelegate)
                debugStackFrameFactoryAsync.Create : debugStackFrameFactory.Create;
            var debugThreadFactory = GetFactoryDecorator().Decorate(new DebugThread.Factory(
                                                                        GetFactoryDecorator().Decorate(new FrameEnumFactory()), _taskExecutor));
            var debugThreadAsyncFactory =
                GetFactoryDecorator().Decorate(new DebugThreadAsync.Factory(
                                                   GetFactoryDecorator().Decorate(new FrameEnumFactory()), _taskExecutor));
            var debugThreadCreator = asyncInterfacesEnabled ?(CreateDebugThreadDelegate)
                                     debugThreadAsyncFactory.Create : debugThreadFactory.Create;
            var gameletFactory        = GetGameletClientFactory();
            var launchParamsConverter =
                new LaunchGameParamsConverter(GetSdkConfigFactory(), new QueryParametersParser());
            var gameLaunchManager = new GameLaunchBeHelper(gameletFactory.Create(GetCloudRunner()),
                                                           launchParamsConverter);
            var debugProgramFactory =
                GetFactoryDecorator().Decorate <IDebugProgramFactory>(new DebugProgram.Factory(
                                                                          GetJoinableTaskContext(),
                                                                          GetFactoryDecorator().Decorate(new DebugDisassemblyStream.Factory(
                                                                                                             debugCodeContextFactory, debugDocumentContextFactory)),
                                                                          debugDocumentContextFactory, debugCodeContextFactory,
                                                                          GetFactoryDecorator().Decorate(new ThreadEnumFactory()),
                                                                          GetFactoryDecorator().Decorate(new ModuleEnumFactory()),
                                                                          GetFactoryDecorator().Decorate(new CodeContextEnumFactory())));
            var breakpointErrorEnumFactory =
                GetFactoryDecorator().Decorate(new BreakpointErrorEnumFactory());
            var boundBreakpointEnumFactory =
                GetFactoryDecorator().Decorate(new BoundBreakpointEnumFactory());
            var breakpointManagerFactory = new LldbBreakpointManager.Factory(
                GetJoinableTaskContext(),
                GetFactoryDecorator().Decorate(new DebugPendingBreakpoint.Factory(
                                                   GetJoinableTaskContext(),
                                                   GetFactoryDecorator().Decorate(new DebugBoundBreakpoint.Factory(
                                                                                      debugDocumentContextFactory, debugCodeContextFactory,
                                                                                      GetFactoryDecorator().Decorate(new DebugBreakpointResolution.Factory()))),
                                                   breakpointErrorEnumFactory, boundBreakpointEnumFactory)),
                GetFactoryDecorator().Decorate(new DebugWatchpoint.Factory(
                                                   GetJoinableTaskContext(),
                                                   GetFactoryDecorator().Decorate(new DebugWatchpointResolution.Factory()),
                                                   breakpointErrorEnumFactory, boundBreakpointEnumFactory)));
            var eventManagerFactory =
                new LldbEventManager.Factory(boundBreakpointEnumFactory, GetJoinableTaskContext());
            var lldbDebuggerFactory               = new GrpcDebuggerFactory();
            var lldbListenerFactory               = new GrpcListenerFactory();
            var lldbPlatformShellCommandFactory   = new GrpcPlatformShellCommandFactory();
            var lldbPlatformFactory               = new GrpcPlatformFactory();
            var lldbPlatformConnectOptionsFactory = new GrpcPlatformConnectOptionsFactory();
            var grpcInterceptors = CreateGrpcInterceptors(GetVsiService().DebuggerOptions);
            var vsOutputWindow   =
                serviceManager.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow;
            var callInvokerFactory      = new PipeCallInvokerFactory();
            var transportSessionFactory =
                new LldbTransportSession.Factory(new MemoryMappedFileFactory());
            var yetiTransport = new YetiDebugTransport(
                GetJoinableTaskContext(), transportSessionFactory, callInvokerFactory,
                new GrpcConnectionFactory(GetJoinableTaskContext().Factory,
                                          grpcInterceptors.ToArray()),
                GetTaskExecutor().CancelAsyncOperationIfRequested, processFactory, GetDialogUtil(),
                vsOutputWindow, GetVsiService());

            var testClientLauncherFactory = new ChromeClientsLauncher.Factory(
                new ChromeClientLaunchCommandFormatter(GetJsonUtil()), GetSdkConfigFactory(),
                GetChromeLauncher(backgroundProcessFactory));

            var exitDialogUtil         = new ExitDialogUtil(GetDialogUtil(), GetDialogExecutionContext());
            var preflightBinaryChecker =
                new PreflightBinaryChecker(GetFileSystem(), binaryFileUtil);
            var lldbShell = serviceManager.GetGlobalService(typeof(SLLDBShell)) as ILLDBShell;
            var attachedProgramFactory =
                GetFactoryDecorator().Decorate <ILldbAttachedProgramFactory>(
                    new LldbAttachedProgram.Factory(
                        GetJoinableTaskContext(),
                        GetFactoryDecorator().Decorate <IDebugEngineHandlerFactory>(
                            new DebugEngineHandler.Factory(GetJoinableTaskContext())),
                        GetTaskExecutor(), eventManagerFactory, debugProgramFactory,
                        debugModuleCacheFactory, debugModuleFactory, debugThreadCreator,
                        debugStackFrameCreator, lldbShell, breakpointManagerFactory,
                        symbolLoaderFactory, binaryLoaderFactory, moduleFileLoaderFactory));
            bool fastExpressionEvaluation = GetVsiService().Options.FastExpressionEvaluation ==
                                            FastExpressionEvaluation.ENABLED;
            var dumpModulesProvider     = new DumpModulesProvider(GetFileSystem());
            var moduleSearchLogHolder   = new ModuleSearchLogHolder();
            var coreAttachWarningDialog = new CoreAttachWarningDialogUtil(
                GetJoinableTaskContext(),
                GetDialogUtil());
            var debugSessionLauncherFactory = new DebugSessionLauncher.Factory(
                GetJoinableTaskContext(), lldbDebuggerFactory, lldbListenerFactory,
                lldbPlatformFactory, lldbPlatformConnectOptionsFactory,
                lldbPlatformShellCommandFactory, attachedProgramFactory, actionRecorder,
                moduleFileLoadRecorderFactory, exceptionManagerFactory, GetFileSystem(),
                fastExpressionEvaluation, moduleFileFinder, dumpModulesProvider,
                moduleSearchLogHolder, GetSymbolSettingsProvider(), coreAttachWarningDialog);
            var paramsFactory    = new Params.Factory(GetJsonUtil());
            var vsiLaunchFactory = new VsiGameLaunchFactory(gameletFactory.Create(GetCloudRunner()),
                                                            GetCancelableTaskFactory(),
                                                            gameLaunchManager, actionRecorder,
                                                            GetDialogUtil());
            var gameLauncher = new GameLauncher(gameletFactory.Create(GetCloudRunner()),
                                                GetVsiService(), launchParamsConverter,
                                                GetCancelableTaskFactory(), actionRecorder,
                                                GetDialogUtil(), vsiLaunchFactory);

            var remoteCommand = new RemoteCommand(processFactory);
            var remoteFile    = new RemoteFile(processFactory);
            var remoteDeploy  = new RemoteDeploy(remoteCommand, remoteFile, processFactory,
                                                 GetFileSystem());
            bool deployLldbServer       = IsInternalEngine();
            IDebugEngineFactory factory = new DebugEngine.Factory(
                GetJoinableTaskContext(), serviceManager, GetDebugSessionMetrics(), yetiTransport,
                actionRecorder, symbolServerHttpClient, moduleFileLoadRecorderFactory,
                moduleFileFinder, testClientLauncherFactory, GetNatvis(),
                GetNatvisDiagnosticLogger(), exitDialogUtil, preflightBinaryChecker,
                debugSessionLauncherFactory, paramsFactory, remoteDeploy, cancelableTaskFactory,
                GetDialogUtil(), GetNatvisLoggerOutputWindowListener(), GetSolutionExplorer(),
                debugEngineCommands,
                GetDebugEventCallbackDecorator(GetVsiService().DebuggerOptions),
                GetSymbolSettingsProvider(), deployLldbServer, gameLauncher);

            return(GetFactoryDecorator().Decorate(factory));
        }