Ejemplo n.º 1
0
        /// <param name="threadToRun"> Run this thread and freeze all other threads </param>
        internal void AsyncContinue(DebuggeeStateAction action, Thread threadToRun = null)
        {
            AssertPaused();

            try {
                if (threadToRun != null)
                {
                    corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_SUSPEND, null);
                    threadToRun.CorThread.SetDebugState(CorDebugThreadState.THREAD_RUN);
                }
                else
                {
                    corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_RUN, null);
                }

                NotifyResumed(action);
                corProcess.Continue(0);
                // this.TraceMessage("Continue");
            } catch (COMException ex) {
                if (ex.HResult == unchecked ((int)0x80131301))
                {
                    // Process was terminated. (Exception from HRESULT: 0x80131301)
                    // This occurs if a process is killed (e.g. console window of console application closed)
                    // while the application is doing something involving debugger callbacks (Debug.WriteLine calls, or throwing+handling exceptions).

                    // I think we can safely ignore this error.
                }
            }
            if (action == DebuggeeStateAction.Clear)
            {
                OnResumed();
            }
        }
Ejemplo n.º 2
0
 void ICorDebugManagedCallback.ControlCTrap(ICorDebugProcess process)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: ControlCTrap");
     }
     process.Continue(0);
 }
Ejemplo n.º 3
0
 void ICorDebugManagedCallback.CreateProcess(ICorDebugProcess process)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: CreateProcess");
     }
     process.Continue(0);
 }
Ejemplo n.º 4
0
        public void CreateAppDomain(ICorDebugProcess pProcess, ICorDebugAppDomain pAppDomain)
        {
            var domain = new DebugDomain(null, pAppDomain);
            Logger.WriteLine("App domain {0} created", domain.Name);

            pAppDomain.Attach();

            pProcess.Continue(0);
        }
Ejemplo n.º 5
0
 void ICorDebugManagedCallback.ExitProcess(ICorDebugProcess process)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: ExitProcess");
     }
     ProcessExited?.Invoke(this, new ProcessExitedEventArgs(process));
     process.Continue(0);
 }
Ejemplo n.º 6
0
 void ICorDebugManagedCallback2.DestroyConnection(
     ICorDebugProcess process,
     uint connectionId)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: DestroyConnection2");
     }
     process.Continue(0);
 }
Ejemplo n.º 7
0
 void ICorDebugManagedCallback.ExitAppDomain(
     ICorDebugProcess process,
     ICorDebugAppDomain appDomain)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: ExitAppDomain");
     }
     process.Continue(0);
 }
Ejemplo n.º 8
0
 void ICorDebugManagedCallback2.CreateConnection(
     ICorDebugProcess process,
     uint connectionId,
     ref ushort connectionName)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: CreateConnection2");
     }
     process.Continue(0);
 }
Ejemplo n.º 9
0
 void ICorDebugManagedCallback.DebuggerError(
     ICorDebugProcess process,
     int errorHR,
     uint errorCode)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: DebuggerError");
     }
     process.Continue(0);
 }
Ejemplo n.º 10
0
        /// <param name="threadsToRun"> Null to keep current setting </param>
        /// <param name="newThreadState"> What happens to created threads.  Null to keep current setting </param>
        internal void AsyncContinue(DebuggeeStateAction action, Thread[] threadsToRun, CorDebugThreadState?newThreadState)
        {
            AssertPaused();

            if (threadsToRun != null)
            {
                //				corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_SUSPEND, null);
                //				Note: There is unreported thread, stopping it prevents the debugee from exiting
                //				      It is not corProcess.GetHelperThreadID
                //				ICorDebugThread[] ts = new ICorDebugThread[corProcess.EnumerateThreads().GetCount()];
                //				corProcess.EnumerateThreads().Next((uint)ts.Length, ts);
                foreach (Thread t in this.Threads)
                {
                    CorDebugThreadState state = Array.IndexOf(threadsToRun, t) == -1 ? CorDebugThreadState.THREAD_SUSPEND : CorDebugThreadState.THREAD_RUN;
                    try
                    {
                        t.CorThread.SetDebugState(state);
                    }
                    catch (COMException e)
                    {
                        // The state of the thread is invalid. (Exception from HRESULT: 0x8013132D)
                        // It can happen for example when thread has not started yet
                        if ((uint)e.ErrorCode == 0x8013132D)
                        {
                            // TraceMessage("Can not suspend thread - The state of the thread is invalid.  Thread ID = " + t.CorThread.GetID());
                        }
                        else
                        {
                            throw;
                        }
                    }
                }
            }

            if (newThreadState != null)
            {
                this.NewThreadState = newThreadState.Value;
            }

            NotifyResumed(action);
            corProcess.Continue(0);
            if (this.Options.Verbose)
            {
                this.TraceMessage("Continue");
            }

            if (action == DebuggeeStateAction.Clear)
            {
                OnResumed();
            }
        }
