Exemple #1
0
        // Called by the SDM to indicate that a synchronous debug event, previously sent by the DE to the SDM,
        // was received and processed. The only event the sample engine sends in this fashion is Program Destroy.
        // It responds to that event by shutting down the engine.
        int IDebugEngine2.ContinueFromSynchronousEvent(IDebugEvent2 eventObject)
        {
            Debug.Assert(Worker.MainThreadId == Worker.CurrentThreadId);

            try
            {
                if (eventObject is AD7ProgramDestroyEvent)
                {
                    WorkerThread    pollThread      = m_pollThread;
                    DebuggedProcess debuggedProcess = m_debuggedProcess;

                    m_engineCallback  = null;
                    m_debuggedProcess = null;
                    m_pollThread      = null;
                    m_ad7ProgramId    = Guid.Empty;

                    debuggedProcess.Close();
                    pollThread.Close();
                }
                else
                {
                    Debug.Fail("Unknown syncronious event");
                }
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }

            return(Constants.S_OK);
        }