// returns true if the CustomPostCallback requested stop. private bool HandleCustomPostCallback(ManagedCallbackType callbackType, CorEventArgs callbackArgs) { bool stopRequested = false; bool needAsyncStopCall = false; if (!needAsyncStopCall) { Threads.RefreshStack(); } using (var psc = new MDbgProcessStopController(this, callbackArgs, needAsyncStopCall)) { if (PostDebugEvent != null) { PostDebugEvent(this, new CustomPostCallbackEventArgs(psc, callbackType, callbackArgs)); stopRequested = psc.CustomStopRequested; } } // end using return stopRequested; }
public MDbgProcessStopController(MDbgProcess process, CorEventArgs eventArgs, bool needAsyncStopCall) { Debug.Assert(process != null); Debug.Assert(eventArgs != null); this.process = process; this.eventArgs = eventArgs; this.needAsyncStopCall = needAsyncStopCall; }
private bool InternalHandleRawMode(ManagedCallbackType callbackType, CorEventArgs callbackArgs) { lock (this) { switch (RawModeType) { case RawMode.None: return false; case RawMode.AlwaysStop: callbackArgs.Continue = false; m_stopReason = new RawModeStopReason(callbackType, callbackArgs); ++m_stopCount; Debug.Assert(m_stopCount == 1, "StopCount=" + m_stopCount); // we should be stopped just by this event m_stopCounter = g_stopCounter++; m_stopEvent.Set(); return true; case RawMode.NeverStop: return true; default: Debug.Assert(false); return false; } } }