Exemple #1
0
        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("StepComplete (" + reason.ToString() + ")", pThread);

            Thread  thread  = process.GetThread(pThread);
            Stepper stepper = process.GetStepper(pStepper);

            StackFrame currentStackFrame = thread.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.IsNonUserCode)
            {
                if (process.Options.EnableJustMyCode)
                {
                    currentStackFrame.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;
                GetPausedEventArgs().Break = true;
                process.TraceMessage(" - pausing in user code");
            }

            ExitCallback();
        }
        void AsyncStep(bool stepIn)
        {
            List <ILRange> stepRanges   = new List <ILRange>();
            var            symbolSource = this.Process.GetSymbolSource(this.MethodInfo);
            var            seq          = symbolSource.GetSequencePoint(this.MethodInfo, this.IP);

            if (seq != null)
            {
                Process.TraceMessage("Step over: {0} IL:{1}", seq, string.Join(" ", seq.ILRanges));
                stepRanges.AddRange(seq.ILRanges);
                stepRanges.AddRange(symbolSource.GetIgnoredILRanges(this.MethodInfo));
            }

            // Remove overlapping and connected ranges
            List <int> fromToList = new List <int>();

            foreach (var range in stepRanges.OrderBy(r => r.From))
            {
                if (fromToList.Count > 0 && range.From <= fromToList[fromToList.Count - 1])
                {
                    fromToList[fromToList.Count - 1] = Math.Max(range.To, fromToList[fromToList.Count - 1]);
                }
                else
                {
                    fromToList.Add(range.From);
                    fromToList.Add(range.To);
                }
            }

            if (stepIn)
            {
                Stepper stepInStepper = Stepper.StepIn(this, fromToList.ToArray(), "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, fromToList.ToArray(), "normal");
            }

            this.Process.AsyncContinue(DebuggeeStateAction.Clear);
        }
Exemple #4
0
        void AsyncStep(bool stepIn)
        {
            if (stepIn)
            {
                Stepper stepInStepper = Stepper.StepIn(this, ILRanges, "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, ILRanges, "normal");
            }

            AsyncContinue();
        }
        void AsyncStep(bool stepIn)
        {
            int[] stepRanges;
            if (ILRanges == null)
            {
                SourcecodeSegment nextSt = NextStatement;
                if (nextSt == null)
                {
                    throw new DebuggerException("Unable to step. Next statement not aviable");
                }
                stepRanges = nextSt.StepRanges;
            }
            else
            {
                stepRanges = ILRanges;
            }

            if (stepIn)
            {
                Stepper stepInStepper = Stepper.StepIn(this, 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, stepRanges, "normal");
            }

            AsyncContinue();
        }