예제 #1
0
        void TerminateDebugger()
        {
            lock (terminateLock) {
                if (terminated)
                {
                    return;
                }

                terminated = true;

                ThreadPool.QueueUserWorkItem(delegate
                {
                    if (process != null)
                    {
                        // Process already running. Stop it. In the ProcessExited event the
                        // debugger engine will be terminated
                        process.Stop(4000);
                        process.Terminate(1);
                    }
                });
            }
        }
예제 #2
0
 /// <summary>
 /// Detach current process from debugger
 /// change signaled on attachedCompletedProcessEvent
 /// </summary>
 private void Detach()
 {
     try
     {
         try
         {
             debuggeeProcess.Stop(int.MaxValue);
         }
         catch (COMException ex)
         {
             Debug.WriteLine(ex.ToString());
         }
         debuggeeProcess.Detach();
         isAttached = false;
         attachedCompletedProcessEvent.Reset();                //not attached anymore
     }
     catch (COMException ex)
     {
         Debug.WriteLine(ex.ToString());
     }
 }