Example #1
0
        public void Upsert_All_Frames_At_The_Current_Position()
        {
            var options = new IndexOptions()
            {
                MemoryRanges = new []
                {
                    new MemoryRange(0x100, 0x200),
                }
            };
            var indexMethod = new IndexMethod();
            var sc          = new ServerClientBuilder();

            sc.WithUpsertFrames(() =>
            {
            });
            sc.WithAddMemoryRange();
            var ttf = new TimeTravelFacadeBuilder();

            ttf.WithPositions(new PositionsResult(new[]
            {
                new PositionsRecord(1, new Position(1, 1), true),
                new PositionsRecord(2, new Position(1, 1), false),
            }));
            var dbg = new DebugEngineProxyBuilder();

            dbg.WithReadVirtualMemory(new byte[] { 0x00, 0x11 });
            indexMethod.ServerClient     = sc.Build();
            indexMethod.TimeTravelFacade = ttf.Build();
            indexMethod.DebugEngineProxy = dbg.Build();

            indexMethod.UpsertCurrentPosition(options);
            sc.Mock.Verify(client => client.UpsertFrames(It.Is <IEnumerable <Frame> >(frames => frames.Count() == 2)), Times.Once);
            sc.Mock.Verify(client => client.AddMemoryRange(It.IsAny <MemoryChunk>()), Times.Once);
        }
Example #2
0
        public void Upsert_Frames_From_Breaks()
        {
            var dbg = new DebugEngineProxyBuilder();
            var tt  = new TimeTravelFacadeBuilder(dbg);
            var sc  = new ServerClientBuilder();
            var bp  = new BreakpointFacadeBuilder();

            dbg.WithRunUntilBreak();
            var count = 0;

            dbg.SetRunUntilBreakCallback(() =>
            {
                if (count++ > 0)
                {
                    tt.AdvanceToNextPosition();
                }
            });
            var dbgEngProxy      = dbg.Build();
            var timeTravelFacade = tt.Build();
            var serverClient     = sc.Build();
            var bpFacade         = bp.Build();

            dbg.CurrentThreadId = MockFrames.SingleThreaded0.First().ThreadId;
            tt.WithFrames(MockFrames.SingleThreaded0);
            sc.WithUpsertFrames(() => { });

            var indexMethod = new IndexMethod
            {
                DebugEngineProxy = dbgEngProxy,
                TimeTravelFacade = timeTravelFacade,
                ServerClient     = serverClient,
                BreakpointFacade = bpFacade
            };

            indexMethod.ProcessInternal(new Position(0, 0), MockFrames.SingleThreaded0.Max(x => x.Position),
                                        new IndexOptions());
            sc.Mock.Verify(client =>
                           client.UpsertFrames(
                               It.Is <IEnumerable <Frame> >(frames => frames.SequenceEqual(MockFrames.SingleThreaded0))));
        }