Пример #1
0
 public async Task CreateDebuggingInterfaceFromVersion2(TestConfiguration config)
 {
     await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersion2), static async (string configXml) =>
     {
         using DebuggeeInfo debuggeeInfo = await StartDebuggee(configXml, launch: false);
         TestCreateDebuggingInterface(debuggeeInfo, 2);
         return(0);
     });
 }
Пример #2
0
 public async Task Attach2(TestConfiguration config)
 {
     await RemoteInvoke(config, nameof(Attach2), static async (string configXml) =>
     {
         using DebuggeeInfo debuggeeInfo = await StartDebuggee(configXml, launch: false);
         TestRegisterForRuntimeStartup(debuggeeInfo, 2);
         return(0);
     });
 }
Пример #3
0
        public async Task Launch2(TestConfiguration config)
        {
            await RemoteInvoke(config, nameof(Launch2), static async (string configXml) =>
            {
                using DebuggeeInfo debuggeeInfo = await StartDebuggee(configXml, launch: true);
                TestRegisterForRuntimeStartup(debuggeeInfo, 2);

                // Once the debuggee is resumed now wait until it starts
                Assert.True(await debuggeeInfo.WaitForDebuggee());
                return(0);
            });
        }
Пример #4
0
        public ManagedCallbackWrapper(DebuggeeInfo startInfo)
        {
            _startInfo = startInfo;

            VTableBuilder builder = AddInterface(IID_ICorDebugManagedCallback, validate: false);

            builder.AddMethod(new BreakpointDelegate((self, pAppDomain, pThread, pBreakpoint) => HResult.E_NOTIMPL));
            builder.AddMethod(new StepCompleteDelegate((self, pAppDomain, pThread, pStepper, reason) => HResult.E_NOTIMPL));
            builder.AddMethod(new BreakDelegate((self, pAppDomain, pThread) => WriteLine("Break")));
            builder.AddMethod(new ExceptionDelegate((self, pAppDomain, pThread, unhandled) => WriteLine("Exception")));
            builder.AddMethod(new EvalCompleteDelegate((self, pAppDomain, pThread, pEval) => HResult.E_NOTIMPL));
            builder.AddMethod(new EvalExceptionDelegate((self, pAppDomain, pThread, pEval) => HResult.E_NOTIMPL));
            builder.AddMethod(new CreateProcessDelegate((self, pProcess) => CreateProcess(pProcess)));
            builder.AddMethod(new ExitProcessDelegate((self, pProcess) => WriteLine("ExitProcess")));
            builder.AddMethod(new CreateThreadDelegate((self, pAppDomain, pThread) => HResult.E_NOTIMPL));
            builder.AddMethod(new ExitThreadDelegate((self, pAppDomain, pThread) => HResult.E_NOTIMPL));
            builder.AddMethod(new LoadModuleDelegate((self, pAppDomain, pModule) => HResult.E_NOTIMPL));
            builder.AddMethod(new UnloadModuleDelegate((self, pAppDomain, pModule) => HResult.E_NOTIMPL));
            builder.AddMethod(new LoadClassDelegate((self, pAppDomain, c) => HResult.E_NOTIMPL));
            builder.AddMethod(new UnloadClassDelegate((self, pAppDomain, c) => HResult.E_NOTIMPL));
            builder.AddMethod(new DebuggerErrorDelegate((self, pProcess, errorHR, errorCode) => WriteLine($"DebuggerError {errorHR} {errorCode:X8}")));
            builder.AddMethod(new LogMessageDelegate((self, pAppDomain, pThread, lLevel, pLogSwitchName, pMessage) => HResult.E_NOTIMPL));
            builder.AddMethod(new LogSwitchDelegate((self, pAppDomain, pThread, lLevel, ulReason, pLogSwitchName, pParentName) => HResult.E_NOTIMPL));
            builder.AddMethod(new CreateAppDomainDelegate((self, pProcess, pAppDomain) => HResult.E_NOTIMPL));
            builder.AddMethod(new ExitAppDomainDelegate((self, pProcess, pAppDomain) => HResult.E_NOTIMPL));
            builder.AddMethod(new LoadAssemblyDelegate((self, pAppDomain, pAssembly) => HResult.E_NOTIMPL));
            builder.AddMethod(new UnloadAssemblyDelegate((self, pAppDomain, pAssembly) => HResult.E_NOTIMPL));
            builder.AddMethod(new ControlCTrapDelegate((self, pProcess) => HResult.E_NOTIMPL));
            builder.AddMethod(new NameChangeDelegate((self, pAppDomain, pThread) => HResult.E_NOTIMPL));
            builder.AddMethod(new UpdateModuleSymbolsDelegate((self, pAppDomain, pModule, pSymbolStream) => HResult.E_NOTIMPL));
            builder.AddMethod(new EditAndContinueRemapDelegate((self, pAppDomain, pThread, pFunction, fAccurate) => HResult.E_NOTIMPL));
            builder.AddMethod(new BreakpointSetErrorDelegate((self, pAppDomain, pThread, pBreakpoint, dwError) => HResult.E_NOTIMPL));
            ICorDebugManagedCallback = builder.Complete();

            builder = AddInterface(IID_ICorDebugManagedCallback2, validate: false);
            builder.AddMethod(new FunctionRemapOpportunityDelegate((self, pAppDomain, pThread, pOldFunction, pNewFunction, oldILOffset) => HResult.E_NOTIMPL));
            builder.AddMethod(new CreateConnectionDelegate((IntPtr self, IntPtr pProcess, uint dwConnectionId, ref ushort pConnName) => HResult.E_NOTIMPL));
            builder.AddMethod(new ChangeConnectionDelegate((self, pProcess, dwConnectionId) => HResult.E_NOTIMPL));
            builder.AddMethod(new DestroyConnectionDelegate((self, pProcess, dwConnectionId) => HResult.E_NOTIMPL));
            builder.AddMethod(new ExceptionDelegate2((self, pAppDomain, pThread, pFrame, nOffset, dwEventType, dwFlags) => HResult.E_NOTIMPL));
            builder.AddMethod(new ExceptionUnwindDelegate((self, pAppDomain, pThread, dwEventType, dwFlags) => HResult.E_NOTIMPL));
            builder.AddMethod(new FunctionRemapCompleteDelegate((self, pAppDomain, pThread, pFunction) => HResult.E_NOTIMPL));
            builder.AddMethod(new MDANotificationDelegate((self, pController, pThread, pMDA) => HResult.E_NOTIMPL));
            builder.Complete();

            AddRef();
        }
