Exemple #1
0
        public void Break(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
        {
            EnterCallback(PausedReason.Break, "Break", pThread);

            pauseOnNextExit = true;
            ExitCallback();
        }
 public CorDebugThread(ICorDebugThread _thread)
 {
     m_corThread = _thread;
     uint id;
     m_corThread.GetID(out id);
     ID = id;
 }
		// 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);
			}
		}
 public virtual void Breakpoint(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugBreakpoint breakpoint)
 {
     this.DefaultHandler(appDomain);
 }
		public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);
			if (managedCallback != null) {
				managedCallback.StepComplete(pAppDomain, pThread, pStepper, reason);
			}
		}
 public void Breakpoint(
     ICorDebugAppDomain pAppDomain, 
     ICorDebugThread pThread, 
     ICorDebugBreakpoint pBreakpoint)
 {
     m_listner.PostBreakPoint(new CorThread(pThread));
     //controller.Continue(0);
 }
 public virtual void EditAndContinueRemap(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugFunction function, 
     bool accurate)
 {
     this.DefaultHandler(appDomain);
 }
Exemple #8
0
        public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint)
        {
            var handler = OnBreakpoint;
            if (handler != null)
            {
                handler(this, new DebuggerBreakpointEventArgs(pThread, pBreakpoint));
            }

            pAppDomain.Continue(0);
        }
		internal void AddThread(ICorDebugThread corThread)
		{
			Thread thread = new Thread(this, corThread);
			threadCollection.Add(thread);
			OnThreadStarted(thread);
			
			thread.NativeThreadExited += delegate {
				threadCollection.Remove(thread);
			};
		}
		internal Thread GetThread(ICorDebugThread corThread)
		{
			foreach(Thread thread in threadCollection) {
				if (thread.CorThread == corThread) {
					return thread;
				}
			}
			
			throw new DebuggerException("Thread is not in collection");
		}
        private void HandleEvalEvent(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
        {
            var domain = GetProcessWrapper(pAppDomain).GetAppDomain(pAppDomain);
            var thread = domain.GetThread(pThread);
            var eval = Session.ComInstanceCollector.GetWrapper<RuntimeEvaluation>(pEval);

            var eventArgs = new DebuggerEventArgs(domain, true);
            eval.DispatchEvaluationCompleted(eventArgs);
            FinalizeEvent(eventArgs);
        }
		public ManagedCallback GetProcessCallbackInterface(string name, ICorDebugThread pThread)
		{
			ICorDebugProcess pProcess;
			try {
				pProcess = pThread.Process;
			} catch (COMException e) {
				debugger.TraceMessage("Ignoring callback \"" + name + "\": " + e.Message);
				return null;
			}
			return GetProcessCallbackInterface(name, pProcess);
		}
        //
        // IEnumerator interface
        //

        #region IEnumerator Members

        public bool MoveNext()
        {
            var a = new ICorDebugThread[1];
            uint c = 0;
            int r = m_enum.Next((uint) a.Length, a, out c);
            if (r == 0 && c == 1) // S_OK && we got 1 new element
                m_th = new CorThread(a[0]);
            else
                m_th = null;
            return m_th != null;
        }
Exemple #14
0
        /// <summary>
        /// Finds appropriete SequncePointMap instances and builds SequencePointRemapper, gets new IL offset and call RemapFunction.
        /// </summary>
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            ICorDebugILFrame2 frame = (ICorDebugILFrame2) pThread.GetActiveFrame();

            uint nToken = pOldFunction.GetToken();

            SequencePointRemapper remapper;
            if(!remappers.TryGetValue(nToken,out remapper)){
                throw new KeyNotFoundException("Methods sequence points not found.");
            }
            frame.__RemapFunction(remapper.TranslateILOffset(oldILOffset));
        }
Exemple #15
0
        // Warning! Marshaing of ICorBreakpoint fails in .NET 1.1
        public void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint corBreakpoint)
        {
            EnterCallback(PausedReason.Breakpoint, "Breakpoint", pThread);

            Breakpoint breakpoint = process.Debugger.Breakpoints[corBreakpoint];
            // The event will be risen outside the callback
            process.BreakpointHitEventQueue.Enqueue(breakpoint);

            pauseOnNextExit = true;

            ExitCallback();
        }
