예제 #1
0
 public Factory(JoinableTaskContext taskContext, GrpcDebuggerFactory lldbDebuggerFactory,
                GrpcListenerFactory lldbListenerFactory,
                GrpcPlatformFactory lldbPlatformFactory,
                GrpcPlatformConnectOptionsFactory lldbPlatformConnectOptionsFactory,
                GrpcPlatformShellCommandFactory lldbPlatformShellCommandFactory,
                ILldbAttachedProgramFactory attachedProgramFactory,
                ActionRecorder actionRecorder,
                ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
                LldbExceptionManager.Factory exceptionManagerFactory,
                IFileSystem fileSystem, bool fastExpressionEvaluation,
                IModuleFileFinder moduleFileFinder,
                IDumpModulesProvider dumpModulesProvider,
                IModuleSearchLogHolder moduleSearchLogHolder,
                ISymbolSettingsProvider symbolSettingsProvider,
                CoreAttachWarningDialogUtil warningDialog)
 {
     _taskContext         = taskContext;
     _lldbDebuggerFactory = lldbDebuggerFactory;
     _lldbListenerFactory = lldbListenerFactory;
     _lldbPlatformFactory = lldbPlatformFactory;
     _lldbPlatformConnectOptionsFactory = lldbPlatformConnectOptionsFactory;
     _lldbPlatformShellCommandFactory   = lldbPlatformShellCommandFactory;
     _attachedProgramFactory            = attachedProgramFactory;
     _actionRecorder = actionRecorder;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
     _exceptionManagerFactory       = exceptionManagerFactory;
     _fileSystem = fileSystem;
     _fastExpressionEvaluation = fastExpressionEvaluation;
     _moduleFileFinder         = moduleFileFinder;
     _dumpModulesProvider      = dumpModulesProvider;
     _moduleSearchLogHolder    = moduleSearchLogHolder;
     _symbolSettingsProvider   = symbolSettingsProvider;
     _warningDialog            = warningDialog;
 }
예제 #2
0
 public Factory(CancelableTask.Factory cancelableTaskFactory,
                ActionRecorder actionRecorder,
                ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
                ILldbModuleUtil moduleUtil,
                ISymbolSettingsProvider symbolSettingsProvider)
 {
     _cancelableTaskFactory         = cancelableTaskFactory;
     _actionRecorder                = actionRecorder;
     _moduleUtil                    = moduleUtil;
     _symbolSettingsProvider        = symbolSettingsProvider;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
 }
예제 #3
0
 DebugModule(CancelableTask.Factory cancelableTaskFactory, ActionRecorder actionRecorder,
             ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
             ILldbModuleUtil moduleUtil, IModuleFileLoader moduleFileLoader,
             IModuleSearchLogHolder moduleSearchLogHolder, SbModule lldbModule,
             uint loadOrder, IDebugEngineHandler engineHandler, IGgpDebugProgram program,
             ISymbolSettingsProvider symbolSettingsProvider)
 {
     _cancelableTaskFactory         = cancelableTaskFactory;
     _actionRecorder                = actionRecorder;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
     _moduleUtil            = moduleUtil;
     _moduleFileLoader      = moduleFileLoader;
     _moduleSearchLogHolder = moduleSearchLogHolder;
     _lldbModule            = lldbModule;
     _loadOrder             = loadOrder;
     _engineHandler         = engineHandler;
     _program = program;
     _symbolSettingsProvider = symbolSettingsProvider;
 }
예제 #4
0
 public DebugSessionLauncher(
     JoinableTaskContext taskContext, GrpcDebuggerFactory lldbDebuggerFactory,
     GrpcListenerFactory lldbListenerFactory, GrpcPlatformFactory lldbPlatformFactory,
     GrpcPlatformConnectOptionsFactory lldbPlatformConnectOptionsFactory,
     GrpcPlatformShellCommandFactory lldbPlatformShellCommandFactory,
     ILldbAttachedProgramFactory attachedProgramFactory, IDebugEngine3 debugEngine,
     LaunchOption launchOption, ActionRecorder actionRecorder,
     ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
     string coreFilePath, string executableFileName, string executableFullPath,
     LldbExceptionManager.Factory exceptionManagerFactory, IFileSystem fileSystem,
     bool fastExpressionEvaluation, IModuleFileFinder moduleFileFinder,
     IDumpModulesProvider dumpModulesProvider, IModuleSearchLogHolder moduleSearchLogHolder,
     ISymbolSettingsProvider symbolSettingsProvider,
     CoreAttachWarningDialogUtil warningDialog, IVsiGameLaunch gameLaunch)
 {
     _taskContext         = taskContext;
     _lldbDebuggerFactory = lldbDebuggerFactory;
     _lldbListenerFactory = lldbListenerFactory;
     _lldbPlatformFactory = lldbPlatformFactory;
     _lldbPlatformConnectOptionsFactory = lldbPlatformConnectOptionsFactory;
     _lldbPlatformShellCommandFactory   = lldbPlatformShellCommandFactory;
     _attachedProgramFactory            = attachedProgramFactory;
     _debugEngine             = debugEngine;
     _exceptionManagerFactory = exceptionManagerFactory;
     _fileSystem = fileSystem;
     _fastExpressionEvaluation      = fastExpressionEvaluation;
     _launchOption                  = launchOption;
     _actionRecorder                = actionRecorder;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
     _coreFilePath                  = coreFilePath;
     _executableFileName            = executableFileName;
     _executableFullPath            = executableFullPath;
     _moduleFileFinder              = moduleFileFinder;
     _dumpModulesProvider           = dumpModulesProvider;
     _moduleSearchLogHolder         = moduleSearchLogHolder;
     _symbolSettingsProvider        = symbolSettingsProvider;
     _warningDialog                 = warningDialog;
     _gameLaunch = gameLaunch;
 }
        /// <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));
        }