Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        internal Function(Thread thread, FrameID frameID, ICorDebugILFrame corILFrame)
        {
            this.process    = thread.Process;
            this.thread     = thread;
            this.frameID    = frameID;
            this.CorILFrame = corILFrame;
            corFunction     = corILFrame.Function;
            module          = process.GetModule(corFunction.Module);

            methodProps = module.MetaData.GetMethodProps(corFunction.Token);

            // Force some callback when function steps out so that we can expire it
            stepOutStepper = new Stepper(this, "Function Tracker");
            stepOutStepper.StepOut();
            stepOutStepper.PauseWhenComplete = false;

            process.TraceMessage("Function " + this.ToString() + " created");
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
        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();
        }
        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();
        }
Ejemplo n.º 8
0
        /// <summary> Step out of the stack frame </summary>
        public void AsyncStepOut()
        {
            Stepper.StepOut(this, "normal");

            AsyncContinue();
        }
Ejemplo n.º 9
0
        /// <summary> Step out of the stack frame </summary>
        public void AsyncStepOut()
        {
            Stepper.StepOut(this, "normal");

            process.AsyncContinue(DebuggeeStateAction.Clear);
        }
Ejemplo n.º 10
0
		internal Function(Thread thread, FrameID frameID, ICorDebugILFrame corILFrame)
		{
			this.process = thread.Process;
			this.thread = thread;
			this.frameID = frameID;
			this.CorILFrame = corILFrame;
			corFunction = corILFrame.Function;
			module = process.GetModule(corFunction.Module);
			
			methodProps = module.MetaData.GetMethodProps(corFunction.Token);
			
			// Force some callback when function steps out so that we can expire it
			stepOutStepper = new Stepper(this, "Function Tracker");
			stepOutStepper.StepOut();
			stepOutStepper.PauseWhenComplete = false;
			
			process.TraceMessage("Function " + this.ToString() + " created");
		}
		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();
		}