コード例 #1
0
        public void SetUp()
        {
            var taskContext = new JoinableTaskContext();

            remoteThread = Substitute.For <RemoteThread>();
            mockThread   = Substitute.For <IDebugThread>();
            mockThread.GetRemoteThread().Returns(remoteThread);
            mockDebugEngineHandler            = Substitute.For <IDebugEngineHandler>();
            mockDebugThreadCreator            = Substitute.For <DebugProgram.ThreadCreator>();
            mockDebugDisassemblyStreamFactory = Substitute.For <DebugDisassemblyStream.Factory>();
            mockProcess = Substitute.For <IDebugProcess2>();
            var guid = new Guid();

            mockSbProcess              = Substitute.For <SbProcess>();
            mockRemoteTarget           = Substitute.For <RemoteTarget>();
            mockDocumentContextFactory = Substitute.For <DebugDocumentContext.Factory>();
            mockCodeContextFactory     = Substitute.For <DebugCodeContext.Factory>();
            threadEnumFactory          = new ThreadEnumFactory();
            moduleEnumFactory          = new ModuleEnumFactory();
            codeContextEnumFactory     = new CodeContextEnumFactory();

            mockDebugModuleCache = Substitute.For <IDebugModuleCache>();
            program = new DebugProgram.Factory(taskContext, mockDebugDisassemblyStreamFactory,
                                               mockDocumentContextFactory, mockCodeContextFactory, threadEnumFactory,
                                               moduleEnumFactory, codeContextEnumFactory)
                      .Create(mockDebugEngineHandler, mockDebugThreadCreator, mockProcess, guid,
                              mockSbProcess, mockRemoteTarget, mockDebugModuleCache, false);
        }
コード例 #2
0
        public virtual async Task <IList <FRAMEINFO> > GetAllAsync(enum_FRAMEINFO_FLAGS fieldSpec,
                                                                   IDebugThread debugThread)
        {
            var framesInfo = new List <FrameInfoPair>();

            while (framesInfo.Count < MaxFramesNumberToLoad)
            {
                long maxBatchSize = Math.Min(
                    FramesBatchSize, MaxFramesNumberToLoad - framesInfo.Count);
                List <FrameInfoPair> framesBatch = await _remoteThread.GetFramesWithInfoAsync(
                    (FrameInfoFlags)fieldSpec, (uint)framesInfo.Count, (uint)maxBatchSize);

                if (framesBatch == null)
                {
                    Trace.TraceError("Error on loading Frames With Info. " +
                                     $"Thread Id: {debugThread.GetRemoteThread().GetThreadId()}; " +
                                     $"Start index: {framesInfo.Count}; Max Count: {maxBatchSize}");
                    break;
                }

                framesInfo.AddRange(framesBatch);

                if (framesBatch.Count < maxBatchSize)
                {
                    break;
                }
            }

            return(ToFrameInfo(framesInfo, debugThread, 0));
        }