示例#1
0
 protected override sealed unsafe int OnDestroyConnection(
     void * @this,
     void *pProcess,
     uint dwConnectionId)
 => OnDestroyConnection(
     ComFactory.Create <CorDebugProcess>(pProcess),
     dwConnectionId);
示例#2
0
 protected override sealed unsafe int OnCreateConnection(
     void * @this,
     void *pProcess,
     uint dwConnectionId,
     char *pConnName)
 => OnCreateConnection(
     ComFactory.Create <CorDebugProcess>(pProcess),
     dwConnectionId,
     UnsafeOps.WCharToSpan(pConnName));
示例#3
0
 protected override sealed unsafe int OnBreakpoint(
     void * @this,
     void *pAppDomain,
     void *pThread,
     void *pBreakpoint)
 => OnBreakpoint(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugBreakpoint>(pBreakpoint));
示例#4
0
 protected override sealed unsafe int OnDebuggerError(
     void * @this,
     void *pProcess,
     int errorHR,
     uint errorCode)
 => OnDebuggerError(
     ComFactory.Create <CorDebugProcess>(pProcess),
     errorHR,
     errorCode);
示例#5
0
 protected override sealed unsafe int OnFunctionRemapComplete(
     void * @this,
     void *pAppDomain,
     void *pThread,
     void *pFunction)
 => OnFunctionRemapComplete(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugFunction>(pFunction));
示例#6
0
 protected override sealed unsafe int OnEvalException(
     void * @this,
     void *pAppDomain,
     void *pThread,
     void *pEval)
 => OnEvalException(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugEval>(pEval));
示例#7
0
 protected override sealed unsafe int OnException(
     void * @this,
     void *pAppDomain,
     void *pThread,
     bool unhandled)
 => OnException(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     unhandled);
示例#8
0
 protected override sealed unsafe int OnUpdateModuleSymbols(
     void * @this,
     void *pAppDomain,
     void *pModule,
     void *pSymbolStream)
 => OnUpdateModuleSymbols(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugModule>(pModule),
     new IntPtr(pSymbolStream));
示例#9
0
 protected override sealed unsafe int OnMDANotification(
     void * @this,
     void *pController,
     void *pThread,
     void *pMDA)
 => OnMDANotification(
     ComFactory.Create <CorDebugController>(pController),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugMDA>(pMDA));
示例#10
0
 protected override sealed unsafe int OnEditAndContinueRemap(
     void * @this,
     void *pAppDomain,
     void *pThread,
     void *pFunction,
     bool fAccurate)
 => OnEditAndContinueRemap(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugFunction>(pFunction),
     fAccurate);
示例#11
0
 protected override sealed unsafe int OnExceptionUnwind(
     void * @this,
     void *pAppDomain,
     void *pThread,
     int dwEventType,
     uint dwFlags)
 => OnExceptionUnwind(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     (CorDebugExceptionUnwindCallbackType)dwEventType,
     dwFlags);
示例#12
0
 protected override sealed unsafe int OnStepComplete(
     void * @this,
     void *pAppDomain,
     void *pThread,
     void *pStepper,
     int reason)
 => OnStepComplete(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugStepper>(pStepper),
     (CorDebugStepReason)reason);
示例#13
0
 protected override sealed unsafe int OnFunctionRemapOpportunity(
     void * @this,
     void *pAppDomain,
     void *pThread,
     void *pOldFunction,
     void *pNewFunction,
     uint oldILOffset)
 => OnFunctionRemapOpportunity(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugFunction>(pOldFunction),
     ComFactory.Create <CorDebugFunction>(pNewFunction),
     oldILOffset);
示例#14
0
 protected override sealed unsafe int OnLogMessage(
     void * @this,
     void *pAppDomain,
     void *pThread,
     int lLevel,
     char *pLogSwitchName,
     char *pMessage)
 => OnLogMessage(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     lLevel,
     UnsafeOps.WCharToSpan(pLogSwitchName),
     UnsafeOps.WCharToSpan(pMessage));
示例#15
0
 protected override sealed unsafe int OnLogSwitch(
     void * @this,
     void *pAppDomain,
     void *pThread,
     int lLevel,
     uint ulReason,
     char *pLogSwitchName,
     char *pParentName)
 => OnLogSwitch(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     lLevel,
     ulReason,
     UnsafeOps.WCharToSpan(pLogSwitchName),
     UnsafeOps.WCharToSpan(pParentName));
示例#16
0
 protected override sealed unsafe int OnException2(
     void * @this,
     void *pAppDomain,
     void *pThread,
     void *pFrame,
     uint nOffset,
     int dwEventType,
     uint dwFlags)
 => OnException2(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread),
     ComFactory.Create <CorDebugFrame>(pFrame),
     nOffset,
     (CorDebugExceptionCallbackType)dwEventType,
     dwFlags);
示例#17
0
        public static unsafe DebugEngine Attach(int processId)
        {
            if (processId == Process.GetCurrentProcess().Id)
            {
                throw new ArgumentException(
                          "Cannot debug the current process.",
                          nameof(processId));
            }

            Process process = Process.GetProcessById(processId);
            IntPtr  hModule = GetClrModule(process);
            void ** ppCordb = default;

            MscordbiShim.CreateCordbObject(
                iDebuggerVersion: 5,
                unchecked ((uint)processId),
                hModule.ToPointer(),
                &ppCordb);

            if (ppCordb == default)
            {
                throw new InvalidOperationException();
            }

            var engine = new DebugEngine
            {
                _callbacks = new LoggerManagedCallbacks(),
                CorDebug   = ComFactory.Create <CorDebug>(ppCordb),
            };

            engine.CorDebug.Initialize().MaybeThrowHr();
            engine.CorDebug.SetManagedHandler(engine._callbacks.CallbacksPointer).MaybeThrowHr();
            engine.CorDebug.DebugActiveProcess(
                unchecked ((uint)processId),
                win32Attach: false,
                out engine._process)
            .MaybeThrowHr();

            engine._callbacks.Control = engine.CorProcess;

            return(engine);
        }
示例#18
0
 protected override sealed unsafe int OnExitAppDomain(void * @this, void *pProcess, void *pAppDomain)
 => OnExitAppDomain(
     ComFactory.Create <CorDebugProcess>(pProcess),
     ComFactory.Create <CorDebugAppDomain>(pAppDomain));
示例#19
0
 protected override sealed unsafe int OnExitThread(void * @this, void *pAppDomain, void *thread)
 => OnExitThread(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(thread));
示例#20
0
 protected override sealed unsafe int OnExitProcess(void * @this, void *pProcess)
 => OnExitProcess(ComFactory.Create <CorDebugProcess>(pProcess));
示例#21
0
 protected override sealed unsafe int OnUnloadModule(void * @this, void *pAppDomain, void *pModule)
 => OnUnloadModule(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugModule>(pModule));
示例#22
0
 protected override sealed unsafe int OnUnloadClass(void * @this, void *pAppDomain, void *c)
 => OnUnloadClass(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugClass>(c));
示例#23
0
 protected override sealed unsafe int OnUnloadAssembly(void * @this, void *pAppDomain, void *pAssembly)
 => OnUnloadAssembly(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugAssembly>(pAssembly));
示例#24
0
 protected override sealed unsafe int OnControlCTrap(void * @this, void *pProcess)
 => OnControlCTrap(ComFactory.Create <CorDebugProcess>(pProcess));
示例#25
0
 protected override sealed unsafe int OnNameChange(void * @this, void *pAppDomain, void *pThread)
 => OnNameChange(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread));