public MDANotificationDebugCallbackEventArgs(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
     : base(pController)
 {
     Controller = pController;
     Thread     = pThread;
     MDA        = pMDA;
 }
 private DebuggeeProcess GetProcessWrapper(ICorDebugController controller)
 {
     if (controller is ICorDebugAppDomain)
         return GetProcessWrapper(controller as ICorDebugAppDomain);
     else if (controller is ICorDebugProcess)
         return GetProcessWrapper(controller as ICorDebugProcess);
     return null;
 }
 internal IDebuggerController GetController(ICorDebugController controller)
 {
     if (controller is ICorDebugAppDomain)
     {
         return(GetAppDomain(controller as ICorDebugAppDomain));
     }
     return(this);
 }
        public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(c);

            if (managedCallback != null)
            {
                managedCallback.MDANotification(c, t, mda);
            }
        }
		public ManagedCallback GetProcessCallbackInterface(string name, ICorDebugController c)
		{
			if (c is ICorDebugAppDomain) {
				return GetProcessCallbackInterface(name, (ICorDebugAppDomain)c);
			} else if (c is ICorDebugProcess){
				return GetProcessCallbackInterface(name, (ICorDebugProcess)c);
			} else {
				throw new System.Exception("Unknown callback argument");
			}
		}
		public ManagedCallback GetProcessCallbackInterface(string name, ICorDebugController c)
		{
			if (c.Is<ICorDebugAppDomain>()) {
				return GetProcessCallbackInterface(name, c.CastTo<ICorDebugAppDomain>());
			} else if (c.Is<ICorDebugProcess>()){
				return GetProcessCallbackInterface(name, c.CastTo<ICorDebugProcess>());
			} else {
				throw new System.Exception("Unknown callback argument");
			}
		}
        private void HandleEvent(ICorDebugController controller, bool finalize = true)
        {
            var process = GetProcessWrapper(controller);
            var eventArgs = new DebuggerEventArgs(process.GetController(controller), true);

            process.DispatchEvent(eventArgs);

            if (finalize)
                FinalizeEvent(eventArgs);
        }
 void ICorDebugManagedCallback2.MDANotification(
     ICorDebugController pController,
     ICorDebugThread thread,
     ICorDebugMDA pMDA)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: MDANotification2");
     }
     pController.Continue(0);
 }
 private DebuggeeProcess GetProcessWrapper(ICorDebugController controller)
 {
     if (controller is ICorDebugAppDomain)
     {
         return(GetProcessWrapper(controller as ICorDebugAppDomain));
     }
     else if (controller is ICorDebugProcess)
     {
         return(GetProcessWrapper(controller as ICorDebugProcess));
     }
     return(null);
 }
        private void HandleEvent(ICorDebugController controller, bool finalize = true)
        {
            var process   = GetProcessWrapper(controller);
            var eventArgs = new DebuggerEventArgs(process.GetController(controller), true);

            process.DispatchEvent(eventArgs);

            if (finalize)
            {
                FinalizeEvent(eventArgs);
            }
        }
 public ManagedCallback GetProcessCallbackInterface(ICorDebugController c)
 {
     if (c.Is <ICorDebugAppDomain>())
     {
         return(GetProcessCallbackInterface(c.CastTo <ICorDebugAppDomain>()));
     }
     else if (c.Is <ICorDebugProcess>())
     {
         return(GetProcessCallbackInterface(c.CastTo <ICorDebugProcess>()));
     }
     else
     {
         throw new System.Exception("Unknown callback argument");
     }
 }
Example #12
0
 public ManagedCallback GetProcessCallbackInterface(string name, ICorDebugController c)
 {
     if (c is ICorDebugAppDomain)
     {
         return(GetProcessCallbackInterface(name, (ICorDebugAppDomain)c));
     }
     else if (c is ICorDebugProcess)
     {
         return(GetProcessCallbackInterface(name, (ICorDebugProcess)c));
     }
     else
     {
         throw new System.Exception("Unknown callback argument");
     }
 }
Example #13
0
        /// <exception cref="Exception">Unknown callback argument</exception>
        public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
        {
            if (c is ICorDebugAppDomain)
            {
                EnterCallback(PausedReason.Other, "MDANotification", (ICorDebugAppDomain)c);
            }
            else if (c is ICorDebugProcess)
            {
                EnterCallback(PausedReason.Other, "MDANotification", (ICorDebugProcess)c);
            }
            else
            {
                throw new System.Exception("Unknown callback argument");
            }

            ExitCallback();
        }
