Ejemplo n.º 1
0
        public void StepInto_WithFunction_GoesIntoFunction()
        {
            var breakpointHit = false;
            var hasExited     = false;

            _debugger.BreakpointHit += (breakpoint, threadId) => breakpointHit = true;
            _debugger.ProcessExited += (a, b) => hasExited = true;

            _api.Launch(PathToExecutable, string.Empty);
            var result = _api.SetBreakpoints(new[] { new Breakpoint(SourceFileName, FunctionCallLine) });

            Assert.IsTrue(result.Values.All(x => x));

            Assert.That(() => breakpointHit, Is.True.After(Const.DefaultTimeout, Const.DefaultPollingInterval));

            // @TODO: hard to identify main thread, thread switching seems to fire off / continue thread left thread execution
            var mainThread = _api.GetCurrentThreads().First();

            // Getting into method requires 3 steps, possibly due to internal code organization
            _api.StepInto().Wait();
            _api.StepInto().Wait();
            _api.StepInto().Wait();
            var combinedStackTrace = _api.GetCurrentStackTrace(mainThread.Id);

            Assert.IsTrue(combinedStackTrace.Any(x => x.Line == FunctionStartLine && x.FilePath.EndsWith(SourceFileName)));

            _api.Continue();

            Assert.That(() => hasExited, Is.True.After(Const.DefaultTimeout, Const.DefaultPollingInterval));
        }
Ejemplo n.º 2
0
        public void StepInto_StdLib_ShouldUseRustSources()
        {
            var breakpointHit = false;

            _debugger.BreakpointHit += (breakpoint, threadId) => breakpointHit = true;

            _api.Launch(_pathToExecutable, string.Empty);
            var result = _api.SetBreakpoints(new[] { new Breakpoint(SourceFileName, StdCallLine) });

            Assert.IsTrue(result.Values.All(x => x));

            Assert.That(() => breakpointHit, Is.True.After(Const.DefaultTimeout, Const.DefaultPollingInterval));

            _api.StepInto().Wait(Const.DefaultTimeout);
            var threads    = _api.GetCurrentThreads();
            var stackTrace = _api.GetCurrentStackTrace(threads.First().Id);

            StringAssert.EndsWith("string.rs", stackTrace.First().FilePath);
            FileAssert.Exists(stackTrace.First().FilePath);
        }