Example #1
0
        /**
         * create a stepper object relative to the active frame in this thread.
         */
        public CorStepper CreateStepper()
        {
            ICorDebugStepper s = null;

            m_th.CreateStepper(out s);
            return(new CorStepper(s));
        }
Example #2
0
 internal SourceStepper(RuntimeThread thread, ICorDebugStepper comStepper)
 {
     _thread     = thread;
     _comStepper = comStepper;
     _comStepper.SetRangeIL(1);
     _comStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
 }
        internal SourceStepper GetStepper(ICorDebugStepper pStepper)
        {
            SourceStepper stepper;

            _steppers.TryGetValue(pStepper, out stepper);
            return(stepper);
        }
 internal SourceStepper(RuntimeThread thread, ICorDebugStepper comStepper)
 {
     _thread = thread;
     _comStepper = comStepper;
     _comStepper.SetRangeIL(1);
     _comStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
 }
 public StepCompleteDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
     : base(pAppDomain)
 {
     AppDomain = pAppDomain;
     Thread    = pThread;
     Stepper   = pStepper;
     Reason    = reason;
 }
Example #6
0
 protected internal virtual void OnStepComplete(CorDebugStepReason reason)
 {
     this.corStepper = null;
     if (StepComplete != null)
     {
         StepComplete(this, new StepperEventArgs(this, reason));
     }
 }
Example #7
0
		internal Stepper GetStepper(ICorDebugStepper corStepper)
		{
			foreach(Stepper stepper in this.Steppers) {
				if (stepper.IsCorStepper(corStepper)) {
					return stepper;
				}
			}
			throw new DebuggerException("Stepper is not in collection");
		}
        int ICorDebugThread.CreateStepper(out ICorDebugStepper ppStepper)
        {
            Debug.Assert(!IsVirtualThread);
            ICorDebugFrame frame;

            ((ICorDebugThread)this).GetActiveFrame(out frame);
            ppStepper = new CorDebugStepper((CorDebugFrame)frame);

            return(Utility.COM_HResults.S_OK);
        }
Example #9
0
        public Stepper(Function function)
        {
            this.function = function;

            corStepper = function.CorILFrame.CreateStepper();

            JustMyCode = true;

            function.Thread.Steppers.Add(this);
        }
Example #10
0
        public CorStepper CreateStepper()
        {
            ICorDebugStepper istepper = null;

            try
            {
                m_frame.CreateStepper(out istepper);
            }
            catch { }
            return(istepper == null ? null : new CorStepper(istepper));
        }
Example #11
0
        //
        // IEnumerator interface
        //

        #region IEnumerator Members

        public bool MoveNext()
        {
            var a = new ICorDebugStepper[1];
            uint c = 0;
            int r = m_enum.Next((uint) a.Length, a, out c);
            if (r == 0 && c == 1) // S_OK && we got 1 new element
                m_step = new CorStepper(a[0]);
            else
                m_step = null;
            return m_step != null;
        }
 void ICorDebugManagedCallback.StepComplete(
     ICorDebugAppDomain appDomain,
     ICorDebugThread thread,
     ICorDebugStepper stepper,
     CorDebugStepReason stepReason)
 {
     if (DebugOutput)
     {
         Console.WriteLine("info: StepComplete");
     }
     appDomain.Continue(0);
 }
Example #13
0
 public void StepComplete(
     ICorDebugAppDomain appDomain,
     ICorDebugThread thread,
     ICorDebugStepper step,
     CorDebugStepReason reason)
 {
     m_delegate.OnStepComplete(
         new StepCompleteEventArgs(
             new DebuggedAppDomain(appDomain),
             new DebuggedThread(thread),
             new Stepper(step),
             reason));
 }
Example #14
0
		private Stepper(StackFrame stackFrame, StepperOperation operation, int[] stepRanges, string name, bool justMyCode)
		{
			this.stackFrame = stackFrame;
			this.operation = operation;
			this.stepRanges = stepRanges;
			this.name = name;
			
			this.corStepper = stackFrame.CorILFrame.CreateStepper();
			this.ignore = false;
			this.StackFrame.Process.Steppers.Add(this);
			
			if (justMyCode) {
				corStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
				((ICorDebugStepper2)corStepper).SetJMC(1);
			}
		}
        //
        // IEnumerator interface
        //
        public bool MoveNext()
        {
            ICorDebugStepper[] a = new ICorDebugStepper[1];
            uint c = 0;
            int  r = m_enum.Next((uint)a.Length, a, out c);

            if (r == 0 && c == 1) // S_OK && we got 1 new element
            {
                m_step = new CorStepper(a[0]);
            }
            else
            {
                m_step = null;
            }
            return(m_step != null);
        }
Example #16
0
        private Stepper(StackFrame stackFrame, StepperOperation operation, int[] stepRanges, string name, bool justMyCode)
        {
            this.stackFrame = stackFrame;
            this.operation  = operation;
            this.stepRanges = stepRanges;
            this.name       = name;

            this.corStepper = stackFrame.CorILFrame.CreateStepper();
            this.ignore     = false;
            this.StackFrame.Thread.Steppers.Add(this);

            if (justMyCode)
            {
                corStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE);
                corStepper.CastTo <ICorDebugStepper2>().SetJMC(1);
            }
        }
