Пример #1
0
        public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType exceptionType, uint dwFlags)
        {
            EnterCallback(PausedReason.Exception, "Exception2 (type=" + exceptionType.ToString() + ")", pThread);

            // This callback is also called from Exception(...)!!!! (the .NET 1.1 version)
            // Whatch out for the zeros and null!
            // Exception -> Exception2(pAppDomain, pThread, null, 0, exceptionType, 0);

            process.SelectedThread.CurrentExceptionType = (ExceptionType)exceptionType;

            if (ExceptionType.DEBUG_EXCEPTION_UNHANDLED != (ExceptionType)exceptionType)
            {
                // Handled exception
                if (process.PauseOnHandledException)
                {
                    ExitCallback_Paused();
                }
                else
                {
                    ExitCallback_Continue();
                }
            }
            else
            {
                // Unhandled exception
                ExitCallback_Paused();
            }
        }
Пример #2
0
        public void LogMessage(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, string pLogSwitchName, string pMessage)
        {
            EnterCallback(PausedReason.Other, "LogMessage", pThread);

            process.OnLogMessage(new MessageEventArgs(process, lLevel, pMessage, pLogSwitchName));

            ExitCallback_Continue();
        }
Пример #3
0
        public void BreakpointSetError(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint, uint dwError)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.BreakpointSetError(pAppDomain, pThread, pBreakpoint, dwError);
            }
        }
Пример #4
0
        public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(c);

            if (managedCallback != null)
            {
                managedCallback.MDANotification(c, t, mda);
            }
        }
Пример #5
0
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.FunctionRemapOpportunity(pAppDomain, pThread, pOldFunction, pNewFunction, oldILOffset);
            }
        }
Пример #6
0
        public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.FunctionRemapComplete(pAppDomain, pThread, pFunction);
            }
        }
Пример #7
0
        public void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.ExceptionUnwind(pAppDomain, pThread, dwEventType, dwFlags);
            }
        }
Пример #8
0
        public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType exceptionType, uint dwFlags)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.Exception2(pAppDomain, pThread, pFrame, nOffset, exceptionType, dwFlags);
            }
        }
Пример #9
0
        public void ExitThread(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.ExitThread(pAppDomain, pThread);
            }
        }
Пример #10
0
        public void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval corEval)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.EvalComplete(pAppDomain, pThread, corEval);
            }
        }
Пример #11
0
        public void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.EditAndContinueRemap(pAppDomain, pThread, pFunction, fAccurate);
            }
        }
Пример #12
0
        public void LogMessage(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, string pLogSwitchName, string pMessage)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.LogMessage(pAppDomain, pThread, lLevel, pLogSwitchName, pMessage);
            }
        }
Пример #13
0
        public void LogSwitch(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, uint ulReason, string pLogSwitchName, string pParentName)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.LogSwitch(pAppDomain, pThread, lLevel, ulReason, pLogSwitchName, pParentName);
            }
        }
Пример #14
0
        public unsafe void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int unhandled)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.Exception(pAppDomain, pThread, unhandled);
            }
        }
Пример #15
0
        public unsafe void Break(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.Break(pAppDomain, pThread);
            }
        }
Пример #16
0
        public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.StepComplete(pAppDomain, pThread, pStepper, reason);
            }
        }
Пример #17
0
        // Do not pass the pBreakpoint parameter as ICorDebugBreakpoint - marshaling of it fails in .NET 1.1
        public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, IntPtr pBreakpoint)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.Breakpoint(pAppDomain, pThread, pBreakpoint);
            }
        }
Пример #18
0
        public void CreateThread(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            // We can not use pThread since it has not been added yet
            // and we continue from this callback anyway
            EnterCallback(PausedReason.Other, "CreateThread " + pThread.ID, pAppDomain);

            process.AddThread(pThread);

            ExitCallback_Continue();
        }
Пример #19
0
//		public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType exceptionType, uint dwFlags)
//		{
//			EnterCallback(PausedReason.Exception, "Exception2 (type=" + exceptionType.ToString() + ")", pThread);
//
//			// This callback is also called from Exception(...)!!!! (the .NET 1.1 version)
//			// Watch out for the zeros and null!
//			// Exception -> Exception2(pAppDomain, pThread, null, 0, exceptionType, 0);
//
//			process.SelectedThread.CurrentException = new Exception(new Value(process, new Expressions.CurrentExceptionExpression(), process.SelectedThread.CorThread.CurrentException));
//			process.SelectedThread.CurrentException_DebuggeeState = process.DebuggeeState;
//			process.SelectedThread.CurrentExceptionType = (ExceptionType)exceptionType;
//			process.SelectedThread.CurrentExceptionIsUnhandled = (ExceptionType)exceptionType == ExceptionType.Unhandled;
//
//			if (process.SelectedThread.CurrentExceptionIsUnhandled ||
//			    process.PauseOnHandledException)
//			{
//				pauseOnNextExit = true;
//			}
//			ExitCallback();
//		}

        public void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
        {
            EnterCallback(PausedReason.ExceptionIntercepted, "ExceptionUnwind", pThread);

            if (dwEventType == CorDebugExceptionUnwindCallbackType.DEBUG_EXCEPTION_INTERCEPTED)
            {
                ExitCallback_Paused();
            }
            else
            {
                ExitCallback_Continue();
            }
        }
