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); }
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"); }
void EnterCallback(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.TraceMessage("Processing post-break callback"); // Decrese the "break count" from 2 to 1 - does not actually continue // TODO: This inccorectly marks the debugger as running process.AsyncContinue(DebuggeeStateAction.Keep); // Make sure we stay paused after the callback is handled pauseOnNextExit = true; return; } if (process.IsRunning) { process.NotifyPaused(); return; } throw new DebuggerException("Invalid state at the start of callback"); }
SourcecodeSegment SetIP(bool simulate, string filename, int line, int column) { process.AssertPaused(); SourcecodeSegment suggestion = new SourcecodeSegment(filename, line, column, column); ICorDebugFunction corFunction; int ilOffset; if (!suggestion.GetFunctionAndOffset(this.Module, false, out corFunction, out ilOffset)) { return(null); } else { if (corFunction.Token != methodProps.Token) { return(null); } else { try { if (simulate) { CorILFrame.CanSetIP((uint)ilOffset); } else { // invalidates all frames and chains for the current thread CorILFrame.SetIP((uint)ilOffset); process.NotifyPaused(new PauseSession(PausedReason.SetIP)); process.Pause(false); } } catch { return(null); } return(GetSegmentForOffet((uint)ilOffset)); } } }
void EnterCallback(PausedReason pausedReason, string name, ICorDebugProcess pProcess) { process.TraceMessage("Callback: " + name); System.Diagnostics.Debug.Assert(process.CorProcess == pProcess); // Check state if (process.IsRunning || // After break is pressed we may receive some messages that were already queued process.PauseSession.PausedReason == PausedReason.ForcedBreak || // ExitProcess may be called at any time when debuggee is killed name == "ExitProcess") { if (process.IsPaused && process.PauseSession.PausedReason == PausedReason.ForcedBreak && name != "ExitProcess") { process.TraceMessage("Processing post-break callback"); // Continue the break, process is still breaked because of the callback process.Continue(); pauseProcessInsteadOfContinue = true; } else { pauseProcessInsteadOfContinue = false; } // Remove expired threads and functions foreach (Thread thread in process.Threads) { thread.CheckExpiration(); } process.NotifyPaused(new PauseSession(pausedReason)); } else { throw new DebuggerException("Invalid state at the start of callback"); } }