Example #17
0
		internal Stepper GetStepper(ICorDebugStepper corStepper)
		{
			foreach(Stepper stepper in this.Steppers) {
				if (stepper.IsCorStepper(corStepper)) {
					return stepper;
				}
			}
			throw new DebuggerException("Stepper is not in collection");
		}
Example #18
0
            public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
            {
                try
                {
                    _EnterCallback();

                    _UpdateActiveThread(pThread);

                    bool _isspecial;
                    lock (dbgproc)
                    {
                        _isspecial = _IsSourceAtSpecialPosition_unlocked();
                    }
                    if (_isspecial)
                    {
                        dbgproc._StepDirect(false, false);
                        return; // Don't fire this callback event; fire the next one.
                    }

                    lock (dbgproc)
                    {
#if DEBUG
                        if (!dbgproc.IsStepping)
                        {
                            dbgproc.dout.WriteLine("DEBUG:  StepComplete: (!dbgproc.IsStepping)");
                        }
#endif
                        dbgproc.IsStepping = false;

                        {
                            //dbgproc.dout.WriteLine("0: -");
                            dbgproc.ShowCurrentLine_unlocked();
                        }

                    }

                    _CallbackEvent("StepComplete");
                }
                catch (Exception e)
                {
                    _CallbackException(e);
                }
            }
		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
				RequestPause(thread).Break = true;
				process.TraceMessage(" - pausing in user code");
			}
			
			ExitCallback();
		}
        public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
        {
            ManagedCallback managedCallback = GetProcessCallbackInterface(pAppDomain);

            if (managedCallback != null)
            {
                managedCallback.StepComplete(pAppDomain, pThread, pStepper, reason);
            }
        }
Example #21
0
 public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
 {
     pAppDomain.Continue(0);
 }
Example #22
0
 public void StepComplete(ICorDebugAppDomain appDomain,
                          ICorDebugThread thd,
                          ICorDebugStepper stepper,
                          CorDebugStepReason reason)
 {
 }
Example #23
0
 public virtual void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
 {
     pAppDomain.Continue(0);
 }
 int ICorDebugNativeFrame.CreateStepper(out ICorDebugStepper ppStepper)
 {
     return ((ICorDebugFrame)this).CreateStepper(out ppStepper);
 }
Example #25
0
 internal CorStepper(ICorDebugStepper stepper)
     : base(stepper)
 {
     m_step = stepper;
 }
 int ICorDebugInternalFrame.CreateStepper(out ICorDebugStepper ppStepper)
 {
     return(ICorDebugFrame.CreateStepper(out ppStepper));
 }
 internal SourceStepper GetStepper(ICorDebugStepper pStepper)
 {
     SourceStepper stepper;
     _steppers.TryGetValue(pStepper, out stepper);
     return stepper;
 }
 int ICorDebugNativeFrame.CreateStepper(out ICorDebugStepper ppStepper)
 {
     return(((ICorDebugFrame)this).CreateStepper(out ppStepper));
 }
        int ICorDebugFrame.CreateStepper(out ICorDebugStepper ppStepper)
        {
            ppStepper = new CorDebugStepper(this);

            return(COM_HResults.S_OK);
        }
        public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
        {
            Log("Step completed. ({0})", reason);

            var domain  = GetProcessWrapper(pAppDomain).GetAppDomain(pAppDomain);
            var thread  = domain.GetThread(pThread);
            var stepper = domain.GetStepper(pStepper);

            var eventArgs = new StepperEventArgs(domain, thread, stepper);

            if (thread.CurrentFrame.IsUserCode)
            {
                domain.DispatchStepCompletedEvent(eventArgs);
            }
            else
            {
                Log("Non-user code detected. Stepping out.");
                thread.CurrentFrame.CreateStepper().StepOut();
                eventArgs.Continue = true;
            }

            FinalizeEvent(eventArgs);
        }
 int ICorDebugInternalFrame.CreateStepper( out ICorDebugStepper ppStepper )
 {
     return this.ICorDebugFrame.CreateStepper( out ppStepper );
 }
 internal CorStepper (ICorDebugStepper stepper)
     :base(stepper)
 {
     m_step = stepper;
 }
Example #33
0
 internal bool IsCorStepper(ICorDebugStepper corStepper)
 {
     return(this.corStepper == corStepper);
 }
Example #34
0
 internal Stepper(ICorDebugStepper step)
 {
     m_step = step;
 }
 public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
 {
     Console.WriteLine("StepComplete");
     pAppDomain.Continue(0);
 }
		public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
		{
			ManagedCallback managedCallback = GetProcessCallbackInterface("StepComplete", pAppDomain);
			if (managedCallback != null) {
				managedCallback.StepComplete(pAppDomain, pThread, pStepper, reason);
			}
		}