Пример #20
0
        // Do not pass the pBreakpoint parameter as ICorDebugBreakpoint - marshaling of it fails in .NET 1.1
        public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, IntPtr pBreakpoint)
        {
            EnterCallback(PausedReason.Breakpoint, "Breakpoint", pThread);
            this.process.NotifyPaused(new PauseSession(PausedReason.Breakpoint));
            ExitCallback_Paused();

//			foreach (Breakpoint b in debugger.Breakpoints) {
//				if (b.Equals(pBreakpoint)) {
//					// TODO: Check that this works
//					b.OnHit();
//				}
//			}
        }
Пример #21
0
        public void ExitThread(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            // It seems that ICorDebugThread is still not dead and can be used
            EnterCallback(PausedReason.Other, "ExitThread " + pThread.ID, pThread);

            process.GetThread(pThread).NotifyNativeThreadExited();

            try {
                ExitCallback_Continue();
            } catch (COMException e) {
                // For some reason this sometimes happens in .NET 1.1
                process.TraceMessage("Continue failed in ExitThread callback: " + e.Message);
            }
        }
Пример #22
0
        public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
        {
            if (c.Is <ICorDebugAppDomain>())
            {
                EnterCallback(PausedReason.Other, "MDANotification", c.CastTo <ICorDebugAppDomain>());
            }
            else if (c.Is <ICorDebugProcess>())
            {
                EnterCallback(PausedReason.Other, "MDANotification", c.CastTo <ICorDebugProcess>());
            }
            else
            {
                throw new System.Exception("Unknown callback argument");
            }

            ExitCallback_Continue();
        }
Пример #23
0
        public void NameChange(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            ManagedCallback managedCallback = null;

            if (pAppDomain != null)
            {
                managedCallback = GetProcessCallbackInterface(pAppDomain);
            }
            if (pThread != null)
            {
                managedCallback = GetProcessCallbackInterface(pThread.Process);
            }
            if (managedCallback != null)
            {
                managedCallback.NameChange(pAppDomain, pThread);
            }
        }
Пример #24
0
        void HandleEvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval corEval, bool exception)
        {
            // Let the eval know that the CorEval has finished
            Eval eval = process.GetEval(corEval);

            eval.NotifyEvaluationComplete(!exception);
            process.NotifyEvaluationComplete(eval);

            if (process.SetupNextEvaluation())
            {
                ExitCallback_Continue();
            }
            else
            {
                ExitCallback_Paused();
            }
        }
Пример #25
0
        public void NameChange(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            if (pAppDomain != null)
            {
                EnterCallback(PausedReason.Other, "NameChange: pAppDomain", pAppDomain);

                ExitCallback_Continue();
            }
            if (pThread != null)
            {
                EnterCallback(PausedReason.Other, "NameChange: pThread", pThread);

                Thread thread = process.GetThread(pThread);
                thread.HasBeenLoaded = true;

                ExitCallback_Continue();
            }
        }
Пример #26
0
        public unsafe void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int unhandled)
        {
            // Exception2 is used in .NET Framework 2.0

            if (process.DebuggeeVersion.StartsWith("v1."))
            {
                // Forward the call to Exception2, which handles EnterCallback and ExitCallback
                ExceptionType exceptionType = (unhandled != 0)?ExceptionType.DEBUG_EXCEPTION_UNHANDLED:ExceptionType.DEBUG_EXCEPTION_FIRST_CHANCE;
                Exception2(pAppDomain, pThread, null, 0, (CorDebugExceptionCallbackType)exceptionType, 0);
            }
            else
            {
                // This callback should be ignored in v2 applications
                EnterCallback(PausedReason.Other, "Exception", pThread);

                ExitCallback_Continue();
            }
        }
Пример #27
0
        public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
        {
            EnterCallback(PausedReason.StepComplete, "StepComplete (" + reason.ToString() + ")", pThread);

            Thread  thread  = process.GetThread(pThread);
            Stepper stepper = thread.GetStepper(pStepper);

            process.TraceMessage(" - stepper info: " + stepper.ToString());

            thread.Steppers.Remove(stepper);
            stepper.OnStepComplete();

            if (stepper.PauseWhenComplete)
            {
                if (process.SelectedThread.LastFunction.HasSymbols)
                {
                    ExitCallback_Paused();
                }
                else
                {
                    // This can only happen when JMC is disabled (ie NET1.1 or StepOut)
                    if (stepper.Operation == Stepper.StepperOperation.StepOut)
                    {
                        // Create new stepper and keep going
                        process.TraceMessage(" - stepping out of code without symbols at " + process.SelectedThread.LastFunction.ToString());
                        new Stepper(process.SelectedThread.LastFunction, "Stepper out of code without symbols").StepOut();
                        ExitCallback_Continue();
                    }
                    else
                    {
                        // NET1.1: There is extra step over stepper, just keep going
                        process.TraceMessage(" - leaving code without symbols");
                        ExitCallback_Continue();
                    }
                }
            }
            else
            {
                ExitCallback_Continue();
            }
        }
Пример #28
0
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            EnterCallback(PausedReason.Other, "FunctionRemapOpportunity", pThread);

            ExitCallback_Continue();
        }
Пример #29
0
        public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
        {
            EnterCallback(PausedReason.Other, "FunctionRemapComplete", pThread);

            ExitCallback_Continue();
        }
Пример #30
0
        public void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval corEval)
        {
            EnterCallback(PausedReason.EvalComplete, "EvalComplete", pThread);

            HandleEvalComplete(pAppDomain, pThread, corEval, false);
        }