Exemple #16
0
 public virtual void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     pController.Continue(0);
 }
Exemple #17
0
 public virtual void LogMessage(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, string pLogSwitchName, string pMessage)
 {
     pAppDomain.Continue(0);
 }
Exemple #18
0
 public virtual void NameChange(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread)
 {
     pAppDomain.Continue(0);
 }
Exemple #19
0
 public virtual void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
 {
     pAppDomain.Continue(0);
 }
Exemple #20
0
            void ICorDebugManagedCallback2.ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }
Exemple #21
0
            void ICorDebugManagedCallback.BreakpointSetError(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint, uint dwError)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }
Exemple #22
0
            void ICorDebugManagedCallback.CreateThread(ICorDebugAppDomain pAppDomain, ICorDebugThread thread)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }
Exemple #23
0
 public virtual void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
 {
     pAppDomain.Continue(0);
 }
Exemple #24
0
 public virtual void EvalException(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
 {
     pAppDomain.Continue(0);
 }
Exemple #25
0
 public virtual void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
 {
     pAppDomain.Continue(0);
 }
Exemple #26
0
 public virtual void Exception(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int unhandled)
 {
     pAppDomain.Continue(0);
 }
Exemple #27
0
 public virtual void Break(ICorDebugAppDomain pAppDomain, ICorDebugThread thread)
 {
     pAppDomain.Continue(0);
 }
Exemple #28
0
 public virtual void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
 {
     pAppDomain.Continue(0);
 }
Exemple #29
0
 public virtual void Breakpoint(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint)
 {
     pAppDomain.Continue(0);
 }
Exemple #30
0
 public virtual void BreakpointSetError(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint, uint dwError)
 {
     pAppDomain.Continue(0);
 }
Exemple #31
0
            void ICorDebugManagedCallback.EvalException(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval pEval)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }
Exemple #32
0
 void ICorDebugManagedCallback.StepComplete(ICorDebugAppDomain appDomain,
                            ICorDebugThread thread,
                            ICorDebugStepper stepper,
                            CorDebugStepReason stepReason)
 {
     HandleEvent(ManagedCallbackType.OnStepComplete,
                        new CorStepCompleteEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                     thread == null ? null : new CorThread(thread),
                                                     stepper == null ? null : new CorStepper(stepper),
                                                     stepReason,
                                                     ManagedCallbackType.OnStepComplete));
 }
Exemple #33
0
 void ICorDebugManagedCallback.EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
 {
     // TODO HandleEvent(ManagedCallbackType.On new CorEventArgs(new CorAppDomain(pAppDomain)));
 }
Exemple #34
0
 void ICorDebugManagedCallback.EvalException(
                            ICorDebugAppDomain appDomain,
                            ICorDebugThread thread,
                            ICorDebugEval eval)
 {
     HandleEvent(ManagedCallbackType.OnEvalException,
                       new CorEvalEventArgs( appDomain == null ? null : new CorAppDomain(appDomain),
                                             thread == null ? null : new CorThread(thread),
                                             eval == null ? null : new CorEval(eval),
                                             ManagedCallbackType.OnEvalException));
 }
Exemple #35
0
            void ICorDebugManagedCallback2.FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }
Exemple #36
0
 void ICorDebugManagedCallback.LogMessage(
                         ICorDebugAppDomain appDomain,
                         ICorDebugThread thread,
                         int level,
                         string logSwitchName,
                         string message)
 {
     HandleEvent(ManagedCallbackType.OnLogMessage,
                        new CorLogMessageEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                   thread == null ? null : new CorThread(thread),
                                                   level, logSwitchName, message,
                                                   ManagedCallbackType.OnLogMessage));
 }
Exemple #37
0
 void ICorDebugManagedCallback2.FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
 {
     // TODO HandleEvent(<new CorEventArgs(new CorAppDomain(pAppDomain)));
 }
Exemple #38
0
 void ICorDebugManagedCallback.NameChange(
                         ICorDebugAppDomain appDomain,
                         ICorDebugThread thread)
 {
     HandleEvent(ManagedCallbackType.OnNameChange,
                       new CorThreadEventArgs( appDomain == null ? null : new CorAppDomain(appDomain),
                                               thread == null ? null : new CorThread(thread),
                                               ManagedCallbackType.OnNameChange));
 }