Ejemplo n.º 11
0
        public void Continue()
        {
            try
            {
                AssertPaused();


                pauseSession.NotifyHasExpired();
                pauseSession = null;
                OnDebuggingResumed();

                corProcess.Continue(0);
            }
            catch (System.Exception e)
            {
            }
        }
Ejemplo n.º 12
0
        /// <param name="threadToRun"> Run this thread and freeze all other threads </param>
        internal void AsyncContinue(DebuggeeStateAction action, Thread threadToRun = null)
        {
            AssertPaused();

            if (threadToRun != null)
            {
                corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_SUSPEND, null);
                threadToRun.CorThread.SetDebugState(CorDebugThreadState.THREAD_RUN);
            }
            else
            {
                corProcess.SetAllThreadsDebugState(CorDebugThreadState.THREAD_RUN, null);
            }

            NotifyResumed(action);
            corProcess.Continue(0);
            // this.TraceMessage("Continue");

            if (action == DebuggeeStateAction.Clear)
            {
                OnResumed();
            }
        }
Ejemplo n.º 13
0
 public void ChangeConnection(ICorDebugProcess pProcess, uint dwConnectionId)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 14
0
 public void ExitProcess(ICorDebugProcess pProcess)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 15
0
 public void ExitAppDomain(ICorDebugProcess pProcess, ICorDebugAppDomain pAppDomain)
 {
     var domain = new DebugDomain(null, pAppDomain);
     Logger.WriteLine("App domain {0} exited", domain.Name);
     var handler = OnDomainExited;
     if (handler != null) handler(this, new DebuggerDomainExitedEventArgs(pAppDomain));
     pProcess.Continue(0);
 }
Ejemplo n.º 16
0
 public void ExitProcess(ICorDebugProcess pProcess)
 {
     Console.WriteLine("ExitProcess");
     pProcess.Continue(0);
 }
Ejemplo n.º 17
0
 public void DebuggerError(ICorDebugProcess pProcess, int errorHR, uint errorCode)
 {
     Logger.WriteLine("Debugger Error. errorHR: {0}; erroCode: ", errorHR, errorCode);
     pProcess.Continue(0);
 }
Ejemplo n.º 18
0
 public void CreateConnection(ICorDebugProcess pProcess, uint dwConnectionId, ref ushort pConnName)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 19
0
 public virtual void DestroyConnection(ICorDebugProcess pProcess, uint dwConnectionId)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 20
0
 public void DestroyConnection(ICorDebugProcess pProcess, uint dwConnectionId)
 {
     Console.WriteLine("DestroyConnection");
     pProcess.Continue(0);
 }
Ejemplo n.º 21
0
 public virtual void ControlCTrap(ICorDebugProcess pProcess)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 22
0
 public virtual void DebuggerError(ICorDebugProcess pProcess, int errorHR, uint errorCode)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 23
0
 public virtual void ExitProcess(ICorDebugProcess pProcess)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 24
0
 public virtual void DebuggerError(ICorDebugProcess pProcess, int errorHR, uint errorCode) { pProcess.Continue(0); }
Ejemplo n.º 25
0
 public void DebuggerError(ICorDebugProcess pProcess, int errorHR, uint errorCode)
 {
     Console.WriteLine("DebuggerError");
     pProcess.Continue(0);
 }
Ejemplo n.º 26
0
 public void ControlCTrap(ICorDebugProcess pProcess)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 27
0
 public void ControlCTrap(ICorDebugProcess pProcess)
 {
     Console.WriteLine("ControlCTrap");
     pProcess.Continue(0);
 }
Ejemplo n.º 28
0
 public virtual void CreateProcess(ICorDebugProcess pProcess)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 29
0
 public void CreateProcess(ICorDebugProcess pProcess)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 30
0
 public void CreateConnection(ICorDebugProcess pProcess, uint dwConnectionId, ref ushort pConnName)
 {
     Console.WriteLine("CreateConnection");
     pProcess.Continue(0);
 }
Ejemplo n.º 31
0
 public void DestroyConnection(ICorDebugProcess pProcess, uint dwConnectionId)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 32
0
 public void Continue()
 {
     _comProcess.Continue(0);
     OnResumed(EventArgs.Empty);
 }
Ejemplo n.º 33
0
 public virtual void CreateConnection(ICorDebugProcess pProcess, uint dwConnectionId, ref ushort pConnName)
 {
     pProcess.Continue(0);
 }
Ejemplo n.º 34
0
 public void CreateProcess(ICorDebugProcess pProcess)
 {
     Console.WriteLine("CreateProcess");
     pProcess.Continue(0);
 }