private void EnterCallback(PausedReason pausedReason, string name, ICorDebugProcess pProcess) { isInCallback = true; process.TraceMessage("Callback: " + name); System.Diagnostics.Debug.Assert(process.CorProcess == pProcess); // After break is pressed we may receive some messages that were already queued if (process.IsPaused && process.PauseSession.PausedReason == PausedReason.ForcedBreak) { // TODO: This does not work well if exception if being processed and the user continues it process.TraceMessage("Processing post-break callback"); // This compensates for the break call and we are in normal callback handling mode process.AsyncContinue(DebuggeeStateAction.Keep, new Thread[] { }, null); // Start of call back - create new pause session (as usual) process.NotifyPaused(pausedReason); // Make sure we stay pause after the callback is handled pauseOnNextExit = true; return; } if (process.IsRunning) { process.NotifyPaused(pausedReason); return; } throw new DebuggerException("Invalid state at the start of callback"); }
private SourcecodeSegment SetIP(bool simulate, string filename, int line, int column) { process.AssertPaused(); SourcecodeSegment segment = SourcecodeSegment.Resolve(this.MethodInfo.DebugModule, filename, null, line, column); if (segment != null && segment.CorFunction.GetToken() == this.MethodInfo.MetadataToken) { try { if (simulate) { CorILFrame.CanSetIP((uint)segment.ILStart); } else { // Invalidates all frames and chains for the current thread CorILFrame.SetIP((uint)segment.ILStart); process.NotifyResumed(DebuggeeStateAction.Keep); process.NotifyPaused(PausedReason.SetIP); process.RaisePausedEvents(); } } catch { return(null); } return(segment); } return(null); }