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"); } }
void BeforeGetValue(string name) { NamedValue localVar; try { localVar = process.LocalVariables[name]; } catch (DebuggerException) { return; } PrintLine("Getting local variable " + name); // First, get out of GC unsafe point Stepper stepOut = new Stepper(process.SelectedThread.LastFunction, "Boo interperter"); stepOut.StepComplete += delegate { process.Debugger.MTA2STA.AsyncCall(delegate { if (!interpreter_localVariable.SetValue(localVar)) { PrintLine("Getting of local variable " + name + " failed"); } process.Continue(); }); }; stepOut.StepOut(); }
/// <summary> Step out of the function </summary> public void StepOut() { new Stepper(this, "Function step out").StepOut(); process.Continue(); }