void CreateDebuggee() { // Set various termination conditions for the debugger. _debuggee = ConnectToDebuggee(_connStr, _symbols); _debuggee.DebugControl.EngineOptions = EngineOptionsEnum.NoExecuteRepeat | EngineOptionsEnum.AllowNetworkPaths; _debuggee.DebugControl.InterruptTimeout = (uint)Properties.Settings.Default.MaxUpdateInterval.TotalMilliseconds; Util.LogMemoryUsageStatistics("Connected to debuggee"); _debuggee.SessionStatus += _debuggee_SessionStatus; _debuggee.DebugOutput += _debuggee_DebugOutput; _debuggee.Breakpoint += _debuggee_Breakpoint; _debuggee.Exception += _debuggee_Exception; _debuggee.ModuleLoaded += _debuggee_ModuleLoaded; _debuggee.ModuleUnloaded += _debuggee_ModuleUnloaded; _debuggee.PreBreakpoint += _debuggee_PreBreakpoint; _debuggee.PreException += _debuggee_PreException; _debuggee.PreModuleLoaded += _debuggee_PreModuleLoaded; _debuggee.PreModuleUnloaded += _debuggee_PreModuleUnloaded; _debuggee.PreProcessCreated += _debuggee_PreProcessCreated; _debuggee.PreProcessExited += _debuggee_PreProcessExited; _debuggee.PreSystemError += _debuggee_PreSystemError; _debuggee.PreThreadCreated += _debuggee_PreThreadCreated; _debuggee.PreThreadExited += _debuggee_PreThreadExited; _debuggee.ProcessCreated += _debuggee_ProcessCreated; _debuggee.ProcessExited += _debuggee_ProcessExited; _debuggee.SystemError += _debuggee_SystemError; _debuggee.ThreadCreated += _debuggee_ThreadCreated; _debuggee.ThreadExited += _debuggee_ThreadExited; }
Debuggee ConnectToDebuggee(string connectionString, string[] symbolPath) { Debuggee debuggee = null; if (_debugKernel) { debuggee = Debuggee.ConnectToKernel(connectionString); } else { debuggee = Debuggee.ConnectToProcessServer(connectionString); } foreach (string symFolder in symbolPath) { try { debuggee.SymbolPathAppend(symFolder); } catch (COMException) { } } return(debuggee); }
public async Task BreakpointHit_FunctionEvaluationFailure() { string condition = "NonExistentFunc() == \"Hello, World!\""; using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true)) { Debuggee debuggee = Polling.GetDebuggee(app.Module, app.Version); DebuggerBreakpoint breakpoint = SetBreakpointAndSleep( debuggee.Id, TestApplication.MainClass, TestApplication.LoopMiddle, condition); // Checks that the breakpoint has a condition. Assert.Equal(breakpoint.Condition, condition); using (HttpClient client = new HttpClient()) { await client.GetAsync(TestApplication.GetLoopUrl(app, 10)); } DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id); // Checks that the breakpoint has been hit. Assert.True(newBp.IsFinalState); // However, it should have error status set to true. Assert.True(newBp.Status.IsError); Assert.Empty(newBp.StackFrames); } }
/// <summary> /// Compile the shared library /// </summary> private void CompileSharedLib(ITestSettings settings, int debuggeeMoniker) { IDebuggee debuggee = Debuggee.Create(this, settings.CompilerSettings, debuggeeName, debuggeeMoniker, outLibName, CompilerOutputType.SharedLibrary); debuggee.AddSourceFiles(srcLibName); debuggee.Compile(); }
public async Task BreakpointHit_IndexerAccessCondition() { int i = 10; string condition = $"testList[1] == \"List{i}1\""; using (var app = StartTestApp(debugEnabled: true)) { Debuggee debuggee = Polling.GetDebuggee(app.Module, app.Version); DebuggerBreakpoint breakpoint = SetBreakpointAndSleep( debuggee.Id, TestApplication.MainClass, TestApplication.EchoBottomLine, condition); // Checks that the breakpoint has a condition. Assert.Equal(breakpoint.Condition, condition); using (HttpClient client = new HttpClient()) { await client.GetAsync(TestApplication.GetEchoUrl(app, i)); } DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id); // Check that the breakpoint has been hit. Assert.True(newBp.IsFinalState); } }
public async Task BreakpointHit_FunctionEvaluationNotPerformedForExpression() { string[] expression = { "Hello()" }; using (var app = StartTestApp(debugEnabled: true)) { Debuggee debuggee = Polling.GetDebuggee(app.Module, app.Version); DebuggerBreakpoint breakpoint = SetBreakpointAndSleep( debuggee.Id, TestApplication.MainClass, TestApplication.LoopMiddle, null, expression); using (HttpClient client = new HttpClient()) { await client.GetAsync(TestApplication.GetLoopUrl(app, 10)); } DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id); // Checks that the breakpoint has been hit. Assert.True(newBp.IsFinalState); // However, it should have error status set to true. Assert.True(newBp.Status.IsError); Assert.Contains("Method call for condition or expression evaluation is disabled.", newBp.Status.Description.Format); Assert.Empty(newBp.StackFrames); } }
public async Task BreakpointHit_AsyncExpression() { string[] expressions = { "testString", "PublicString", "Hello()" }; string testString = "TestMessage"; using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true)) { Debuggee debuggee = Polling.GetDebuggee(app.Module, app.Version); DebuggerBreakpoint breakpoint = SetBreakpointAndSleep( debuggee.Id, TestApplication.MainClass, TestApplication.AsyncBottomLine, null, expressions); using (HttpClient client = new HttpClient()) { await client.GetAsync($"{app.AppUrlAsync}/{testString}"); } DebuggerBreakpoint retrievedBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id); // Checks that the expressions have correct values. Assert.Equal(3, retrievedBp.EvaluatedExpressions.Count); Assert.Equal(expressions[2], retrievedBp.EvaluatedExpressions[0].Name); Assert.Equal("Hello, World!", retrievedBp.EvaluatedExpressions[0].Value); Assert.Equal(expressions[0], retrievedBp.EvaluatedExpressions[1].Name); Assert.Equal(testString, retrievedBp.EvaluatedExpressions[1].Value); Assert.Equal(expressions[1], retrievedBp.EvaluatedExpressions[2].Name); Assert.Equal((new TestApp.MainController()).PublicString, retrievedBp.EvaluatedExpressions[2].Value); } }
public async Task BreakpointHit_FunctionEvaluation() { string condition = "Hello() == \"Hello, World!\""; using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true)) { Debuggee debuggee = Polling.GetDebuggee(app.Module, app.Version); DebuggerBreakpoint breakpoint = SetBreakpointAndSleep( debuggee.Id, TestApplication.MainClass, TestApplication.LoopMiddle, condition); // Checks that the breakpoint has a condition. Assert.Equal(breakpoint.Condition, condition); using (HttpClient client = new HttpClient()) { await client.GetAsync(TestApplication.GetLoopUrl(app, 10)); } DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id); // Checks that the breakpoint has been hit. Assert.True(newBp.IsFinalState); // Checks that "i" is 0 when the breakpoint is hit. Debugger.V2.StackFrame firstFrame = newBp.StackFrames[0]; DebuggerVariable iVariable = firstFrame.Locals.First(local => local.Name == "i"); Assert.Equal("0", iVariable.Value); } }
public static Debuggee Launch(string executable, string argumentString = null, string workingDirectory = null) { var si = new STARTUPINFO { cb = Marshal.SizeOf(typeof(STARTUPINFO)), }; var pi = new PROCESS_INFORMATION(); if (argumentString == string.Empty) { argumentString = null; } if (workingDirectory == string.Empty) { workingDirectory = null; } if (!API.CreateProcess(executable, argumentString, IntPtr.Zero, IntPtr.Zero, true, ProcessCreationFlags.CreateNewConsole | // Create extra console for the process ProcessCreationFlags.DebugOnlyThisProcess // Grant debugger access to the process , IntPtr.Zero, workingDirectory, ref si, out pi)) { throw new Win32Exception(Marshal.GetLastWin32Error()); } var dbg = new Debuggee(executable, pi.hProcess, pi.dwProcessId, pi.hThread, pi.dwThreadId, ExecutableMetaInfo.ExtractFrom(executable)); return(dbg); }
public async Task BreakpointHit_MultipleExpressions() { string[] expressions = { "testList[3]", "testDictionary[\"Key103\"]" }; using (var app = StartTestApp(debugEnabled: true, methodEvaluation: true)) { Debuggee debuggee = Polling.GetDebuggee(app.Module, app.Version); DebuggerBreakpoint breakpoint = SetBreakpointAndSleep( debuggee.Id, TestApplication.MainClass, TestApplication.EchoBottomLine, null, expressions); // Checks that the breakpoint has evaluated expression. using (HttpClient client = new HttpClient()) { await client.GetAsync(TestApplication.GetEchoUrl(app, 10)); } DebuggerBreakpoint newBp = Polling.GetBreakpoint(debuggee.Id, breakpoint.Id); // Checks that the breakpoint has been hit. Assert.True(newBp.IsFinalState); // Checks that the expressions have correct values. Assert.Equal(2, newBp.EvaluatedExpressions.Count); Assert.Equal(expressions[1], newBp.EvaluatedExpressions[0].Name); Assert.Equal("3", newBp.EvaluatedExpressions[0].Value); Assert.Equal(expressions[0], newBp.EvaluatedExpressions[1].Name); Assert.Equal("List103", newBp.EvaluatedExpressions[1].Value); } }
public DebuggerClientTests() { _options = new AgentOptions { ProjectId = _projectId, Module = _module, Version = _version, }; _debuggee = new Debuggee { Project = _projectId, Id = _debugId }; _breakpoint = new Debugger.V2.Breakpoint { Id = _breakpointId }; _breakpoint2 = new Debugger.V2.Breakpoint { Id = _breakpointId2 }; _response = new RegisterDebuggeeResponse { Debuggee = _debuggee }; _mockControllerClient = new Mock <Controller2Client>(); _client = new DebuggerClient(_options, _mockControllerClient.Object); }
/// <summary> /// Registers the debuggee with the controller service. /// /// All agents attached to the same application must call this method with /// exactly the same request content to get back the same stable `debuggee_id`. /// Agents should call this method again whenever `google.rpc.Code.NOT_FOUND` /// is returned from any controller method. /// /// This protocol allows the controller service to disable debuggees, recover /// from data loss, or change the `debuggee_id` format. Agents must handle /// `debuggee_id` value changing upon re-registration. /// </summary> /// <param name="debuggee"> /// Debuggee information to register. /// The fields `project`, `uniquifier`, `description` and `agent_version` /// of the debuggee must be set. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public virtual RegisterDebuggeeResponse RegisterDebuggee( Debuggee debuggee, CallSettings callSettings = null) => RegisterDebuggee( new RegisterDebuggeeRequest { Debuggee = GaxPreconditions.CheckNotNull(debuggee, nameof(debuggee)), }, callSettings);
public static IDebuggee Open(ILoggingComponent logger, ICompilerSettings settings, int moniker, string name, string outputname) { lock (s_lock) { IDebuggee debuggee = Debuggee.Open(logger, settings, name, moniker, outputname); Assert.True(File.Exists(debuggee.OutputPath), "The debuggee was not compiled. Missing " + debuggee.OutputPath); return(debuggee); } }
/// <summary> /// Open existing debuggee /// </summary> private static IDebuggee OpenDebuggee(ILoggingComponent logger, ITestSettings settings, int debuggeeMoniker) { lock (syncObject) { IDebuggee debuggee = Debuggee.Open(logger, settings.CompilerSettings, debuggeeName, debuggeeMoniker, outAppName); Assert.True(File.Exists(debuggee.OutputPath), "The debuggee was not compiled. Missing " + debuggee.OutputPath); return(debuggee); } }
public void TestOptimizedBpsAndSource(ITestSettings settings) { this.TestPurpose("Tests basic operation of bps and source information for optimized app"); this.WriteSettings(settings); IDebuggee debuggee = Debuggee.Open(this, settings.CompilerSettings, Name, DebuggeeMonikers.Optimization.OptimizationWithSymbols); using (IDebuggerRunner runner = CreateDebugAdapterRunner(settings)) { this.Comment("Configure launch"); runner.Launch(settings.DebuggerSettings, debuggee); SourceBreakpoints mainBreakpoints = debuggee.Breakpoints(SourceName, 68); SourceBreakpoints userDefinedClassBreakpoints = debuggee.Breakpoints(UserDefinedClassName, 8, 15, 54); this.Comment("Set initial breakpoints"); runner.SetBreakpoints(mainBreakpoints); runner.SetBreakpoints(userDefinedClassBreakpoints); this.Comment("Launch and run until 1st bp"); runner.Expects.HitBreakpointEvent(UserDefinedClassName, 8) .AfterConfigurationDone(); this.Comment("run until 2nd bp"); runner.Expects.HitBreakpointEvent(UserDefinedClassName, 54) .AfterContinue(); this.Comment("run until 3rd bp"); runner.Expects.HitBreakpointEvent(SourceName, 68) .AfterContinue(); //Todo: this has different behavior on Mac(:16), Other Platforms(15) I have logged bug#247891 to track this.Comment("run until 4th bp"); runner.ExpectBreakpointAndStepToTarget(UserDefinedClassName, 15, 16).AfterContinue(); this.Comment("continue to next bp"); runner.Expects.HitBreakpointEvent(UserDefinedClassName, 54) .AfterContinue(); this.Comment("Check the current callstack frame"); using (IThreadInspector threadInspector = runner.GetThreadInspector()) { this.Comment("Get current frame object"); IFrameInspector currentFrame = threadInspector.Stack.First(); this.Comment("Verify current frame"); threadInspector.AssertStackFrameNames(true, "Foo::Sum"); } this.Comment("step out to main entry"); runner.Expects.HitStepEvent(SourceName, 69) .AfterStepOut(); runner.Expects.ExitedEvent(0).TerminatedEvent().AfterContinue(); runner.DisconnectAndVerify(); } }
/// <summary> /// Create the debuggee and compile the application /// </summary> private static IDebuggee CompileApp(ILoggingComponent logger, ITestSettings settings, int debuggeeMoniker) { lock (syncObject) { IDebuggee debuggee = Debuggee.Create(logger, settings.CompilerSettings, debuggeeName, debuggeeMoniker, outAppName); debuggee.AddSourceFiles(srcClassName, srcAppName); debuggee.Compile(); return(debuggee); } }
public void CompileHelloDebuggee(ITestSettings settings) { this.TestPurpose("Create and compile the 'hello' debuggee"); this.WriteSettings(settings); IDebuggee debuggee = Debuggee.Create(this, settings.CompilerSettings, HelloName, DebuggeeMonikers.HelloWorld.Sample); debuggee.AddSourceFiles(HelloSourceName); debuggee.Compile(); }
public DDebugBacktrace(DDebugSession session, uint threadId, Debuggee debuggee) { this.session = session; this.debuggee = debuggee; this.threadId = threadId; magoCallStackFrames = debuggee.GetCallStack(threadId); fcount = magoCallStackFrames.Count; symbols = this.session.SymbolResolver.GetLocalSymbols(threadId); }
public static IDebuggee OpenAndCompile(ILoggingComponent logger, ICompilerSettings settings, int moniker, string name, string outputname, Action <IDebuggee> addSourceFiles) { Assert.NotNull(addSourceFiles); lock (s_lock) { IDebuggee debuggee = Debuggee.Create(logger, settings, name, moniker, outputname); addSourceFiles(debuggee); debuggee.Compile(); return(debuggee); } }
/// <summary>Snippet for RegisterDebuggee</summary> public void RegisterDebuggee() { // Snippet: RegisterDebuggee(Debuggee, CallSettings) // Create client Controller2Client controller2Client = Controller2Client.Create(); // Initialize request argument(s) Debuggee debuggee = new Debuggee(); // Make the request RegisterDebuggeeResponse response = controller2Client.RegisterDebuggee(debuggee); // End snippet }
private void CompileSharedLib(ITestSettings settings, int debuggeeMoniker, bool symbol) { IDebuggee debuggee = Debuggee.Create(this, settings.CompilerSettings, Name, debuggeeMoniker, OutLibName, CompilerOutputType.SharedLibrary); debuggee.AddSourceFiles(SrcLibName); debuggee.CompilerOptions = CompilerOption.OptimizeLevel2; if (symbol) { debuggee.CompilerOptions = CompilerOption.GenerateSymbols; } debuggee.Compile(); }
public void Run(string testCaseName, string testCourceList) { // Explicit encoding setup, since system console encoding could be not utf8 (Windows OS). // Note, netcoredbg aimed to interact with utf8 encoding usage only for all protocols. Console.OutputEncoding = System.Text.Encoding.UTF8; Console.InputEncoding = System.Text.Encoding.UTF8; string testSuiteRoot = Path.GetFullPath( Path.Combine(Directory.GetCurrentDirectory(), "../../../..") ); var Env = new NetcoreDbgTestCore.Environment(); Env.TestName = testCaseName; string[] testFileArray = testCourceList.Split(";"); foreach (var FileName in testFileArray) { Env.SourceFilesPath += Path.Combine(testSuiteRoot, testCaseName, FileName + ";"); } Env.SourceFilesPath = Env.SourceFilesPath.Remove(Env.SourceFilesPath.Length - 1); Env.TargetAssemblyPath = Path.Combine(testSuiteRoot, testCaseName + "/bin/Debug/netcoreapp3.1/", testCaseName + ".dll"); string fullDebuggerPath = Path.GetFullPath(Path.Combine(testSuiteRoot, DebuggerPath)); if (testCaseName.StartsWith("MI")) { LocalDebugger = new LocalDebuggerProcess(fullDebuggerPath, @" --interpreter=mi"); LocalDebugger.Start(); DebuggerClient = new MILocalDebuggerClient(LocalDebugger.Input, LocalDebugger.Output); } else if (testCaseName.StartsWith("VSCode")) { LocalDebugger = new LocalDebuggerProcess(fullDebuggerPath, @" --interpreter=vscode"); LocalDebugger.Start(); DebuggerClient = new VSCodeLocalDebuggerClient(LocalDebugger.Input, LocalDebugger.Output); } else { throw new System.Exception(); } Xunit.Assert.True(DebuggerClient.DoHandshake(5000)); var Script = new DebuggeeScript(Env.SourceFilesPath, DebuggerClient.Protocol); Debuggee.Run(Script, DebuggerClient, Env); }
/// <summary>Snippet for RegisterDebuggeeAsync</summary> public async Task RegisterDebuggeeAsync() { // Snippet: RegisterDebuggeeAsync(Debuggee, CallSettings) // Additional: RegisterDebuggeeAsync(Debuggee, CancellationToken) // Create client Controller2Client controller2Client = await Controller2Client.CreateAsync(); // Initialize request argument(s) Debuggee debuggee = new Debuggee(); // Make the request RegisterDebuggeeResponse response = await controller2Client.RegisterDebuggeeAsync(debuggee); // End snippet }
/// <inheritdoc /> public void Register() { lock (_mutex) { var debuggee = DebuggeeUtils.CreateDebuggee( _options.ProjectId, _options.Module, _options.Version, _options.SourceContext); _debuggee = _controlClient.RegisterDebuggee(debuggee).Debuggee; if (_debuggee.IsDisabled) { throw new DebuggeeDisabledException($"'{_debuggee.Id}' is disabled."); } } }
/// <summary> /// Creates a <see cref="Debuggee"/>. /// </summary> /// <param name="projectId">The Google Cloud Console project.</param> /// <param name="module">The name of the application.</param> /// <param name="version">The version of the application.</param> /// <param name="sourceContext">The source context for the users application.</param> public static Debuggee CreateDebuggee( string projectId, string module, string version, SourceContext sourceContext) { var debuggee = new Debuggee { AgentVersion = GetAgentVersion(Common.Platform), Description = GetDescription(module, version), Project = projectId, Labels = { { GetLabels(projectId, module, version) } }, SourceContexts = { { sourceContext ?? new SourceContext() } }, }; debuggee.Uniquifier = GetUniquifier(debuggee); return(debuggee); }
public void TestArguments(ITestSettings settings) { this.TestPurpose("This test checks to see if arguments are passed to the debugee."); this.WriteSettings(settings); IDebuggee debuggee = Debuggee.Open(this, settings.CompilerSettings, HelloName, DebuggeeMonikers.HelloWorld.Sample); this.Comment("Run the debuggee, check argument count"); using (IDebuggerRunner runner = CreateDebugAdapterRunner(settings)) { runner.Launch(settings.DebuggerSettings, debuggee, "Param 1", "Param 2"); int args = 2; runner.Expects.ExitedEvent(exitCode: args).TerminatedEvent().AfterConfigurationDone(); runner.DisconnectAndVerify(); } }
/// <summary> /// Gets the uniquifier to uniquely identify this application. /// </summary> public static string GetUniquifier(Debuggee debuggee) { using (SHA1 sha = SHA1.Create()) { List <byte> bytesList = new List <byte>(); bytesList.AddRange(Encoding.UTF8.GetBytes(debuggee.AgentVersion)); bytesList.AddRange(Encoding.UTF8.GetBytes(debuggee.Description)); bytesList.AddRange(Encoding.UTF8.GetBytes(debuggee.Project)); var orderedLabels = debuggee.Labels.Select(x => $"{x.Key}:{x.Value}").OrderBy(x => x); bytesList.AddRange(Encoding.UTF8.GetBytes(string.Join(",", orderedLabels))); bytesList.AddRange(Encoding.UTF8.GetBytes(debuggee.SourceContexts.ToString())); byte[] bytes = sha.ComputeHash(bytesList.ToArray()); return(Encoding.UTF8.GetString(bytes)); } }
public void Run(string testCaseName, string testCourceList) { string testSuiteRoot = Path.GetFullPath( Path.Combine(Directory.GetCurrentDirectory(), "../../../..") ); var Env = new NetcoreDbgTestCore.Environment(); Env.TestName = testCaseName; string[] testFileArray = testCourceList.Split(";"); foreach (var FileName in testFileArray) { Env.SourceFilesPath += Path.Combine(testSuiteRoot, testCaseName, FileName + ";"); } Env.SourceFilesPath = Env.SourceFilesPath.Remove(Env.SourceFilesPath.Length - 1); Env.TargetAssemblyPath = Path.Combine(testSuiteRoot, testCaseName + "/bin/Debug/netcoreapp3.1/", testCaseName + ".dll"); string fullDebuggerPath = Path.GetFullPath(Path.Combine(testSuiteRoot, DebuggerPath)); if (testCaseName.StartsWith("MI")) { LocalDebugger = new LocalDebuggerProcess(fullDebuggerPath, @" --interpreter=mi"); LocalDebugger.Start(); DebuggerClient = new MILocalDebuggerClient(LocalDebugger.Input, LocalDebugger.Output); } else if (testCaseName.StartsWith("VSCode")) { LocalDebugger = new LocalDebuggerProcess(fullDebuggerPath, @" --interpreter=vscode"); LocalDebugger.Start(); DebuggerClient = new VSCodeLocalDebuggerClient(LocalDebugger.Input, LocalDebugger.Output); } else { throw new System.Exception(); } Xunit.Assert.True(DebuggerClient.DoHandshake(200)); var Script = new DebuggeeScript(Env.SourceFilesPath, DebuggerClient.Protocol); Debuggee.Run(Script, DebuggerClient, Env); }
public void TestSharedLibWithoutSymbol(ITestSettings settings) { this.TestPurpose("Tests basic bps and source information for shared library without symbols"); this.WriteSettings(settings); IDebuggee debuggee = Debuggee.Open(this, settings.CompilerSettings, Name, DebuggeeMonikers.Optimization.OptimizationWithoutSymbols); using (IDebuggerRunner runner = CreateDebugAdapterRunner(settings)) { this.Comment("Configure launch"); runner.Launch(settings.DebuggerSettings, debuggee); SourceBreakpoints mainBreakpoints = debuggee.Breakpoints(SourceName, 87, 91); this.Comment("Set initial breakpoints"); runner.SetBreakpoints(mainBreakpoints); this.Comment("Launch and run until 1st bp"); runner.Expects.HitBreakpointEvent(SourceName, 87) .AfterConfigurationDone(); this.Comment("Step into the library source"); runner.Expects.HitStepEvent(SourceName, 89) .AfterStepIn(); this.Comment("Check the stack for debugging shared library without symbols"); using (IThreadInspector inspector = runner.GetThreadInspector()) { IFrameInspector currentFrame = inspector.Stack.First(); inspector.AssertStackFrameNames(true, "main"); this.Comment("run to continue to 2nd bp"); runner.Expects.HitBreakpointEvent(SourceName, 91) .AfterContinue(); this.Comment("Check the stack for debugging shared library without symbols"); currentFrame = inspector.Stack.First(); inspector.AssertStackFrameNames(true, "main"); this.Comment("Check the local variables in main function"); IVariableInspector age = currentFrame.Variables["age"]; Assert.Matches("31", age.Value); } runner.DisconnectAndVerify(); } }
public async Task RegisterDebuggeeAsync() { Mock <Controller2.Controller2Client> mockGrpcClient = new Mock <Controller2.Controller2Client>(MockBehavior.Strict); RegisterDebuggeeRequest expectedRequest = new RegisterDebuggeeRequest { Debuggee = new Debuggee(), }; RegisterDebuggeeResponse expectedResponse = new RegisterDebuggeeResponse(); mockGrpcClient.Setup(x => x.RegisterDebuggeeAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <RegisterDebuggeeResponse>(Task.FromResult(expectedResponse), null, null, null, null)); Controller2Client client = new Controller2ClientImpl(mockGrpcClient.Object, null); Debuggee debuggee = new Debuggee(); RegisterDebuggeeResponse response = await client.RegisterDebuggeeAsync(debuggee); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public DDebugExceptionBackTrace(ExceptionRecord rec, DDebugSession session, uint threadId, Debuggee debuggee) : base(session, threadId, debuggee) { this.exceptionRecord = rec; }