Example #14
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();
        }
Example #15
0
            public void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
            {
                try
                {
                    _EnterCallback();

                    lock (dbgproc)
                    {
                        string desc;
                        {
                            uint len = 0;
                            pMDA.GetDescription(len, out len, IntPtr.Zero);
                            IntPtr pdesc = Marshal.AllocHGlobal((int)len * 2);
                            pMDA.GetDescription(len, out len, pdesc);
                            desc = Marshal.PtrToStringUni(pdesc, (int)len);
                            if (desc.EndsWith("\0"))
                            {
                                desc = desc.Substring(0, desc.Length - 1);
                            }
                            Marshal.FreeHGlobal(pdesc);
                        }
                        dbgproc.dout.WriteLine("MDA notification: {0}", desc);
                    }

                    _CallbackEvent("MDANotification", true);
                }
                catch (Exception e)
                {
                    _CallbackException(e);
                }
            }
 public virtual void MDANotification(ICorDebugController controller, ICorDebugThread thread, ICorDebugMDA mda)
 {
     this.DefaultHandler(controller);
 }
Example #17
0
 public void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     pController.Continue(0);
 }
 int ICorDebugAppDomain.SetAllThreadsDebugState(CorDebugThreadState state, ICorDebugThread pExceptThisThread)
 {
     return(ICorDebugController.SetAllThreadsDebugState(state, pExceptThisThread));
 }
 //This need to be called in Process Creaded notification
 public static void SetStateObj(ICorDebugController value)
 {
     if (stateObj != null) { throw new Exception("Already initialized"); }
     stateObj = new ControllerStateObject(value);
 }
 int ICorDebugAppDomain.HasQueuedCallbacks(ICorDebugThread pThread, out int pbQueued)
 {
     return(ICorDebugController.HasQueuedCallbacks(pThread, out pbQueued));
 }
 int ICorDebugAppDomain.Continue(int fIsOutOfBand)
 {
     return(ICorDebugController.Continue(fIsOutOfBand));
 }
 public void CreateProcess(ICorDebugProcess pProcess)
 {
     controller = pProcess;
     controller.Continue(0);
 }
Example #23
0
		bool Continue(ICorDebugController controller) {
			Debug.Assert(controller != null);
			if (controller == null)
				return false;

			int hr = controller.Continue(0);
			continueCounter++;
			bool success = hr >= 0 || hr == CordbgErrors.CORDBG_E_PROCESS_TERMINATED || hr == CordbgErrors.CORDBG_E_OBJECT_NEUTERED;
			Debug.WriteLineIf(!success, string.Format("dndbg: ICorDebugController::Continue() failed: 0x{0:X8}", hr));
			return success;
		}
 int ICorDebugAppDomain.CommitChanges(uint cSnapshots, ref ICorDebugEditAndContinueSnapshot pSnapshots, out ICorDebugErrorInfoEnum pError)
 {
     return(ICorDebugController.CommitChanges(cSnapshots, ref pSnapshots, out pError));
 }
 int ICorDebugAppDomain.Terminate(uint exitCode)
 {
     return(ICorDebugController.Terminate(exitCode));
 }
 int ICorDebugAppDomain.Detach()
 {
     return(ICorDebugController.Detach());
 }
		/// <exception cref="Exception">Unknown callback argument</exception>
		public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
		{
			if (c is ICorDebugAppDomain) {
				EnterCallback("MDANotification", (ICorDebugAppDomain)c);
			} else if (c is ICorDebugProcess){
				EnterCallback("MDANotification", (ICorDebugProcess)c);
			} else {
				throw new System.Exception("Unknown callback argument");
			}
			
			ExitCallback();
		}
 internal IDebuggerController GetController(ICorDebugController controller)
 {
     if (controller is ICorDebugAppDomain)
         return GetAppDomain(controller as ICorDebugAppDomain);
     return this;
 }
