コード例 #1
0
ファイル: Process.cs プロジェクト: paytonli2013/SharpDevelop
        /// <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();
            }
        }
コード例 #2
0
ファイル: Process.cs プロジェクト: kleinux/SharpDevelop
		/// <summary> Puts the process into a resumed state </summary>
		internal void NotifyResumed(DebuggeeStateAction action)
		{
			AssertPaused();
			pauseSession = null;
			if (action == DebuggeeStateAction.Clear) {
				if (debuggeeState == null) throw new DebuggerException("Debugee state already cleared");
				debuggeeState = null;
				this.ExpressionsCache.Clear();
			}
		}
コード例 #3
0
ファイル: Process.cs プロジェクト: windcatcher/SharpDevelop
 /// <summary> Puts the process into a resumed state </summary>
 internal void NotifyResumed(DebuggeeStateAction action)
 {
     AssertPaused();
     pauseSession = 0;
     if (action == DebuggeeStateAction.Clear)
     {
         if (debuggeeState == 0)
         {
             throw new DebuggerException("Debugee state already cleared");
         }
         debuggeeState = 0;
     }
 }
コード例 #4
0
ファイル: Process.cs プロジェクト: wmade/SoftwareZator-2012
        /// <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();
            }
        }
コード例 #5
0
        internal void AsyncContinue(DebuggeeStateAction action)
        {
            AssertPaused();

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

            if (action == DebuggeeStateAction.Clear)
            {
                OnResumed();
            }
        }
コード例 #6
0
ファイル: Process.cs プロジェクト: windcatcher/SharpDevelop
        /// <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();
            }
        }
コード例 #7
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();
			}
		}
コード例 #8
0
		/// <summary> Puts the process into a resumed state </summary>
		internal void NotifyResumed(DebuggeeStateAction action)
		{
			AssertPaused();
			pauseSession = null;
			if (action == DebuggeeStateAction.Clear) {
				if (debuggeeState == null) throw new DebuggerException("Debugee state already cleared");
				debuggeeState = null;
				this.ExpressionsCache.Clear();
			}
		}
コード例 #9
0
ファイル: Process.cs プロジェクト: asiazhang/SharpDevelop
		/// <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();
			}
		}
コード例 #10
0
ファイル: Process.cs プロジェクト: asiazhang/SharpDevelop
		/// <summary> Puts the process into a resumed state </summary>
		internal void NotifyResumed(DebuggeeStateAction action)
		{
			AssertPaused();
			pauseSession = 0;
			if (action == DebuggeeStateAction.Clear) {
				if (debuggeeState == 0) throw new DebuggerException("Debugee state already cleared");
				debuggeeState = 0;
			}
		}
コード例 #11
0
ファイル: Process.cs プロジェクト: hefnerliu/SharpDevelop
		/// <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();
			}
		}
コード例 #12
0
		internal void AsyncContinue(DebuggeeStateAction action)
		{
			AssertPaused();
			
			NotifyResumed(action);
			corProcess.Continue(0);
			if (this.Options.Verbose) {
				this.TraceMessage("Continue");
			}
			
			if (action == DebuggeeStateAction.Clear) {
				OnResumed();
			}
		}