Ejemplo n.º 1
0
 protected override sealed unsafe int OnDestroyConnection(
     void * @this,
     void *pProcess,
     uint dwConnectionId)
 => OnDestroyConnection(
     ComFactory.Create <CorDebugProcess>(pProcess),
     dwConnectionId);
Ejemplo n.º 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));
Ejemplo n.º 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));
Ejemplo n.º 4
0
 protected override sealed unsafe int OnDebuggerError(
     void * @this,
     void *pProcess,
     int errorHR,
     uint errorCode)
 => OnDebuggerError(
     ComFactory.Create <CorDebugProcess>(pProcess),
     errorHR,
     errorCode);
Ejemplo n.º 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));
Ejemplo n.º 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));
Ejemplo n.º 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);
Ejemplo n.º 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));
Ejemplo n.º 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));
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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);
Ejemplo n.º 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));
Ejemplo n.º 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));
Ejemplo n.º 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);
Ejemplo n.º 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);
        }
Ejemplo n.º 18
0
 protected override sealed unsafe int OnExitAppDomain(void * @this, void *pProcess, void *pAppDomain)
 => OnExitAppDomain(
     ComFactory.Create <CorDebugProcess>(pProcess),
     ComFactory.Create <CorDebugAppDomain>(pAppDomain));
Ejemplo n.º 19
0
 protected override sealed unsafe int OnExitThread(void * @this, void *pAppDomain, void *thread)
 => OnExitThread(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(thread));
Ejemplo n.º 20
0
 protected override sealed unsafe int OnExitProcess(void * @this, void *pProcess)
 => OnExitProcess(ComFactory.Create <CorDebugProcess>(pProcess));
Ejemplo n.º 21
0
 protected override sealed unsafe int OnUnloadModule(void * @this, void *pAppDomain, void *pModule)
 => OnUnloadModule(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugModule>(pModule));
Ejemplo n.º 22
0
 protected override sealed unsafe int OnUnloadClass(void * @this, void *pAppDomain, void *c)
 => OnUnloadClass(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugClass>(c));
Ejemplo n.º 23
0
 protected override sealed unsafe int OnUnloadAssembly(void * @this, void *pAppDomain, void *pAssembly)
 => OnUnloadAssembly(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugAssembly>(pAssembly));
Ejemplo n.º 24
0
 protected override sealed unsafe int OnControlCTrap(void * @this, void *pProcess)
 => OnControlCTrap(ComFactory.Create <CorDebugProcess>(pProcess));
Ejemplo n.º 25
0
 protected override sealed unsafe int OnNameChange(void * @this, void *pAppDomain, void *pThread)
 => OnNameChange(
     ComFactory.Create <CorDebugAppDomain>(pAppDomain),
     ComFactory.Create <CorDebugThread>(pThread));