// Close the connection with the debugger. // // We detach from any currently connected processes, as we don't want // them to quit after we're gone. public void Close() { if (m_debugger != null) { // Disconnect from each connected process. foreach (int pid in m_pids) { try { Trace.WriteLine("attempting to detach from: " + pid); DebuggedProcess proc = m_debugger.GetProcess(pid); proc.Stop(5000); proc.Detach(); } catch (System.Exception e) { Trace.WriteLine("unable to detach: " + e.ToString()); } } m_pids.Clear(); // close the connection with the debugger. try { m_debugger.Terminate(); } catch (System.Exception e) { Trace.WriteLine("Unable to terminate debugger: " + e.ToString()); } m_debugger = null; } }
// Create the debugger & set up the callback for later use. private void _create_debugger() { if (m_debugger == null) { m_debugger = new CorDebugger(); m_debugger.SetManagedHandler(new ManagedCallback(this)); } }
// Initialize the object, creating the debugger and setting up the // callback object for later use. public ManagedEvents() { m_debugger = null; _create_debugger(); }