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)); }
public static VariableTree GetAllLocals(this DebuggerApi api) { var mainThread = api.GetCurrentThreads().First(); var frame = api.GetCurrentStackTrace(mainThread.Id).First(); var scopes = api.GetCurrentScopes(frame.Id); return(new VariableTree { CurrentItem = new Variable(-1, "Root", string.Empty, "Root", true), Children = scopes.Select(x => GetVariables(api, x)).ToList() }); }
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); }