Пример #5
0
 public async Task CreateDebuggingInterfaceFromVersion3(TestConfiguration config)
 {
     if (OS.Kind == OSKind.OSX && config.PublishSingleFile)
     {
         throw new SkipTestException("CreateDebuggingInterfaceFromVersion3 single-file on MacOS");
     }
     DbgShimAPI.Initialize(config.DbgShimPath());
     if (!DbgShimAPI.IsCreateDebuggingInterfaceFromVersion3Supported)
     {
         throw new SkipTestException("CreateDebuggingInterfaceFromVersion3 not supported");
     }
     await RemoteInvoke(config, nameof(CreateDebuggingInterfaceFromVersion3), static async (string configXml) =>
     {
         using DebuggeeInfo debuggeeInfo = await StartDebuggee(configXml, launch: false);
         TestCreateDebuggingInterface(debuggeeInfo, 3);
         return(0);
     });
 }
Пример #6
0
 public async Task Attach3(TestConfiguration config)
 {
     if (OS.Kind == OSKind.OSX && config.PublishSingleFile)
     {
         throw new SkipTestException("Attach3 single-file on MacOS");
     }
     DbgShimAPI.Initialize(config.DbgShimPath());
     if (!DbgShimAPI.IsRegisterForRuntimeStartup3Supported)
     {
         throw new SkipTestException("IsRegisterForRuntimeStartup3 not supported");
     }
     await RemoteInvoke(config, nameof(Attach3), static async (string configXml) =>
     {
         using DebuggeeInfo debuggeeInfo = await StartDebuggee(configXml, launch: false);
         TestRegisterForRuntimeStartup(debuggeeInfo, 3);
         return(0);
     });
 }
Пример #7
0
        public async Task Launch3(TestConfiguration config)
        {
            if (OS.Kind == OSKind.OSX && config.PublishSingleFile)
            {
                throw new SkipTestException("Launch3 single-file on MacOS");
            }
            DbgShimAPI.Initialize(config.DbgShimPath());
            if (!DbgShimAPI.IsRegisterForRuntimeStartup3Supported)
            {
                throw new SkipTestException("IsRegisterForRuntimeStartup3 not supported");
            }
            await RemoteInvoke(config, nameof(Launch3), static async (string configXml) =>
            {
                using DebuggeeInfo debuggeeInfo = await StartDebuggee(configXml, launch: true);
                TestRegisterForRuntimeStartup(debuggeeInfo, 3);

                // Once the debuggee is resumed now wait until it starts
                Assert.True(await debuggeeInfo.WaitForDebuggee());
                return(0);
            });
        }
Пример #8
0
 public async Task EnumerateCLRs(TestConfiguration config)
 {
     await RemoteInvoke(config, nameof(EnumerateCLRs), static async (string configXml) =>
     {
         using DebuggeeInfo debuggeeInfo = await StartDebuggee(configXml, launch: false);
         Trace.TraceInformation("EnumerateCLRs pid {0} START", debuggeeInfo.ProcessId);
         HResult hr = DbgShimAPI.EnumerateCLRs(debuggeeInfo.ProcessId, (IntPtr[] continueEventHandles, string[] moduleNames) =>
         {
             Assert.Single(continueEventHandles);
             Assert.Single(moduleNames);
             for (int i = 0; i < continueEventHandles.Length; i++)
             {
                 Trace.TraceInformation("EnumerateCLRs pid {0} {1:X16} {2}", debuggeeInfo.ProcessId, continueEventHandles[i].ToInt64(), moduleNames[i]);
                 AssertX.FileExists("ModuleFilePath", moduleNames[i], debuggeeInfo.Output);
             }
         });
         AssertResult(hr);
         Trace.TraceInformation("EnumerateCLRs pid {0} DONE", debuggeeInfo.ProcessId);
         return(0);
     });
 }