Example #29
0
 // Get process from controller 
 static private CorProcess GetProcessFromController(ICorDebugController pController)
 {
     CorProcess p;
     ICorDebugProcess p2 = pController as ICorDebugProcess;
     if (p2 != null)
     {
         p = CorProcess.GetCorProcess(p2);
     }
     else
     {
         ICorDebugAppDomain a2 = (ICorDebugAppDomain)pController;
         p = new CorAppDomain(a2).Process;
     }
     return p;
 }
 int ICorDebugAppDomain.IsRunning(out int pbRunning)
 {
     return(ICorDebugController.IsRunning(out pbRunning));
 }
Example #31
0
 internal CorController(ICorDebugController controller)
     : base(controller)
 {
     m_controller = controller;
 }
Example #32
0
 public void MDANotification([In, MarshalAs(UnmanagedType.Interface)] ICorDebugController pController, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugMDA pMDA)
 {
     throw new NotImplementedException();
 }
Example #33
0
 /// <summary>
 /// Creates an instance of the controller.
 /// </summary>
 /// <param name="cocntrl">ICorDebugController instance</param>
 internal CorController(ICorDebugController cocntrl, CorDebuggerOptions options)
     : base(cocntrl, options)
 {
     this.cocntrl = cocntrl;
 }
Example #34
0
		protected DebugCallbackEventArgs(ICorDebugController ctrl) {
			this.ctrl = ctrl;
		}
Example #35
0
 public void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     throw new NotImplementedException();
 }
 int ICorDebugAppDomain.EnumerateThreads(out ICorDebugThreadEnum ppThreads)
 {
     return(ICorDebugController.EnumerateThreads(out ppThreads));
 }
Example #37
0
 public void HandleEvent(ICorDebugController controller)
 {
     Console.WriteLine("event received");
     controller.Continue(0);
 }
 public void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     HandleEvent(pController);
 }
		public void MDANotification(ICorDebugController c, ICorDebugThread t, ICorDebugMDA mda)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface("MDANotification", c);
			if (managedCallback != null) {
				managedCallback.MDANotification(c, t, mda);
			}
		}
Example #40
0
 public virtual void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     pController.Continue(0);
 }
Example #41
0
		public MDANotificationDebugCallbackEventArgs(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
			: base(pController) {
			this.Controller = pController;
			this.Thread = pThread;
			this.MDA = pMDA;
		}
Example #42
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();
		}
Example #43
0
 internal Controller(ICorDebugController controller)
 {
     m_controller = controller;
 }
 public void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     Console.WriteLine("MDANotification");
     pController.Continue(0);
 }
 protected virtual void DefaultHandler(ICorDebugController controller)
 {
     controller.Continue(false);
 }
 public void MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     HandleEvent(pController);
 }
Example #47
0
 void ICorDebugManagedCallback2.MDANotification(ICorDebugController pController, ICorDebugThread pThread, ICorDebugMDA pMDA)
 {
     // TODO nothing for now
 }
Example #48
0
 protected DebugCallbackEventArgs(ICorDebugController ctrl)
 {
     CorDebugController = ctrl;
 }
Example #49
0
        // This method must be called just before returning to the caller. No fields can be accessed
        // and no methods can be called because the CLR debugger could call us before this method
        // returns.
        bool Continue(ICorDebugController controller, bool callOnProcessStateChanged)
        {
            Debug.Assert(controller != null);
            if (controller == null)
                return false;

            if (callOnProcessStateChanged && managedCallbackCounter == 1) {
                try {
                    continuing = true;
                    CallOnProcessStateChanged();
                }
                finally {
                    continuing = false;
                }
            }
            managedCallbackCounter--;
            continueCounter++;

            if (callOnProcessStateChanged && managedCallbackCounter == 0)
                CallOnProcessStateChanged();

            // As soon as we call Continue(), the CLR debugger could send us another message so it's
            // important that we don't access any of our fields and don't call any methods after
            // Continue() has been called!
            int hr = controller.Continue(0);
            bool success = hr >= 0 || hr == CordbgErrors.CORDBG_E_PROCESS_TERMINATED || hr == CordbgErrors.CORDBG_E_OBJECT_NEUTERED;
            Debug.WriteLineIf(!success, string.Format("dndbg: ICorDebugController::Continue() failed: 0x{0:X8}", hr));
            return success;
        }
 internal ControllerStateObject(ICorDebugController contoller)
 {
     m_Controller = contoller;
 }
Example #51
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));
        }
 int ICorDebugAppDomain.Stop(uint dwTimeout)
 {
     return(ICorDebugController.Stop(dwTimeout));
 }