Ejemplo n.º 1
0
        public async Task AddRemoveBreakpoint()
        {
            const string code =
                @"x <- 1
  y <- 2
  z <- 3";

            using (var debugSession = new DebugSession(_session))
                using (var sf = new SourceFile(code)) {
                    var bp1Loc = new DebugBreakpointLocation(sf.FilePath, 1);
                    var bp1    = await debugSession.CreateBreakpointAsync(bp1Loc);

                    bp1.Location.Should().Be(bp1Loc);
                    bp1.Session.Should().Be(debugSession);

                    debugSession.Breakpoints.Count.Should().Be(1);

                    var bp2Loc = new DebugBreakpointLocation(sf.FilePath, 3);
                    var bp2    = await debugSession.CreateBreakpointAsync(bp2Loc);

                    bp2.Location.Should().Be(bp2Loc);
                    bp2.Session.Should().Be(debugSession);

                    debugSession.Breakpoints.Count.Should().Be(2);

                    await bp1.DeleteAsync();

                    debugSession.Breakpoints.Count.Should().Be(1);
                    debugSession.Breakpoints.First().Should().BeSameAs(bp2);
                }
        }
Ejemplo n.º 2
0
        public async Task AddRemoveBreakpoint() {
            const string code =
@"x <- 1
  y <- 2
  z <- 3";

            using (var debugSession = new DebugSession(_session))
            using (var sf = new SourceFile(code)) {
                var bp1Loc = new DebugBreakpointLocation(sf.FilePath, 1);
                var bp1 = await debugSession.CreateBreakpointAsync(bp1Loc);

                bp1.Location.Should().Be(bp1Loc);
                bp1.Session.Should().Be(debugSession);

                debugSession.Breakpoints.Count.Should().Be(1);

                var bp2Loc = new DebugBreakpointLocation(sf.FilePath, 3);
                var bp2 = await debugSession.CreateBreakpointAsync(bp2Loc);

                bp2.Location.Should().Be(bp2Loc);
                bp2.Session.Should().Be(debugSession);

                debugSession.Breakpoints.Count.Should().Be(2);

                await bp1.DeleteAsync();
                debugSession.Breakpoints.Count.Should().Be(1);
                debugSession.Breakpoints.First().Should().BeSameAs(bp2);
            }

        }
Ejemplo n.º 3
0
        public async Task BreakpointsInDifferentFiles()
        {
            using (var debugSession = new DebugSession(_session))
                using (var sf1 = new SourceFile("1"))
                    using (var sf2 = new SourceFile($"eval(parse({sf1.FilePath.ToRStringLiteral()}))")) {
                        await debugSession.EnableBreakpointsAsync(true);

                        var bp1Loc = new DebugBreakpointLocation(sf1.FilePath, 1);
                        var bp1    = await debugSession.CreateBreakpointAsync(bp1Loc);

                        bp1.Location.Should().Be(bp1Loc);

                        var bp2Loc = new DebugBreakpointLocation(sf2.FilePath, 1);
                        var bp2    = await debugSession.CreateBreakpointAsync(bp2Loc);

                        bp2.Location.Should().Be(bp2Loc);

                        debugSession.Breakpoints.Should().HaveCount(2);

                        var bp1Hit = new BreakpointHitDetector(bp1);
                        var bp2Hit = new BreakpointHitDetector(bp2);

                        await sf2.Source(_session);

                        await bp2Hit.ShouldBeHitAtNextPromptAsync();

                        bp1Hit.WasHit.Should().BeFalse();

                        bp2Hit.Reset();
                        await debugSession.ContinueAsync();

                        await bp1Hit.ShouldBeHitAtNextPromptAsync();

                        bp2Hit.WasHit.Should().BeFalse();
                    }
        }
Ejemplo n.º 4
0
 public void Add(DebugBreakpointLocation location, IEquatable <string> call)
 {
     Add(location.FileName, location.LineNumber, call);
 }
Ejemplo n.º 5
0
 public void Add(DebugBreakpointLocation location, int offset = 0)
 {
     Add(location.FileName, location.LineNumber + offset, MatchAny <string> .Instance);
 }
Ejemplo n.º 6
0
        public async Task BreakpointsInDifferentFiles() {
            using (var debugSession = new DebugSession(_session))
            using (var sf1 = new SourceFile("1"))
            using (var sf2 = new SourceFile($"eval(parse({sf1.FilePath.ToRStringLiteral()}))")) {
                await debugSession.EnableBreakpointsAsync(true);

                var bp1Loc = new DebugBreakpointLocation(sf1.FilePath, 1);
                var bp1 = await debugSession.CreateBreakpointAsync(bp1Loc);
                bp1.Location.Should().Be(bp1Loc);

                var bp2Loc = new DebugBreakpointLocation(sf2.FilePath, 1);
                var bp2 = await debugSession.CreateBreakpointAsync(bp2Loc);
                bp2.Location.Should().Be(bp2Loc);

                debugSession.Breakpoints.Should().HaveCount(2);

                var bp1Hit = new BreakpointHitDetector(bp1);
                var bp2Hit = new BreakpointHitDetector(bp2);

                await sf2.Source(_session);

                await bp2Hit.ShouldBeHitAtNextPromptAsync();
                bp1Hit.WasHit.Should().BeFalse();

                bp2Hit.Reset();
                await debugSession.ContinueAsync();

                await bp1Hit.ShouldBeHitAtNextPromptAsync();
                bp2Hit.WasHit.Should().BeFalse();
            }
        }
Ejemplo n.º 7
0
 public AD7BoundBreakpoint(AD7PendingBreakpoint pendingBreakpoint, DebugBreakpointLocation location, enum_PENDING_BP_STATE state) {
     PendingBreakpoint = pendingBreakpoint;
     Location = location;
     SetState((enum_BP_STATE)state);
 }
Ejemplo n.º 8
0
 public AD7BoundBreakpoint(AD7PendingBreakpoint pendingBreakpoint, DebugBreakpointLocation location, enum_PENDING_BP_STATE state)
 {
     PendingBreakpoint = pendingBreakpoint;
     Location          = location;
     SetState((enum_BP_STATE)state);
 }