private void AsyncStep(bool stepIn) { if (this.MethodInfo.DebugModule.HasSymbols == false) { throw new DebuggerException("Unable to step. No symbols loaded."); } SourcecodeSegment nextSt = NextStatement; if (nextSt == null) { throw new DebuggerException("Unable to step. Next statement not aviable"); } if (stepIn) { Stepper stepInStepper = Stepper.StepIn(this, nextSt.StepRanges, "normal"); this.Thread.CurrentStepIn = stepInStepper; Stepper clearCurrentStepIn = Stepper.StepOut(this, "clear current step in"); clearCurrentStepIn.StepComplete += delegate { if (this.Thread.CurrentStepIn == stepInStepper) { this.Thread.CurrentStepIn = null; } }; clearCurrentStepIn.Ignore = true; } else { Stepper.StepOver(this, nextSt.StepRanges, "normal"); } AsyncContinue(); }
public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason) { EnterCallback(PausedReason.StepComplete, "StepComplete (" + reason.ToString() + ")", pThread); Thread thread = process.Threads[pThread]; Stepper stepper = process.GetStepper(pStepper); StackFrame currentStackFrame = process.SelectedThread.MostRecentStackFrame; process.TraceMessage(" - stopped at {0} because of {1}", currentStackFrame.MethodInfo.FullName, stepper.ToString()); process.Steppers.Remove(stepper); stepper.OnStepComplete(reason); if (stepper.Ignore) { // The stepper is ignored process.TraceMessage(" - ignored"); } else if (thread.CurrentStepIn != null && thread.CurrentStepIn.StackFrame.Equals(currentStackFrame) && thread.CurrentStepIn.IsInStepRanges((int)currentStackFrame.IP)) { Stepper.StepIn(currentStackFrame, thread.CurrentStepIn.StepRanges, "finishing step in"); process.TraceMessage(" - finishing step in"); } else if (currentStackFrame.MethodInfo.StepOver) { if (process.Options.EnableJustMyCode) { currentStackFrame.MethodInfo.MarkAsNonUserCode(); process.TraceMessage(" - method {0} marked as non user code", currentStackFrame.MethodInfo.FullName); Stepper.StepIn(currentStackFrame, new int[] { 0, int.MaxValue }, "seeking user code"); process.TraceMessage(" - seeking user code"); } else { Stepper.StepOut(currentStackFrame, "stepping out of non-user code"); process.TraceMessage(" - stepping out of non-user code"); } } else { // User-code method pauseOnNextExit = true; process.TraceMessage(" - pausing in user code"); } ExitCallback(); }