Example #37
0
 public void StepComplete([In, MarshalAs(UnmanagedType.Interface)] ICorDebugAppDomain pAppDomain, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugThread pThread, [In, MarshalAs(UnmanagedType.Interface)] ICorDebugStepper pStepper, [In] CorDebugStepReason reason)
 {
     throw new NotImplementedException();
 }
Example #38
0
		protected internal virtual void OnStepComplete(CorDebugStepReason reason) {
			this.corStepper = null;
			if (StepComplete != null) {
				StepComplete(this, new StepperEventArgs(this, reason));
			}
		}
Example #39
0
        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();
        }
Example #40
0
		internal bool IsCorStepper(ICorDebugStepper corStepper)
		{
			return this.corStepper == corStepper;
		}
Example #41
0
		public StepCompleteDebugCallbackEventArgs(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
			: base(pAppDomain) {
			this.AppDomain = pAppDomain;
			this.Thread = pThread;
			this.Stepper = pStepper;
			this.Reason = reason;
		}
        int ICorDebugFrame.CreateStepper (out ICorDebugStepper ppStepper)
        {
            ppStepper = new CorDebugStepper(this);

            return Utility.COM_HResults.S_OK;
        }
 public virtual void StepComplete(
     ICorDebugAppDomain appDomain, 
     ICorDebugThread thread, 
     ICorDebugStepper stepper, 
     CorDebugStepReason reason)
 {
     this.DefaultHandler(appDomain);
 }
Example #44
0
        public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
        {
            EnterCallback(PausedReason.StepComplete, "StepComplete (" + reason.ToString() + ")", pThread);

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

            process.TraceMessage(" - stepper info: " + stepper.ToString());

            thread.Steppers.Remove(stepper);
            stepper.OnStepComplete();

            if (stepper.PauseWhenComplete)
            {
                if (process.SelectedThread.LastFunction.HasSymbols)
                {
                    ExitCallback_Paused();
                }
                else
                {
                    // This can only happen when JMC is disabled (ie NET1.1 or StepOut)
                    if (stepper.Operation == Stepper.StepperOperation.StepOut)
                    {
                        // Create new stepper and keep going
                        process.TraceMessage(" - stepping out of code without symbols at " + process.SelectedThread.LastFunction.ToString());
                        new Stepper(process.SelectedThread.LastFunction, "Stepper out of code without symbols").StepOut();
                        ExitCallback_Continue();
                    }
                    else
                    {
                        // NET1.1: There is extra step over stepper, just keep going
                        process.TraceMessage(" - leaving code without symbols");
                        ExitCallback_Continue();
                    }
                }
            }
            else
            {
                ExitCallback_Continue();
            }
        }
Example #45
0
            void ICorDebugManagedCallback.StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
            {
                var ev = new CorEventArgs(new CorAppDomain(pAppDomain, p_options));

                GetOwner(ev.Controller).DispatchEvent(ev);

                FinishEvent(ev);
            }
        int ICorDebugThread.CreateStepper(out ICorDebugStepper ppStepper)
        {
            Debug.Assert(!IsVirtualThread);
            ICorDebugFrame frame;

            ((ICorDebugThread)this).GetActiveFrame(out frame);
            ppStepper = new CorDebugStepper((CorDebugFrame)frame);

            return Utility.COM_HResults.S_OK;
        }
Example #47
0
		public void StepComplete(ICorDebugAppDomain appDomain,
								ICorDebugThread thd,
								ICorDebugStepper stepper,
								CorDebugStepReason reason)
		{
		}
        public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
        {
            Log("Step completed. ({0})", reason);

            var domain = GetProcessWrapper(pAppDomain).GetAppDomain(pAppDomain);
            var thread = domain.GetThread(pThread);
            var stepper = domain.GetStepper(pStepper);
            
            var eventArgs = new StepperEventArgs(domain, thread, stepper);

            if (thread.CurrentFrame.IsUserCode)
            {
                domain.DispatchStepCompletedEvent(eventArgs);
            }
            else
            {
                Log("Non-user code detected. Stepping out.");
                thread.CurrentFrame.CreateStepper().StepOut();
                eventArgs.Continue = true;
            }

            FinalizeEvent(eventArgs);
        }
Example #49
0
 void ICorDebugManagedCallback.StepComplete(ICorDebugAppDomain appDomain,
                            ICorDebugThread thread,
                            ICorDebugStepper stepper,
                            CorDebugStepReason stepReason)
 {
     HandleEvent(ManagedCallbackType.OnStepComplete,
                        new CorStepCompleteEventArgs(appDomain == null ? null : new CorAppDomain(appDomain),
                                                     thread == null ? null : new CorThread(thread),
                                                     stepper == null ? null : new CorStepper(stepper),
                                                     stepReason,
                                                     ManagedCallbackType.OnStepComplete));
 }
Example #50
0
 public void StepComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugStepper pStepper, CorDebugStepReason reason)
 {
     throw new NotImplementedException();
 }