Exemple #39
0
 void ICorDebugManagedCallback.BreakpointSetError(
                                ICorDebugAppDomain appDomain,
                                ICorDebugThread thread,
                                ICorDebugBreakpoint breakpoint,
                                UInt32 errorCode)
 {
     HandleEvent(ManagedCallbackType.OnBreakpointSetError,
                       new CorBreakpointSetErrorEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                 thread == null ? null : new CorThread(thread),
                                                 null, 
                                                 (int)errorCode,
                                                 ManagedCallbackType.OnBreakpointSetError));
 }
Exemple #40
0
 void ICorDebugManagedCallback2.FunctionRemapComplete(ICorDebugAppDomain appDomain,
                                                      ICorDebugThread thread,
                                                      ICorDebugFunction managedFunction)
 {
     HandleEvent(ManagedCallbackType.OnFunctionRemapComplete,
                        new CorFunctionRemapCompleteEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                               thread == null ? null : new CorThread(thread),
                                               managedFunction == null ? null : new CorFunction(managedFunction),
                                               ManagedCallbackType.OnFunctionRemapComplete));
 }
Exemple #41
0
 public virtual void LogSwitch(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, uint ulReason, string pLogSwitchName, string pParentName)
 {
     pAppDomain.Continue(0);
 }
Exemple #42
0
 void ICorDebugManagedCallback2.ExceptionUnwind(ICorDebugAppDomain ad, ICorDebugThread thread,
                                                CorDebugExceptionUnwindCallbackType eventType, uint flags)
 {
     HandleEvent(ManagedCallbackType.OnExceptionUnwind2,
                               new CorExceptionUnwind2EventArgs(ad == null ? null : new CorAppDomain(ad),
                                                 thread == null ? null : new CorThread(thread),
                                                 eventType,
                                                 (int)flags,
                                                 ManagedCallbackType.OnExceptionUnwind2));
 }
Exemple #43
0
 internal DnThread(DnProcess ownerProcess, ICorDebugThread thread, int incrementedId)
 {
     this.ownerProcess  = ownerProcess;
     this.thread        = new CorThread(thread);
     this.incrementedId = incrementedId;
 }
Exemple #44
0
 public virtual void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
 {
     pAppDomain.Continue(0);
 }
Exemple #45
0
 void ICorDebugManagedCallback.Breakpoint(ICorDebugAppDomain appDomain,
                         ICorDebugThread thread,
                         ICorDebugBreakpoint breakpoint)
 {
     HandleEvent(ManagedCallbackType.OnBreakpoint,
                        new CorBreakpointEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                    thread == null ? null : new CorThread(thread),
                                                    breakpoint == null ? null : new CorFunctionBreakpoint((ICorDebugFunctionBreakpoint)breakpoint),
                                                    ManagedCallbackType.OnBreakpoint
                                                    ));
 }
Exemple #46
0
        public void BreakpointSetError(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugBreakpoint pBreakpoint, uint dwError)
        {
            EnterCallback(PausedReason.Other, "BreakpointSetError", pThread);

            ExitCallback();
        }
Exemple #47
0
 void ICorDebugManagedCallback.Exception(
                                          ICorDebugAppDomain appDomain,
                                          ICorDebugThread thread,
                                          int unhandled)
 {
     HandleEvent(ManagedCallbackType.OnException,
                        new CorExceptionEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                  thread == null ? null : new CorThread(thread),
                                                  !(unhandled == 0),
                                                  ManagedCallbackType.OnException));
 }
Exemple #48
0
        public void LogSwitch(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, int lLevel, uint ulReason, string pLogSwitchName, string pParentName)
        {
            EnterCallback(PausedReason.Other, "LogSwitch", pThread);

            ExitCallback();
        }
Exemple #49
0
 void ICorDebugManagedCallback.ExitThread(
                         ICorDebugAppDomain appDomain,
                         ICorDebugThread thread)
 {
     HandleEvent(ManagedCallbackType.OnThreadExit,
                       new CorThreadEventArgs( appDomain == null ? null : new CorAppDomain(appDomain),
                                               thread == null ? null : new CorThread(thread),
                                               ManagedCallbackType.OnThreadExit));
 }
Exemple #50
0
        public void EditAndContinueRemap(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction, int fAccurate)
        {
            EnterCallback(PausedReason.Other, "EditAndContinueRemap", pThread);

            ExitCallback();
        }
Exemple #51
0
 void ICorDebugManagedCallback.LogSwitch(
                        ICorDebugAppDomain appDomain,
                        ICorDebugThread thread,
                        int level,
                        uint reason,
                        string logSwitchName,
                        string parentName)
 {
     HandleEvent(ManagedCallbackType.OnLogSwitch,
                       new CorLogSwitchEventArgs( appDomain == null ? null : new CorAppDomain(appDomain),
                                                  thread == null ? null : new CorThread(thread),
                                                  level, (int)reason, logSwitchName, parentName,
                                                  ManagedCallbackType.OnLogSwitch));
 }
Exemple #52
0
        public void EvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval corEval)
        {
            EnterCallback(PausedReason.EvalComplete, "EvalComplete", pThread);

            HandleEvalComplete(pAppDomain, pThread, corEval, false);
        }
Exemple #53
0
 void ICorDebugManagedCallback.EditAndContinueRemap(
                                  ICorDebugAppDomain appDomain,
                                  ICorDebugThread thread,
                                  ICorDebugFunction managedFunction,
                                  int isAccurate)
 {
     Debug.Assert(false); //OBSOLETE callback
 }
Exemple #54
0
        public void FunctionRemapComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pFunction)
        {
            EnterCallback(PausedReason.Other, "FunctionRemapComplete", pThread);

            ExitCallback();
        }
Exemple #55
0
 void ICorDebugManagedCallback2.FunctionRemapOpportunity(ICorDebugAppDomain appDomain,
                                                                ICorDebugThread thread,
                                                                ICorDebugFunction oldFunction,
                                                                ICorDebugFunction newFunction,
                                                                uint oldILoffset)
 {
     HandleEvent(ManagedCallbackType.OnFunctionRemapOpportunity,
                               new CorFunctionRemapOpportunityEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                                        thread == null ? null : new CorThread(thread),
                                                                        oldFunction == null ? null : new CorFunction(oldFunction),
                                                                        newFunction == null ? null : new CorFunction(newFunction),
                                                                        (int)oldILoffset,
                                                                        ManagedCallbackType.OnFunctionRemapOpportunity));
 }
Exemple #56
0
        public void FunctionRemapOpportunity(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFunction pOldFunction, ICorDebugFunction pNewFunction, uint oldILOffset)
        {
            EnterCallback(PausedReason.Other, "FunctionRemapOpportunity", pThread);

            ExitCallback();
        }
Exemple #57
0
 void ICorDebugManagedCallback2.Exception(ICorDebugAppDomain ad, ICorDebugThread thread,
                                          ICorDebugFrame frame, uint offset,
                                          CorDebugExceptionCallbackType eventType, uint flags) 
 {
     HandleEvent(ManagedCallbackType.OnException2,
                               new CorException2EventArgs(ad == null ? null : new CorAppDomain(ad),
                                                 thread == null ? null : new CorThread(thread),
                                                 frame == null ? null : new CorFrame(frame),
                                                 (int)offset,
                                                 eventType,
                                                 (int)flags,
                                                 ManagedCallbackType.OnException2));
 }
Exemple #58
0
 void EnterCallback(PausedReason pausedReason, string name, ICorDebugThread pThread)
 {
     EnterCallback(pausedReason, name, pThread.GetProcess());
     process.SelectedThread = process.GetThread(pThread);
 }
Exemple #59
0
        void ICorDebugManagedCallback2.MDANotification(ICorDebugController pController,
                                                       ICorDebugThread thread,
                                                       ICorDebugMDA pMDA)
        {
            CorMDA c = new CorMDA(pMDA);
            string szName = c.Name;
            CorDebugMDAFlags f = c.Flags;
            CorProcess p = GetProcessFromController(pController);


            HandleEvent(ManagedCallbackType.OnMDANotification,
                                      new CorMDAEventArgs(c,
                                                           thread == null ? null : new CorThread(thread),
                                                           p, ManagedCallbackType.OnMDANotification));
        }
Exemple #60
0
            void ICorDebugManagedCallback.StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }